Nir Soffer has uploaded a new change for review. Change subject: tests: Disable slow and stress tests by default ......................................................................
tests: Disable slow and stress tests by default Currnetntly developers must use this crazy command line when runnning the tests: NOSE_SKIP_STRESS_TESTS=1 NOSE_SKIP_SLOW_TESTS=1 make check If you don't add the environment variables, you are wasting your time waiting for slow and stress tests, or stress tests may fail becasue your system is overloaded. This patch change the default so slow and stress tests are disabled by default, so running the normal tests required only: make check To enable slow and stress tests, you can use shorter environment variables: NOSE_STRESS_TESTS=1 NOSE_SLOW_TESTS=1 make check The evironment variables are documented now in the README of the tests directory. Change-Id: Id671a54261e8ef6595277b64b2e4222931ddccd6 Signed-off-by: Nir Soffer <nsof...@redhat.com> --- M tests/README M tests/testValidation.py 2 files changed, 46 insertions(+), 22 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/23/32523/1 diff --git a/tests/README b/tests/README index 9e4d4b4..c0164ef 100644 --- a/tests/README +++ b/tests/README @@ -17,6 +17,25 @@ ./run_tests.sh cPopenTests.py ./run_tests.sh cPopenTests.py:TestCPopen.testEcho +Enabling slow tests: +------------------- + +Some tests are too slow to run on each build. these are marked in the source +with the @slowtest decorator and are disabled by default. + +To enable slow tests: + NOSE_SLOW_TESTS=1 ./run_tests_local.sh filenme [...] + +Enabling stress tests: +--------------------- + +Some tests stress the resources of the system running the tests. These tests +are too slow to run on each build, and may fail on overloaded system or when +running tests in parrallel. These tests are marked in the source with the +@stresstest decorator and are disabled by default. + +To enable stress tests: + NOSE_STRESS_TESTS=1 ./run_tests_local.sh filename [...] Functional test suite: ---------------------- diff --git a/tests/testValidation.py b/tests/testValidation.py index 03b5f5a..abe9d49 100644 --- a/tests/testValidation.py +++ b/tests/testValidation.py @@ -34,60 +34,65 @@ class SlowTestsPlugin(Plugin): - """Skips tests that might be too slow to be run for quick iteration - builds""" + """ + Tests that might be too slow to run on every build are marked with the + @slowtest plugin, and disable by default. Use this plugin to enable these + tests. + """ name = 'slowtests' enabled = False def add_options(self, parser, env=os.environ): - env_opt = 'NOSE_SKIP_SLOW_TESTS' + env_opt = 'NOSE_SLOW_TESTS' if env is None: default = False else: default = env.get(env_opt) - parser.add_option('--without-slow-tests', + parser.add_option('--enable-slow-tests', action='store_true', default=default, - dest='disable_slow_tests', + dest='enable_slow_tests', help='Some tests might take a long time to run, ' + - 'use this to skip slow tests automatically.' + + 'use this to enable slow tests.' + ' [%s]' % env_opt) def configure(self, options, conf): Plugin.configure(self, options, conf) - if options.disable_slow_tests: + if options.enable_slow_tests: SlowTestsPlugin.enabled = True class StressTestsPlugin(Plugin): """ - Denotes a test which stresses the resources of the system under test. Such - tests should probably not be run in parallel. This plugin provides a - mechanism for parallel testing applications to skip stress tests. + Tests that stress the resources of the machine, are too slow to run on each + build and may fail on overloaded machines or machines with unpreditable + resources. + + These tests are mark with @stresstest decorator and are diabled by default. + Use this plugin to enable these tests. """ - name = 'nonparalleltests' + name = 'stresstests' enabled = False def add_options(self, parser, env=os.environ): - env_opt = 'NOSE_SKIP_STRESS_TESTS' + env_opt = 'NOSE_STRESS_TESTS' if env is None: default = False else: default = env.get(env_opt) - parser.add_option('--without-stress-tests', + parser.add_option('--enable-stress-tests', action='store_true', default=default, - dest='disable_stress_tests', + dest='enable_stress_tests', help='Some tests stress the resources of the ' + - 'system under test. Use this option to skip' + - 'these tests (eg. when doing parallel' + - 'testing [%s]' % env_opt) + 'system running the tests. Use this to ' + + 'enable stress tests [%s]' % env_opt) def configure(self, options, conf): Plugin.configure(self, options, conf) - if options.disable_stress_tests: + if options.enable_stress_tests: StressTestsPlugin.enabled = True @@ -148,8 +153,8 @@ def slowtest(f): @wraps(f) def wrapper(*args, **kwargs): - if SlowTestsPlugin.enabled: - raise SkipTest("Slow tests have been disabled") + if not SlowTestsPlugin.enabled: + raise SkipTest("Slow tests are disabled") return f(*args, **kwargs) @@ -172,8 +177,8 @@ def stresstest(f): @wraps(f) def wrapper(*args, **kwargs): - if StressTestsPlugin.enabled: - raise SkipTest("Stress tests have been disabled") + if not StressTestsPlugin.enabled: + raise SkipTest("Stress tests are disabled") return f(*args, **kwargs) -- To view, visit http://gerrit.ovirt.org/32523 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id671a54261e8ef6595277b64b2e4222931ddccd6 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <nsof...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches