mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 03:45:39 +00:00
launcher: Ensure that -j tests run in parallel when running forever
So that you can reproduce the issue you want faster! Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/197>
This commit is contained in:
parent
c9318639d7
commit
90cc65f7ee
2 changed files with 26 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue