From 1bc6cb361500fda793f8a64317f3922ac40c58cc Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Fri, 23 Dec 2016 14:58:56 -0300 Subject: [PATCH] validate:launcher: Take into account test duration when filtering them Otherwise running -t 'some.*test' will run long tests (longer than hard timeout) which is not what the user expect. --- validate/launcher/baseclasses.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py index 1e1f237be0..1204a8cf76 100644 --- a/validate/launcher/baseclasses.py +++ b/validate/launcher/baseclasses.py @@ -1177,17 +1177,25 @@ class TestsManager(Loggable): return True return False + def _check_duration(self, test): + if test.duration > 0 and int(self.options.long_limit) < int(test.duration): + self.info("Not activating %s as its duration (%d) is superior" + " than the long limit (%d)" % (test, test.duration, + int(self.options.long_limit))) + return False + + return True + def _is_test_wanted(self, test): if self._check_whitelisted(test): + if not self._check_duration(test): + return False return True if self._check_blacklisted(test): return False - if test.duration > 0 and int(self.options.long_limit) < int(test.duration): - self.info("Not activating %s as its duration (%d) is superior" - " than the long limit (%d)" % (test, test.duration, - int(self.options.long_limit))) + if not self._check_duration(test): return False if not self.wanted_tests_patterns: