Skip to content

Commit fc74289

Browse files
author
Theofilos Manitaras
committed
Address PR comments
Signed-off-by: Theofilos Manitaras <[email protected]>
1 parent 3abe4ea commit fc74289

File tree

8 files changed

+38
-40
lines changed

8 files changed

+38
-40
lines changed

reframe/frontend/loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def load_from_module(self, module):
189189
self._loaded[c.unique_name] = testfile
190190
final_tests.append(c)
191191
else:
192-
if testfile != conflicted:
192+
if not c.is_fixture():
193193
raise NameConflictError(
194194
f'test {c.unique_name!r} from {testfile!r} '
195195
f'is already defined in {conflicted!r}'
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2016-2022 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
2+
# ReFrame Project Developers. See the top-level LICENSE file for details.
3+
#
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
6+
import reframe as rfm
7+
import reframe.utility.sanity as sn
8+
9+
10+
@rfm.simple_test
11+
class SimpleParameter(rfm.RunOnlyRegressionTest):
12+
message = parameter(['foo', 'bar'])
13+
valid_systems = ['*']
14+
valid_prog_environs = ['*']
15+
executable = 'echo'
16+
sanity_patterns = sn.assert_true(1)

unittests/resources/checks_unlisted/testlib_inheritance_bar.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,10 @@
44
# SPDX-License-Identifier: BSD-3-Clause
55

66
import reframe as rfm
7-
import reframe.utility.sanity as sn
87

9-
from testlib.simple import simple_check
8+
from testlib.simple import simple_echo_check
109

1110

1211
@rfm.simple_test
13-
class HelloBar(simple_check):
14-
executable_opts = ['Bar']
15-
16-
@sanity_function
17-
def assert_output(self):
18-
return sn.assert_found(r'Hello Bar', self.stdout)
12+
class HelloBar(simple_echo_check):
13+
message = 'Bar'

unittests/resources/checks_unlisted/testlib_inheritance_foo.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,10 @@
44
# SPDX-License-Identifier: BSD-3-Clause
55

66
import reframe as rfm
7-
import reframe.utility.sanity as sn
87

9-
from testlib.simple import simple_check
8+
from testlib.simple import simple_echo_check
109

1110

1211
@rfm.simple_test
13-
class HelloFoo(simple_check):
14-
executable_opts = ['Foo']
15-
16-
@sanity_function
17-
def assert_output(self):
18-
return sn.assert_found(r'Hello Foo', self.stdout)
12+
class HelloFoo(simple_echo_check):
13+
message = 'Foo'

unittests/resources/testlib/simple.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@
99
import reframe.utility.sanity as sn
1010

1111

12-
class simple_make_build(rfm.CompileOnlyRegressionTest, pin_prefix=True):
13-
descr = 'Simple Make build fixture'
14-
sourcesdir = 'src'
15-
build_system = 'Make'
12+
class simple_echo(rfm.RunOnlyRegressionTest, pin_prefix=True):
13+
descr = 'Simple Echo build fixture'
14+
executable = 'echo'
15+
executable_opts = ['Hello']
1616

1717
@sanity_function
1818
def assert_success(self):
19-
return sn.assert_not_found(r'\S+', self.stderr)
19+
return sn.assert_found(r'Hello', self.stdout)
2020

2121

2222
@rfm.simple_test
23-
class simple_check(rfm.RunOnlyRegressionTest):
24-
descr = 'Simple test'
23+
class simple_echo_check(rfm.RunOnlyRegressionTest):
24+
descr = 'Simple Echo Test'
2525
valid_systems = ['*']
2626
valid_prog_environs = ['builtin']
27-
executable = 'hello.x'
28-
executable_opts = ['World']
29-
30-
hello_binaries = fixture(simple_make_build, scope='environment')
27+
executable = 'echo'
28+
message = variable(str, value='World')
29+
hello_output = fixture(simple_echo, scope='environment')
3130

3231
@run_before('run')
3332
def add_exec_prefix(self):
34-
self.executable = os.path.join(self.hello_binaries.stagedir,
35-
self.executable)
33+
fixture_output = os.path.join(self.hello_output.stagedir,
34+
str(self.hello_output.stdout))
35+
self.executable_opts = [f'$(cat {fixture_output})', self.message]
3636

3737
@sanity_function
3838
def assert_sanity(self):
39-
return sn.assert_found(r'Hello World', self.stdout)
39+
return sn.assert_found(rf'Hello {self.message}', self.stdout)

unittests/resources/testlib/src/Makefile

Lines changed: 0 additions & 2 deletions
This file was deleted.

unittests/resources/testlib/src/hello.c

Lines changed: 0 additions & 6 deletions
This file was deleted.

unittests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ def test_dynamic_tests_filtering(run_reframe, tmp_path):
10471047
assert 'FAILED' not in stdout
10481048

10491049

1050-
def test_testlib_inherit_in_different_files(run_reframe, monkeypatch):
1050+
def test_testlib_inherit_fixture_in_different_files(run_reframe, monkeypatch):
10511051
monkeypatch.syspath_prepend('unittests/resources')
10521052
returncode, stdout, _ = run_reframe(
10531053
checkpath=[

0 commit comments

Comments
 (0)