Skip to content

Commit 2df7a4a

Browse files
author
Vasileios Karakasis
authored
Merge pull request #1160 from ekouts/check/update_syntax
[test] Update tests with the new syntax using decorators
2 parents 41ef4f0 + cb82f47 commit 2df7a4a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+186
-319
lines changed

cscs-checks/analytics/spark/spark_check.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
@rfm.simple_test
1616
class SparkAnalyticsCheck(rfm.RunOnlyRegressionTest):
1717
def __init__(self):
18-
super().__init__()
1918
self.descr = 'Simple calculation of pi with Spark'
2019
self.valid_systems = ['daint:gpu', 'daint:mc']
2120
self.valid_prog_environs = ['PrgEnv-cray']
@@ -26,17 +25,19 @@ def __init__(self):
2625
self.stdout, 'pi', float)
2726
self.sanity_patterns = sn.assert_lt(sn.abs(pi_value - math.pi), 0.01)
2827
self.maintainers = ['TM', 'TR']
29-
self.tags = {'production', 'craype'}
28+
self.tags = {'craype'}
3029

31-
def setup(self, partition, environ, **job_opts):
32-
if partition.fullname == 'daint:gpu':
30+
@rfm.run_after('setup')
31+
def set_num_tasks(self):
32+
if self.current_partition.fullname == 'daint:gpu':
3333
self.num_tasks = 48
3434
self.num_tasks_per_node = 12
3535
else:
3636
self.num_tasks = 72
3737
self.num_tasks_per_node = 18
3838

39-
super().setup(partition, environ, **job_opts)
39+
@rfm.run_before('run')
40+
def set_launcher(self):
4041
# The job launcher has to be changed since the `start_analytics`
4142
# script is not used with srun.
4243
self.job.launcher = getlauncher('local')()

cscs-checks/apps/amber/amber_check.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@
1111

1212
class AmberBaseCheck(rfm.RunOnlyRegressionTest):
1313
def __init__(self, input_file, output_file):
14-
super().__init__()
15-
1614
self.sourcesdir = os.path.join(self.current_system.resourcesdir,
1715
'Amber')
18-
1916
self.valid_prog_environs = ['PrgEnv-gnu']
2017
self.modules = ['Amber']
2118
self.num_tasks = 1

cscs-checks/apps/cp2k/cp2k_check.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
class Cp2kCheck(rfm.RunOnlyRegressionTest):
1212
def __init__(self):
13-
super().__init__()
1413
self.valid_prog_environs = ['PrgEnv-gnu']
1514
self.executable = 'cp2k.psmp'
1615
self.executable_opts = ['H2O-256.inp']

cscs-checks/apps/cpmd/cpmd_check.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
@rfm.parameterized_test(['small'], ['large'])
1212
class CPMDCheck(rfm.RunOnlyRegressionTest):
1313
def __init__(self, scale):
14-
super().__init__()
1514
self.descr = 'CPMD check (C4H6 metadynamics)'
1615
self.maintainers = ['AJ', 'LM']
1716
self.tags = {'production'}

cscs-checks/apps/espresso/espresso_check.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
@rfm.parameterized_test(['small'], ['large'])
1414
class QECheck(rfm.RunOnlyRegressionTest):
1515
def __init__(self, scale):
16-
super().__init__()
1716
self.descr = 'Quantum Espresso CPU check'
1817
self.maintainers = ['LM', 'CB']
1918
self.tags = {'scs', 'production', 'external-resources'}

cscs-checks/apps/icon/rrtmgp_check.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ class RRTMGPTest(rfm.RegressionTest):
1414
'''This is an outdated PoC test for ICON-RRTMGP.'''
1515

1616
def __init__(self):
17-
super().__init__()
1817
self.valid_systems = ['dom:gpu', 'daint:gpu']
1918
self.valid_prog_environs = ['PrgEnv-pgi']
2019
self.sourcesdir = os.path.join(self.current_system.resourcesdir,

cscs-checks/apps/lammps/lammps_check.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
class LAMMPSBaseCheck(rfm.RunOnlyRegressionTest):
1313
def __init__(self):
14-
super().__init__()
1514
self.valid_prog_environs = ['PrgEnv-gnu']
1615
self.modules = ['LAMMPS']
1716

cscs-checks/apps/namd/namd_check.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
class NamdBaseCheck(rfm.RunOnlyRegressionTest):
1313
def __init__(self, arch, scale, variant):
14-
super().__init__()
1514
self.descr = 'NAMD check (%s, %s)' % (arch, variant)
1615
self.valid_prog_environs = ['PrgEnv-intel']
1716
self.modules = ['NAMD']
@@ -43,8 +42,8 @@ def __init__(self, arch, scale, variant):
4342

4443
self.perf_patterns = {
4544
'days_ns': sn.avg(sn.extractall(
46-
'Info: Benchmark time: \S+ CPUs \S+ '
47-
's/step (?P<days_ns>\S+) days/ns \S+ MB memory',
45+
r'Info: Benchmark time: \S+ CPUs \S+ '
46+
r's/step (?P<days_ns>\S+) days/ns \S+ MB memory',
4847
self.stdout, 'days_ns', float))
4948
}
5049

cscs-checks/apps/paraview/paraview_check.py

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
@rfm.simple_test
1111
class ParaViewCheck(rfm.RunOnlyRegressionTest):
1212
def __init__(self):
13-
super().__init__()
1413
self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc']
1514
self.valid_prog_environs = ['PrgEnv-gnu']
1615
self.num_tasks = 12
@@ -24,26 +23,15 @@ def __init__(self):
2423
self.maintainers = ['JF']
2524
self.tags = {'scs', 'production'}
2625

27-
def setup(self, partition, environ, **job_opts):
28-
if partition.fullname == 'daint:mc':
29-
self.sanity_patterns = sn.assert_found('Vendor: VMware, Inc.',
30-
self.stdout)
31-
self.sanity_patterns = sn.assert_found('Renderer: llvmpipe',
32-
self.stdout)
33-
elif partition.fullname == 'daint:gpu':
34-
self.sanity_patterns = sn.assert_found(
35-
'Vendor: NVIDIA Corporation', self.stdout)
36-
self.sanity_patterns = sn.assert_found('Renderer: Tesla P100',
37-
self.stdout)
38-
elif partition.fullname == 'dom:gpu':
39-
self.sanity_patterns = sn.assert_found(
40-
'Vendor: NVIDIA Corporation', self.stdout)
41-
self.sanity_patterns = sn.assert_found('Renderer: Tesla P100',
42-
self.stdout)
43-
elif partition.fullname == 'dom:mc':
44-
self.sanity_patterns = sn.assert_found('Vendor: VMware, Inc.',
45-
self.stdout)
46-
self.sanity_patterns = sn.assert_found('Renderer: llvmpipe',
47-
self.stdout)
48-
49-
super().setup(partition, environ, **job_opts)
26+
@rfm.run_before('sanity')
27+
def set_sanity(self):
28+
if self.current_partition.name == 'mc':
29+
self.sanity_patterns = sn.all([
30+
sn.assert_found('Vendor: VMware, Inc.', self.stdout),
31+
sn.assert_found('Renderer: llvmpipe', self.stdout)
32+
])
33+
elif self.current_partition.name == 'gpu':
34+
self.sanity_patterns = sn.all([
35+
sn.assert_found('Vendor: NVIDIA Corporation', self.stdout),
36+
sn.assert_found('Renderer: Tesla P100', self.stdout)
37+
])

cscs-checks/compile/haswell_fma_check.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
@rfm.simple_test
1212
class HaswellFmaCheck(rfm.CompileOnlyRegressionTest):
1313
def __init__(self):
14-
super().__init__()
1514
self.descr = 'check for avx2 instructions'
1615
self.valid_systems = ['dom:login', 'daint:login', 'kesch:login']
1716
if self.current_system.name == 'kesch':
@@ -41,9 +40,10 @@ def __init__(self):
4140
self.maintainers = ['AJ', 'CB']
4241
self.tags = {'production', 'craype'}
4342

44-
def setup(self, partition, environ, **job_opts):
43+
@rfm.run_before('compile')
44+
def setflags(self):
4545
if self.current_system.name == 'kesch':
46-
if environ.name.startswith('PrgEnv-cray'):
46+
if self.current_environ.name.startswith('PrgEnv-cray'):
4747
# Ignore CPATH warning
4848
self.build_system.cflags += ['-h nomessage=1254']
4949
self.build_system.cxxflags += ['-h nomessage=1254']
@@ -52,8 +52,7 @@ def setup(self, partition, environ, **job_opts):
5252
self.build_system.cxxflags += ['-march=native']
5353
self.build_system.fflags += ['-march=native']
5454
else:
55-
if environ.name == 'PrgEnv-cray':
55+
if self.current_environ.name == 'PrgEnv-cray':
5656
self.build_system.cflags = ['-Ofast', '-S']
5757
self.build_system.cxxflags = ['-Ofast', '-S']
5858

59-
super().setup(partition, environ, **job_opts)

0 commit comments

Comments
 (0)