From b1f3f29e5e43326bf71e9f09d1d0cb1127483e6b Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Fri, 27 Jul 2018 12:41:34 +0200 Subject: [PATCH 1/2] Adapt cdo test to PE 18.07 * Adapt to new regression test syntax. --- cscs-checks/tools/io/cdo.py | 70 ++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/cscs-checks/tools/io/cdo.py b/cscs-checks/tools/io/cdo.py index 68208425a2..3ebf62cd41 100644 --- a/cscs-checks/tools/io/cdo.py +++ b/cscs-checks/tools/io/cdo.py @@ -19,14 +19,15 @@ import os +import reframe as rfm import reframe.utility.sanity as sn from reframe.core.pipeline import RunOnlyRegressionTest -class CDOBaseCheck(RunOnlyRegressionTest): - def __init__(self, sub_check, **kwargs): - super().__init__('CDO_' + sub_check + '_check', - os.path.dirname(__file__), **kwargs) +class CDOBaseCheck(rfm.RunOnlyRegressionTest): + def __init__(self, sub_check): + super().__init__() + self.name = 'CDO_' + sub_check + '_check' self.sourcesdir = os.path.join(self.current_system.resourcesdir, 'CDO-NCO') self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc', @@ -44,9 +45,10 @@ def setup(self, partition, environ, **job_opts): # Check that the netCDF loaded by the CDO module supports the nc4 filetype # (nc4 support must be explicitly activated when the netCDF library is # compiled...). +@rfm.simple_test class DependencyCheck(CDOBaseCheck): - def __init__(self, **kwargs): - super().__init__('dependency', **kwargs) + def __init__(self): + super().__init__('dependency') self.descr = ('verifies that the netCDF loaded by the CDO module ' 'supports the nc4 filetype') self.sourcesdir = None @@ -55,9 +57,10 @@ def __init__(self, **kwargs): self.sanity_patterns = sn.assert_found(r'^yes', self.stdout) +@rfm.simple_test class NC4SupportCheck(CDOBaseCheck): - def __init__(self, **kwargs): - super().__init__('nc4_support', **kwargs) + def __init__(self): + super().__init__('nc4_support') self.descr = ('verifies that the CDO supports the nc4 filetype') self.sourcesdir = None self.executable = 'cdo' @@ -72,9 +75,10 @@ def __init__(self, **kwargs): # 'module load NCO' cannot be passed via self.executable to srun as 'module' # is not an executable. Thus, we run the command as a pre_run command and # define as executable just an echo with no arguments. +@rfm.simple_test class NCOModuleCompatibilityCheck(CDOBaseCheck): - def __init__(self, **kwargs): - super().__init__('nco_module_compat', **kwargs) + def __init__(self): + super().__init__('nco_module_compat') self.descr = ('verifies compatibility with the NCO module') self.sourcesdir = None self.executable = 'echo' @@ -87,9 +91,10 @@ def setup(self, partition, environ, **job_opts): super().setup(partition, environ, **job_opts) +@rfm.simple_test class InfoNCCheck(CDOBaseCheck): - def __init__(self, **kwargs): - super().__init__('info_nc', **kwargs) + def __init__(self): + super().__init__('info_nc') self.descr = ('verifies reading info of a standard netCDF file') self.executable = 'cdo' self.executable_opts = ['info', 'sresa1b_ncar_ccsm3-example.nc'] @@ -101,9 +106,10 @@ def __init__(self, **kwargs): ]) +@rfm.simple_test class InfoNC4Check(CDOBaseCheck): - def __init__(self, **kwargs): - super().__init__('info_nc4', **kwargs) + def __init__(self): + super().__init__('info_nc4') self.descr = ('verifies reading info of a netCDF-4 file') self.executable = 'cdo' self.executable_opts = [ @@ -116,9 +122,10 @@ def __init__(self, **kwargs): ]) +@rfm.simple_test class InfoNC4CCheck(CDOBaseCheck): - def __init__(self, **kwargs): - super().__init__('info_nc4c', **kwargs) + def __init__(self): + super().__init__('info_nc4c') self.descr = ('verifies reading info of a compressed netCDF-4 file') self.executable = 'cdo' self.executable_opts = [ @@ -130,9 +137,10 @@ def __init__(self, **kwargs): ]) +@rfm.simple_test class MergeNCCheck(CDOBaseCheck): - def __init__(self, **kwargs): - super().__init__('merge_nc', **kwargs) + def __init__(self): + super().__init__('merge_nc') self.descr = ('verifies merging of 3 standard netCDF files') self.executable = 'cdo' self.executable_opts = [ @@ -145,13 +153,14 @@ def __init__(self, **kwargs): self.sanity_patterns = sn.all([ sn.assert_not_found(r'(?i)unsupported|error', self.stderr), sn.assert_found(r'cdo merge: Processed 98304 values from 3 ' - r'variables over 3 timesteps', self.stderr) + r'variables over (1|3) timesteps?', self.stderr) ]) +@rfm.simple_test class MergeNC4Check(CDOBaseCheck): - def __init__(self, **kwargs): - super().__init__('merge_nc4', **kwargs) + def __init__(self): + super().__init__('merge_nc4') self.descr = ('verifies merging of 3 netCDF-4 files') self.executable = 'cdo' self.executable_opts = [ @@ -164,13 +173,14 @@ def __init__(self, **kwargs): self.sanity_patterns = sn.all([ sn.assert_not_found(r'(?i)unsupported|error', self.stderr), sn.assert_found(r'cdo merge: Processed 442368 values from 3 ' - r'variables over 24 timesteps', self.stderr) + r'variables over (8|24) timesteps', self.stderr) ]) +@rfm.simple_test class MergeNC4CCheck(CDOBaseCheck): - def __init__(self, **kwargs): - super().__init__('merge_nc4c', **kwargs) + def __init__(self): + super().__init__('merge_nc4c') self.descr = ('verifies merging and compressing of 3 compressed ' 'netCDF-4 files') self.executable = 'cdo' @@ -184,15 +194,5 @@ def __init__(self, **kwargs): self.sanity_patterns = sn.all([ sn.assert_not_found(r'(?i)unsupported|error', self.stderr), sn.assert_found(r'cdo merge: Processed 442368 values from 3 ' - r'variables over 24 timesteps', self.stderr) + r'variables over (8|24) timesteps', self.stderr) ]) - - -def _get_checks(**kwargs): - return [ - DependencyCheck(**kwargs), NC4SupportCheck(**kwargs), - NCOModuleCompatibilityCheck(**kwargs), InfoNCCheck(**kwargs), - InfoNC4Check(**kwargs), InfoNC4CCheck(**kwargs), - MergeNCCheck(**kwargs), MergeNC4Check(**kwargs), - MergeNC4CCheck(**kwargs) - ] From 26ef10a8b6a917f80f483db69d9864b2703c4606 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Tue, 28 Aug 2018 21:28:16 +0200 Subject: [PATCH 2/2] Address PR comments --- cscs-checks/tools/io/cdo.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/cscs-checks/tools/io/cdo.py b/cscs-checks/tools/io/cdo.py index 3ebf62cd41..e15dbe4cc3 100644 --- a/cscs-checks/tools/io/cdo.py +++ b/cscs-checks/tools/io/cdo.py @@ -25,9 +25,8 @@ class CDOBaseCheck(rfm.RunOnlyRegressionTest): - def __init__(self, sub_check): + def __init__(self): super().__init__() - self.name = 'CDO_' + sub_check + '_check' self.sourcesdir = os.path.join(self.current_system.resourcesdir, 'CDO-NCO') self.valid_systems = ['daint:gpu', 'daint:mc', 'dom:gpu', 'dom:mc', @@ -48,7 +47,7 @@ def setup(self, partition, environ, **job_opts): @rfm.simple_test class DependencyCheck(CDOBaseCheck): def __init__(self): - super().__init__('dependency') + super().__init__() self.descr = ('verifies that the netCDF loaded by the CDO module ' 'supports the nc4 filetype') self.sourcesdir = None @@ -60,7 +59,7 @@ def __init__(self): @rfm.simple_test class NC4SupportCheck(CDOBaseCheck): def __init__(self): - super().__init__('nc4_support') + super().__init__() self.descr = ('verifies that the CDO supports the nc4 filetype') self.sourcesdir = None self.executable = 'cdo' @@ -78,7 +77,7 @@ def __init__(self): @rfm.simple_test class NCOModuleCompatibilityCheck(CDOBaseCheck): def __init__(self): - super().__init__('nco_module_compat') + super().__init__() self.descr = ('verifies compatibility with the NCO module') self.sourcesdir = None self.executable = 'echo' @@ -94,7 +93,7 @@ def setup(self, partition, environ, **job_opts): @rfm.simple_test class InfoNCCheck(CDOBaseCheck): def __init__(self): - super().__init__('info_nc') + super().__init__() self.descr = ('verifies reading info of a standard netCDF file') self.executable = 'cdo' self.executable_opts = ['info', 'sresa1b_ncar_ccsm3-example.nc'] @@ -109,7 +108,7 @@ def __init__(self): @rfm.simple_test class InfoNC4Check(CDOBaseCheck): def __init__(self): - super().__init__('info_nc4') + super().__init__() self.descr = ('verifies reading info of a netCDF-4 file') self.executable = 'cdo' self.executable_opts = [ @@ -125,7 +124,7 @@ def __init__(self): @rfm.simple_test class InfoNC4CCheck(CDOBaseCheck): def __init__(self): - super().__init__('info_nc4c') + super().__init__() self.descr = ('verifies reading info of a compressed netCDF-4 file') self.executable = 'cdo' self.executable_opts = [ @@ -140,7 +139,7 @@ def __init__(self): @rfm.simple_test class MergeNCCheck(CDOBaseCheck): def __init__(self): - super().__init__('merge_nc') + super().__init__() self.descr = ('verifies merging of 3 standard netCDF files') self.executable = 'cdo' self.executable_opts = [ @@ -160,7 +159,7 @@ def __init__(self): @rfm.simple_test class MergeNC4Check(CDOBaseCheck): def __init__(self): - super().__init__('merge_nc4') + super().__init__() self.descr = ('verifies merging of 3 netCDF-4 files') self.executable = 'cdo' self.executable_opts = [ @@ -180,7 +179,7 @@ def __init__(self): @rfm.simple_test class MergeNC4CCheck(CDOBaseCheck): def __init__(self): - super().__init__('merge_nc4c') + super().__init__() self.descr = ('verifies merging and compressing of 3 compressed ' 'netCDF-4 files') self.executable = 'cdo'