From: Thibault Saunier Date: Wed, 13 May 2020 22:25:00 +0000 (-0400) Subject: launcher: Ensure that -j tests run in parallel when running forever X-Git-Tag: 1.19.3~491^2~125 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90cc65f7eec7d3f8bafb6c4369da4ef021c24098;p=platform%2Fupstream%2Fgstreamer.git launcher: Ensure that -j tests run in parallel when running forever So that you can reproduce the issue you want faster! Part-of: --- diff --git a/validate/launcher/apps/gstcheck.py b/validate/launcher/apps/gstcheck.py index 723dbc00bb..ec5764c17c 100644 --- a/validate/launcher/apps/gstcheck.py +++ b/validate/launcher/apps/gstcheck.py @@ -65,6 +65,7 @@ class MesonTest(Test): for var, val in self.child_env.items(): if val != os.environ.get(var): self.add_env_variable(var, val) + env["GST_VALIDATE_LOGSDIR"] = self.options.logsdir return env diff --git a/validate/launcher/baseclasses.py b/validate/launcher/baseclasses.py index 4b47bc41f3..d3877fc7ad 100644 --- a/validate/launcher/baseclasses.py +++ b/validate/launcher/baseclasses.py @@ -159,6 +159,16 @@ class Test(Loggable): return res + def copy(self, nth=None): + copied_test = copy.copy(self) + if nth: + copied_test.classname += '_it' + str(nth) + copied_test.options = copy.copy(self.options) + copied_test.options.logsdir = os.path.join(copied_test.options.logsdir, str(nth)) + os.makedirs(copied_test.options.logsdir, exist_ok=True) + + return copied_test + def clean(self): self.kill_subprocess() self.message = "" @@ -2039,9 +2049,6 @@ class _TestsLauncher(Loggable): if not running_tests: running_tests = self.tests - self.total_num_tests = len(self.all_tests) - printc("\nRunning %d tests..." % self.total_num_tests, color=Colors.HEADER) - self.reporter.init_timer() alone_tests = [] tests = [] @@ -2054,6 +2061,21 @@ class _TestsLauncher(Loggable): max_num_jobs = min(self.options.num_jobs, len(tests)) jobs_running = 0 + if self.options.forever and len(tests) < self.options.num_jobs and len(tests): + max_num_jobs = self.options.num_jobs + copied = [] + i = 0 + while (len(tests) + len(copied)) < max_num_jobs: + copied.append(tests[i].copy(len(copied) + 1)) + + i += 1 + if i >= len(tests): + i = 0 + tests += copied + self.tests += copied + + self.total_num_tests = len(self.all_tests) + printc("\nRunning %d tests..." % self.total_num_tests, color=Colors.HEADER) # if order of test execution doesn't matter, shuffle # the order to optimize cpu usage if self.options.shuffle: