@@ -103,6 +103,60 @@ jobs:
103103 run : |
104104 mlcr run,docker,container --adr.compiler.tags=gcc --docker_mlc_repo=mlcommons@mlperf-automations --docker_mlc_repo_branch=dev --image_name=mlc-script-app-image-classification-onnx-py --env.MLC_DOCKER_RUN_SCRIPT_TAGS=app,image-classification,onnx,python --env.MLC_DOCKER_IMAGE_BASE=ubuntu:22.04 --env.MLC_DOCKER_IMAGE_REPO=local --quiet
105105
106+ - name : Test docker process_mounts input_mapping fallback (src_path fix)
107+ shell : bash
108+ run : |
109+ python3 << 'PYTEST'
110+ import subprocess, re, sys, os
111+
112+ # Find the automation/script directory via mlc
113+ out = subprocess.run(['mlc', 'find', 'script', '--tags=detect,os', '--quiet'],
114+ capture_output=True, text=True)
115+ match = re.search(r'Item path:\s*(.+)', out.stdout + out.stderr)
116+ if not match:
117+ print("ERROR: Could not locate MLC repo via 'mlc find script'")
118+ sys.exit(1)
119+ repo_root = os.path.dirname(os.path.dirname(match.group(1).strip()))
120+ sys.path.insert(0, os.path.join(repo_root, 'automation'))
121+
122+ from script.docker_utils import process_mounts
123+
124+ # Test 1: input_mapping in run_state is used as fallback for docker path remapping
125+ docker_settings = {'user': 'mlcuser'}
126+ mounts = ['${{ MLC_SRC_REPO_PATH }}:${{ MLC_SRC_REPO_PATH }}']
127+ env = {'MLC_SRC_REPO_PATH': '/home/user/repos/my-project'}
128+ run_state = {
129+ 'input_mapping': {'src_path': 'MLC_SRC_REPO_PATH'},
130+ 'file_path_env_keys': [],
131+ 'folder_path_env_keys': []
132+ }
133+ f_run_cmd = {'src_path': '/home/user/repos/my-project'}
134+
135+ result = process_mounts(mounts, env, docker_settings, f_run_cmd, run_state)
136+ assert result['return'] == 0, f"process_mounts failed: {result}"
137+ assert f_run_cmd['src_path'] != '/home/user/repos/my-project', \
138+ f"FAIL: src_path was not remapped to container path! Got: {f_run_cmd['src_path']}"
139+ assert '/mlc-mount/' in f_run_cmd['src_path'], \
140+ f"FAIL: Expected /mlc-mount/ in remapped path, got: {f_run_cmd['src_path']}"
141+ print(f"PASS: src_path correctly remapped to {f_run_cmd['src_path']}")
142+
143+ # Test 2: without input_mapping, f_run_cmd should not be modified
144+ f_run_cmd2 = {'src_path': '/home/user/repos/my-project'}
145+ run_state2 = {
146+ 'input_mapping': {},
147+ 'file_path_env_keys': [],
148+ 'folder_path_env_keys': []
149+ }
150+ mounts2 = ['${{ MLC_SRC_REPO_PATH }}:${{ MLC_SRC_REPO_PATH }}']
151+ result2 = process_mounts(mounts2, env, docker_settings, f_run_cmd2, run_state2)
152+ assert result2['return'] == 0
153+ assert f_run_cmd2['src_path'] == '/home/user/repos/my-project', \
154+ f"FAIL: Without input_mapping, src_path should be unchanged, got: {f_run_cmd2['src_path']}"
155+ print("PASS: Without input_mapping, src_path stays as host path")
156+
157+ print("\nAll process_mounts tests passed!")
158+ PYTEST
159+
106160 test_experiment :
107161 runs-on : ${{ matrix.os }}
108162 strategy :
0 commit comments