From ceff652ca09ab3e6a2fd34b40d89b095f08bd10c Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 15 Nov 2018 10:29:22 +0100 Subject: [PATCH 1/7] add ssh login env check --- cscs-checks/prgenv/ssh_environ_check.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 cscs-checks/prgenv/ssh_environ_check.py diff --git a/cscs-checks/prgenv/ssh_environ_check.py b/cscs-checks/prgenv/ssh_environ_check.py new file mode 100644 index 0000000000..4348155484 --- /dev/null +++ b/cscs-checks/prgenv/ssh_environ_check.py @@ -0,0 +1,18 @@ +import reframe as rfm +import reframe.utility.sanity as sn + + +@rfm.simple_test +class SSHLoginEnvCheck(rfm.RunOnlyRegressionTest): + def __init__(self): + super().__init__() + self.descr = 'Test the environment when accessed remotely over SSH' + self.valid_systems = ['daint:login', 'dom:login'] + self.valid_prog_environs = ['PrgEnv-cray'] + self.executable = "ssh" + self.executable_opts = ["%s" % self.current_system.name, + "echo", "'$SCRATCH'"] + self.sanity_patterns = sn.assert_found( + r'/scratch/[\S+]', self.stdout) + self.maintainers = ['RS', 'VK'] + self.tags = {'maintenance'} From 776f57613e7bf993522494d73696f24c5fff4870 Mon Sep 17 00:00:00 2001 From: rafael Date: Fri, 16 Nov 2018 10:14:31 +0100 Subject: [PATCH 2/7] fix comments and add enhancements --- cscs-checks/prgenv/ssh_environ_check.py | 32 ++++++++++++++++++------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/cscs-checks/prgenv/ssh_environ_check.py b/cscs-checks/prgenv/ssh_environ_check.py index 4348155484..ad570bdcb4 100644 --- a/cscs-checks/prgenv/ssh_environ_check.py +++ b/cscs-checks/prgenv/ssh_environ_check.py @@ -2,17 +2,31 @@ import reframe.utility.sanity as sn -@rfm.simple_test +@rfm.parameterized_test(['CRAY_CPU_TARGET'], ['CRAYPE_NETWORK_TARGET'], + ['MODULEPATH'], ['MODULESHOME'], ['PE_PRODUCT_LIST'], + ['SCRATCH'], ['XDG_RUNTIME_DIR']) class SSHLoginEnvCheck(rfm.RunOnlyRegressionTest): - def __init__(self): + def __init__(self, envvar): super().__init__() - self.descr = 'Test the environment when accessed remotely over SSH' + self.descr = ('Check if $%s is defined when accessing ' + 'remotely over SSH' % envvar) self.valid_systems = ['daint:login', 'dom:login'] self.valid_prog_environs = ['PrgEnv-cray'] - self.executable = "ssh" - self.executable_opts = ["%s" % self.current_system.name, - "echo", "'$SCRATCH'"] - self.sanity_patterns = sn.assert_found( - r'/scratch/[\S+]', self.stdout) - self.maintainers = ['RS', 'VK'] + self.executable = 'ssh' + self.executable_opts = [self.current_system.name, + 'echo', "'$%s'" % envvar] + values = { + 'CRAY_CPU_TARGET': 'haswell', + 'CRAYPE_NETWORK_TARGET': 'aries', + 'MODULEPATH': r'[\S+]', + 'MODULESHOME': r'/opt/cray/pe/modules/[\d+\.+]', + 'PE_PRODUCT_LIST': 'CRAYPE_HASWELL:CRAY_RCA:CRAY_ALPS:DVS:' + 'CRAY_XPMEM:CRAY_DMAPP:CRAY_PMI:CRAY_UGNI:' + 'CRAY_UDREG:CRAY_LIBSCI:CRAYPE:CRAY:' + 'PERFTOOLS:CRAYPAT', + 'SCRATCH': r'/scratch/[\S+]', + 'XDG_RUNTIME_DIR': r'/run/user/[\d+]' + } + self.sanity_patterns = sn.assert_found(values[envvar], self.stdout) + self.maintainers = ['RS', 'LM'] self.tags = {'maintenance'} From cb3314f16548156ded5db3d89d5d5cd07c39b6e4 Mon Sep 17 00:00:00 2001 From: rafael Date: Tue, 4 Dec 2018 14:03:07 +0100 Subject: [PATCH 3/7] show bug --- cscs-checks/prgenv/ssh_environ_check.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/cscs-checks/prgenv/ssh_environ_check.py b/cscs-checks/prgenv/ssh_environ_check.py index ad570bdcb4..593aa5067f 100644 --- a/cscs-checks/prgenv/ssh_environ_check.py +++ b/cscs-checks/prgenv/ssh_environ_check.py @@ -2,20 +2,15 @@ import reframe.utility.sanity as sn -@rfm.parameterized_test(['CRAY_CPU_TARGET'], ['CRAYPE_NETWORK_TARGET'], - ['MODULEPATH'], ['MODULESHOME'], ['PE_PRODUCT_LIST'], - ['SCRATCH'], ['XDG_RUNTIME_DIR']) +@rfm.simple_test class SSHLoginEnvCheck(rfm.RunOnlyRegressionTest): - def __init__(self, envvar): + def __init__(self): super().__init__() - self.descr = ('Check if $%s is defined when accessing ' - 'remotely over SSH' % envvar) + self.descr = ('Check if a set of environment variables is ' + 'defined when accessing remotely over SSH') self.valid_systems = ['daint:login', 'dom:login'] self.valid_prog_environs = ['PrgEnv-cray'] - self.executable = 'ssh' - self.executable_opts = [self.current_system.name, - 'echo', "'$%s'" % envvar] - values = { + reference = { 'CRAY_CPU_TARGET': 'haswell', 'CRAYPE_NETWORK_TARGET': 'aries', 'MODULEPATH': r'[\S+]', @@ -27,6 +22,14 @@ def __init__(self, envvar): 'SCRATCH': r'/scratch/[\S+]', 'XDG_RUNTIME_DIR': r'/run/user/[\d+]' } - self.sanity_patterns = sn.assert_found(values[envvar], self.stdout) + self.executable = 'ssh' + echo_args = ' '.join('%s=$%s' % (i, i) for i in reference.keys()) + self.executable_opts = [self.current_system.name, + 'echo', "'%s'" % echo_args] + # self.sanity_patterns = sn.all([sn.assert_found('CRAY_CPU_TARGET=haswell', self.stdout)]) + self.sanity_patterns = sn.all( + sn.map(lambda x: sn.assert_found(x, self.stdout), ['CRAY_CPU_TARGET=haswell'])) + # self.sanity_patterns = sn.map(lambda k, v: sn.assert_found('%s=%s' % (k, v), self.stdout), + # reference.keys(), reference.values())) self.maintainers = ['RS', 'LM'] self.tags = {'maintenance'} From 166da0d96de93e823414bc01b69a49dea0ffe2d7 Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 5 Dec 2018 09:19:17 +0100 Subject: [PATCH 4/7] fix comments --- cscs-checks/prgenv/ssh_environ_check.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cscs-checks/prgenv/ssh_environ_check.py b/cscs-checks/prgenv/ssh_environ_check.py index 593aa5067f..ceadbd0db2 100644 --- a/cscs-checks/prgenv/ssh_environ_check.py +++ b/cscs-checks/prgenv/ssh_environ_check.py @@ -6,8 +6,8 @@ class SSHLoginEnvCheck(rfm.RunOnlyRegressionTest): def __init__(self): super().__init__() - self.descr = ('Check if a set of environment variables is ' - 'defined when accessing remotely over SSH') + self.descr = ('Check the values of a set of environment variables ' + 'when accessing remotely over SSH') self.valid_systems = ['daint:login', 'dom:login'] self.valid_prog_environs = ['PrgEnv-cray'] reference = { @@ -26,10 +26,11 @@ def __init__(self): echo_args = ' '.join('%s=$%s' % (i, i) for i in reference.keys()) self.executable_opts = [self.current_system.name, 'echo', "'%s'" % echo_args] - # self.sanity_patterns = sn.all([sn.assert_found('CRAY_CPU_TARGET=haswell', self.stdout)]) - self.sanity_patterns = sn.all( - sn.map(lambda x: sn.assert_found(x, self.stdout), ['CRAY_CPU_TARGET=haswell'])) - # self.sanity_patterns = sn.map(lambda k, v: sn.assert_found('%s=%s' % (k, v), self.stdout), - # reference.keys(), reference.values())) + self.sanity_patterns = sn.all(sn.map(self.assert_envvar, + list(reference.keys()), + list(reference.values()))) self.maintainers = ['RS', 'LM'] self.tags = {'maintenance'} + + def assert_envvar(self, var, value): + return sn.assert_found('='.join([var, value]), self.stdout) From 118263f98954f11485705a5635c1b8499eed0388 Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Thu, 6 Dec 2018 16:34:08 +0100 Subject: [PATCH 5/7] Fine tune SSH environment test --- cscs-checks/prgenv/ssh_environ_check.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/cscs-checks/prgenv/ssh_environ_check.py b/cscs-checks/prgenv/ssh_environ_check.py index ceadbd0db2..2ea7c127ab 100644 --- a/cscs-checks/prgenv/ssh_environ_check.py +++ b/cscs-checks/prgenv/ssh_environ_check.py @@ -15,22 +15,21 @@ def __init__(self): 'CRAYPE_NETWORK_TARGET': 'aries', 'MODULEPATH': r'[\S+]', 'MODULESHOME': r'/opt/cray/pe/modules/[\d+\.+]', - 'PE_PRODUCT_LIST': 'CRAYPE_HASWELL:CRAY_RCA:CRAY_ALPS:DVS:' - 'CRAY_XPMEM:CRAY_DMAPP:CRAY_PMI:CRAY_UGNI:' - 'CRAY_UDREG:CRAY_LIBSCI:CRAYPE:CRAY:' - 'PERFTOOLS:CRAYPAT', + 'PE_PRODUCT_LIST': ('CRAYPE_HASWELL:CRAY_RCA:CRAY_ALPS:DVS:' + 'CRAY_XPMEM:CRAY_DMAPP:CRAY_PMI:CRAY_UGNI:' + 'CRAY_UDREG:CRAY_LIBSCI:CRAYPE:CRAY:' + 'PERFTOOLS:CRAYPAT'), 'SCRATCH': r'/scratch/[\S+]', 'XDG_RUNTIME_DIR': r'/run/user/[\d+]' } self.executable = 'ssh' - echo_args = ' '.join('%s=$%s' % (i, i) for i in reference.keys()) + echo_args = ' '.join('{0}=${0}'.format(i) for i in reference.keys()) self.executable_opts = [self.current_system.name, 'echo', "'%s'" % echo_args] - self.sanity_patterns = sn.all(sn.map(self.assert_envvar, - list(reference.keys()), - list(reference.values()))) + self.sanity_patterns = sn.all( + sn.map(self.assert_envvar, list(reference.items()))) self.maintainers = ['RS', 'LM'] - self.tags = {'maintenance'} + self.tags = {'maintenance', 'production'} - def assert_envvar(self, var, value): - return sn.assert_found('='.join([var, value]), self.stdout) + def assert_envvar(self, v): + return sn.assert_found('='.join(v), self.stdout) From eed3cf6ea1a464bb6c412532210664c23d240684 Mon Sep 17 00:00:00 2001 From: rafael Date: Fri, 7 Dec 2018 08:43:57 +0100 Subject: [PATCH 6/7] fix comments --- cscs-checks/prgenv/ssh_environ_check.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cscs-checks/prgenv/ssh_environ_check.py b/cscs-checks/prgenv/ssh_environ_check.py index 2ea7c127ab..f9b8f4b3a7 100644 --- a/cscs-checks/prgenv/ssh_environ_check.py +++ b/cscs-checks/prgenv/ssh_environ_check.py @@ -23,13 +23,13 @@ def __init__(self): 'XDG_RUNTIME_DIR': r'/run/user/[\d+]' } self.executable = 'ssh' - echo_args = ' '.join('{0}=${0}'.format(i) for i in reference.keys()) + echo_args = ' '.join('%s=$%s' % (i, i) for i in reference.keys()) self.executable_opts = [self.current_system.name, 'echo', "'%s'" % echo_args] self.sanity_patterns = sn.all( sn.map(self.assert_envvar, list(reference.items()))) self.maintainers = ['RS', 'LM'] - self.tags = {'maintenance', 'production'} + self.tags = {'maintenance'} def assert_envvar(self, v): return sn.assert_found('='.join(v), self.stdout) From 072ff07d8121d56e66f8f5da8be4cd65226be74b Mon Sep 17 00:00:00 2001 From: rafael Date: Fri, 7 Dec 2018 10:08:09 +0100 Subject: [PATCH 7/7] revert changes --- cscs-checks/prgenv/ssh_environ_check.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cscs-checks/prgenv/ssh_environ_check.py b/cscs-checks/prgenv/ssh_environ_check.py index f9b8f4b3a7..2ea7c127ab 100644 --- a/cscs-checks/prgenv/ssh_environ_check.py +++ b/cscs-checks/prgenv/ssh_environ_check.py @@ -23,13 +23,13 @@ def __init__(self): 'XDG_RUNTIME_DIR': r'/run/user/[\d+]' } self.executable = 'ssh' - echo_args = ' '.join('%s=$%s' % (i, i) for i in reference.keys()) + echo_args = ' '.join('{0}=${0}'.format(i) for i in reference.keys()) self.executable_opts = [self.current_system.name, 'echo', "'%s'" % echo_args] self.sanity_patterns = sn.all( sn.map(self.assert_envvar, list(reference.items()))) self.maintainers = ['RS', 'LM'] - self.tags = {'maintenance'} + self.tags = {'maintenance', 'production'} def assert_envvar(self, v): return sn.assert_found('='.join(v), self.stdout)