From 73a7524d2775792e0a195a69e86aeb9c201885ea Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Wed, 13 Dec 2023 21:17:13 +0100 Subject: [PATCH 1/2] Fix crash when `--distribute` is applied to a run-only test --- reframe/frontend/testgenerators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reframe/frontend/testgenerators.py b/reframe/frontend/testgenerators.py index 4951053667..3238544141 100644 --- a/reframe/frontend/testgenerators.py +++ b/reframe/frontend/testgenerators.py @@ -90,7 +90,7 @@ def _rfm_pin_run_nodes(obj): def _rfm_pin_build_nodes(obj): pin_nodes = getattr(obj, '$nid') - if not obj.local and not obj.build_locally: + if obj.build_job and not obj.local and not obj.build_locally: obj.build_job.pin_nodes = pin_nodes def _make_dist_test(testcase): From c685a463771ab6e65f9a389ac4b13cae4ee83625 Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Wed, 13 Dec 2023 21:58:11 +0100 Subject: [PATCH 2/2] Add unit test that reproduces the crash --- unittests/resources/checks_unlisted/distribute.py | 5 +++-- unittests/test_cli.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/unittests/resources/checks_unlisted/distribute.py b/unittests/resources/checks_unlisted/distribute.py index ab31f8d7fd..e489caa7c8 100644 --- a/unittests/resources/checks_unlisted/distribute.py +++ b/unittests/resources/checks_unlisted/distribute.py @@ -13,7 +13,8 @@ class Simple(rfm.RunOnlyRegressionTest): valid_systems = ['*'] valid_prog_environs = ['*'] - executable = '/bin/true' + executable = 'true' + sanity_patterns = sn.assert_true(1) class MyFixture(rfm.RunOnlyRegressionTest): @@ -30,7 +31,7 @@ class Complex(rfm.RunOnlyRegressionTest): valid_systems = ['*'] valid_prog_environs = ['*'] f = fixture(MyFixture, scope='session') - executable = '/bin/true' + executable = 'true' @sanity_function def inspect_fixture(self): diff --git a/unittests/test_cli.py b/unittests/test_cli.py index b468658fbb..56623408ed 100644 --- a/unittests/test_cli.py +++ b/unittests/test_cli.py @@ -962,6 +962,18 @@ def test_maxfail_negative(run_reframe): assert returncode == 1 +def test_distribute_build_remotely_runonly(run_reframe, run_action): + returncode, stdout, stderr = run_reframe( + local=False, + more_options=['--distribute', '-S', 'build_locally=0'], + checkpath=['unittests/resources/checks_unlisted/distribute.py'], + action=run_action + ) + assert 'Traceback' not in stdout + assert 'Traceback' not in stderr + assert returncode == 0 + + def test_repeat_option(run_reframe, run_action): returncode, stdout, stderr = run_reframe( more_options=['--repeat', '2', '-n', '^HelloTest'],