Skip to content

Commit f7bbeca

Browse files
committed
contest: vmksft-p: allow using a different test path than tools/testing/selftests/
YNL tests follow the same steps as ksft but they live under tools/net/ynl/tests So allow using different test "root" path. Other than that vmksft-p should be able to just run them. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 2e37e09 commit f7bbeca

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

contest/remote/vmksft-p.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@
6060
"""
6161

6262

63-
def get_prog_list(vm, targets):
63+
def get_prog_list(vm, targets, test_path):
6464
tmpdir = tempfile.mkdtemp()
6565
targets = " ".join(targets)
66-
vm.tree_cmd(['make', '-C', 'tools/testing/selftests/', 'TARGETS=' + targets, 'INSTALL_PATH=' + tmpdir, 'install'])
66+
vm.tree_cmd(['make', '-C', test_path, 'TARGETS=' + targets, 'INSTALL_PATH=' + tmpdir, 'install'])
6767

6868
with open(os.path.join(tmpdir, 'kselftest-list.txt'), "r") as fp:
6969
targets = fp.readlines()
@@ -129,6 +129,7 @@ def _parse_nested_tests(full_run, prev_results):
129129
return tests
130130

131131
def _vm_thread(config, results_path, thr_id, hard_stop, in_queue, out_queue):
132+
test_path = config.get('ksft', 'test_path', fallback='tools/testing/selftests')
132133
vm = None
133134
vm_id = -1
134135

@@ -161,7 +162,7 @@ def _vm_thread(config, results_path, thr_id, hard_stop, in_queue, out_queue):
161162

162163
print(f"INFO: thr-{thr_id} testing == " + prog)
163164
t1 = datetime.datetime.now()
164-
vm.cmd(f'make -C tools/testing/selftests TARGETS="{target}" TEST_PROGS={prog} TEST_GEN_PROGS="" run_tests')
165+
vm.cmd(f'make -C {test_path} TARGETS="{target}" TEST_PROGS={prog} TEST_GEN_PROGS="" run_tests')
165166
try:
166167
vm.drain_to_prompt(deadline=deadline)
167168
retcode = vm.bash_prev_retcode()
@@ -281,6 +282,7 @@ def test(binfo, rinfo, cbarg):
281282
rinfo['run-cookie']
282283
rinfo['link'] = link
283284
targets = config.get('ksft', 'target').split()
285+
test_path = config.get('ksft', 'test_path', fallback='tools/testing/selftests')
284286
grp_name = "selftests-" + namify(targets[0])
285287

286288
if config.get('device', 'info_script', fallback=None):
@@ -293,15 +295,15 @@ def test(binfo, rinfo, cbarg):
293295
build_ok = True
294296
kconfs = []
295297
for target in targets:
296-
conf = f"tools/testing/selftests/{target}/config"
298+
conf = f"{test_path}/{target}/config"
297299
if os.path.exists(os.path.join(vm.tree_path, conf)):
298300
kconfs.append(conf)
299301
build_ok &= vm.build(kconfs)
300302

301303
shutil.copy(os.path.join(config.get('local', 'tree_path'), '.config'),
302304
results_path + '/config')
303305
vm.tree_cmd("make headers")
304-
ret = vm.tree_cmd(["make", "-C", "tools/testing/selftests/",
306+
ret = vm.tree_cmd(["make", "-C", test_path,
305307
"TARGETS=" + " ".join(targets)])
306308
build_ok &= ret == 0
307309
vm.dump_log(results_path + '/build')
@@ -313,7 +315,7 @@ def test(binfo, rinfo, cbarg):
313315
'link': link + '/build',
314316
}]
315317

316-
progs = get_prog_list(vm, targets)
318+
progs = get_prog_list(vm, targets, test_path)
317319
progs.sort(reverse=True, key=lambda prog : cbarg.prev_runtime.get(prog, 0))
318320

319321
dl_min = config.getint('executor', 'deadline_minutes', fallback=999999)

0 commit comments

Comments
 (0)