Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion config/cscs-ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class ReframeSettings:
reframe_module = 'reframe'
job_poll_intervals = [1, 2, 3]
job_submit_timeout = 60
checks_path = ['checks/']
Expand Down
1 change: 0 additions & 1 deletion config/cscs-pbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class ReframeSettings:
reframe_module = 'reframe'
job_poll_intervals = [1, 2, 3]
job_submit_timeout = 60
checks_path = ['checks/']
Expand Down
3 changes: 2 additions & 1 deletion config/cscs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class ReframeSettings:
reframe_module = 'reframe'
job_poll_intervals = [1, 2, 3]
job_submit_timeout = 60
checks_path = ['checks/']
Expand Down Expand Up @@ -482,6 +481,7 @@ class ReframeSettings:
'modes': {
'*': {
'maintenance': [
'--unload-module=reframe',
'--exec-policy=async',
'--strict',
'--output=$APPS/UES/$USER/regression/maintenance',
Expand All @@ -493,6 +493,7 @@ class ReframeSettings:
'--timestamp=%F_%H-%M-%S'
],
'production': [
'--unload-module=reframe',
'--exec-policy=async',
'--strict',
'--output=$APPS/UES/$USER/regression/production',
Expand Down
56 changes: 34 additions & 22 deletions reframe/frontend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ def list_checks(checks, printer, detailed=False):
def main():
# Setup command line options
argparser = argparse.ArgumentParser()
output_options = argparser.add_argument_group(
'Options controlling regression directories')
output_options = argparser.add_argument_group('Options controlling output')
locate_options = argparser.add_argument_group(
'Options for locating checks')
select_options = argparser.add_argument_group(
Expand All @@ -63,18 +62,20 @@ def main():
'Options controlling actions')
run_options = argparser.add_argument_group(
'Options controlling execution of checks')
env_options = argparser.add_argument_group(
'Options controlling environment')
misc_options = argparser.add_argument_group('Miscellaneous options')

# Output directory options
output_options.add_argument(
'--prefix', action='store', metavar='DIR',
help='Set regression prefix directory to DIR')
help='Set output directory prefix to DIR')
output_options.add_argument(
'-o', '--output', action='store', metavar='DIR',
help='Set regression output directory to DIR')
help='Set output directory to DIR')
output_options.add_argument(
'-s', '--stage', action='store', metavar='DIR',
help='Set regression stage directory to DIR')
help='Set stage directory to DIR')
output_options.add_argument(
'--perflogdir', action='store', metavar='DIR',
help='Set directory prefix for the performance logs '
Expand Down Expand Up @@ -184,34 +185,39 @@ def main():
dest='flex_alloc_tasks', metavar='{all|idle|NUM}', default='idle',
help="Strategy for flexible task allocation (default: 'idle').")

# Miscellaneous options
misc_options.add_argument(
'-C', '--config-file', action='store', dest='config_file',
metavar='FILE', default=os.path.join(reframe.INSTALL_PREFIX,
'reframe/settings.py'),
help='Specify a custom config-file for the machine. '
'(default: %s' % os.path.join(reframe.INSTALL_PREFIX,
'reframe/settings.py'))
misc_options.add_argument(
env_options.add_argument(
'-M', '--map-module', action='append', metavar='MAPPING',
dest='module_mappings', default=[],
help='Apply a single module mapping')
misc_options.add_argument(
env_options.add_argument(
'-m', '--module', action='append', default=[],
metavar='MOD', dest='user_modules',
help='Load module MOD before running the regression')
misc_options.add_argument(
help='Load module MOD before running the regression suite')
env_options.add_argument(
'--module-mappings', action='store', metavar='FILE',
dest='module_map_file',
help='Apply module mappings defined in FILE')
env_options.add_argument(
'-u', '--unload-module', action='append', metavar='MOD',
dest='unload_modules', default=[],
help='Unload module MOD before running the regression suite')
env_options.add_argument(
'--purge-env', action='store_true', dest='purge_env', default=False,
help='Purge environment before running the regression suite')

# Miscellaneous options
misc_options.add_argument(
'-C', '--config-file', action='store', dest='config_file',
metavar='FILE', default=os.path.join(reframe.INSTALL_PREFIX,
'reframe/settings.py'),
help='Specify a custom config-file for the machine. '
'(default: %s' % os.path.join(reframe.INSTALL_PREFIX,
'reframe/settings.py'))
misc_options.add_argument(
'--nocolor', action='store_false', dest='colorize', default=True,
help='Disable coloring of output')
misc_options.add_argument('--performance-report', action='store_true',
help='Print the performance report')
misc_options.add_argument(
'--purge-env', action='store_true', dest='purge_env', default=False,
help='Purge modules environment before running any tests')
misc_options.add_argument(
'--show-config', action='store_true',
help='Print configuration of the current system and exit')
Expand Down Expand Up @@ -488,11 +494,17 @@ def main():
# Act on checks

# Unload regression's module and load user-specified modules
if settings.reframe_module:
rt.modules_system.unload_module(settings.reframe_module)
if hasattr(settings, 'reframe_module'):
printer.warning(
"the 'reframe_module' configuration option will be ignored; "
"please use the '-u' or '--unload-module' options"
)

if options.purge_env:
rt.modules_system.unload_all()
else:
for m in options.unload_modules:
rt.modules_system.unload_module(m)

# Load the environment for the current system
try:
Expand Down
1 change: 0 additions & 1 deletion reframe/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class ReframeSettings:
reframe_module = None
job_poll_intervals = [1, 2, 3]
job_submit_timeout = 60
checks_path = ['checks/']
Expand Down
1 change: 0 additions & 1 deletion tutorial/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class ReframeSettings:
reframe_module = 'reframe'
job_poll_intervals = [1, 2, 3]
job_submit_timeout = 60
checks_path = ['checks/']
Expand Down
2 changes: 1 addition & 1 deletion unittests/modules/testmod_bar
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ proc ModulesHelp { } {
Helper module for PyRegression unit tests
}

module-whatis { Helper module for PyRegression unit tests }
module-whatis { Helper module for ReFrame unit tests }

conflict testmod_bar
conflict testmod_foo
Expand Down
2 changes: 1 addition & 1 deletion unittests/modules/testmod_boo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ proc ModulesHelp { } {
Helper module for PyRegression unit tests
}

module-whatis { Helper module for PyRegression unit tests }
module-whatis { Helper module for ReFrame unit tests }

conflict testmod_boo
conflict testmod_bar
Expand Down
2 changes: 1 addition & 1 deletion unittests/modules/testmod_foo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ proc ModulesHelp { } {
Helper module for PyRegression unit tests
}

module-whatis { Helper module for PyRegression unit tests }
module-whatis { Helper module for ReFrame unit tests }

conflict testmod_foo
conflict testmod_bar
Expand Down
1 change: 0 additions & 1 deletion unittests/resources/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class ReframeSettings:
reframe_module = None
job_poll_intervals = [1, 2, 3]
job_submit_timeout = 60
checks_path = ['checks/']
Expand Down
23 changes: 23 additions & 0 deletions unittests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import copy
import itertools
import os
import pytest
import re
import sys
import tempfile
Expand Down Expand Up @@ -408,3 +409,25 @@ def test_verbosity(self):
self.assertNotIn('Traceback', stdout)
self.assertNotIn('Traceback', stderr)
self.assertEqual(0, returncode)

@fixtures.switch_to_user_runtime
def test_unload_module(self):
# This test is mostly for ensuring coverage. `_run_reframe()` restores
# the current environment, so it is not easy to verify that the modules
# are indeed unloaded. However, this functionality is tested elsewhere
# more exhaustively.

ms = rt.runtime().modules_system
if ms.name == 'nomod':
pytest.skip('no modules system found')

ms.searchpath_add('unittests/modules')
ms.load_module('testmod_foo')
self.more_options = ['-u testmod_foo']
self.action = 'list'
returncode, stdout, stderr = self._run_reframe()
assert stdout != ''
assert 'Traceback' not in stdout
assert 'Traceback' not in stderr
assert returncode == 0
ms.unload_module('testmod_foo')