From 2c897e06668b22e2d1ff07339ffa8923bcd80f79 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Sat, 15 Feb 2025 10:23:04 +1100 Subject: [PATCH] ZTS: test-runner: always apply timestamp to outputdir before updating The default outputdir had a timestamp appended in TestRun.__init__, and then the timestamp was unconditionally applied again after the runfile had been loaded, assuming that an outputdir would be set in the runfile too. If the runfile didn't have an outputdir, then the outputdir would get a second timestamp appended. Further, if test groups or individual tests themselves specificed an outputdir, those would be set on their config, but would not get a timestamp appended. It's not entirely clear if that's wrong or not, but it is certainly not consistent with the rest. To clean all this up, change things to append a timestamp to a received outputdir (from arg or runfile) before setting it in any TestRun, TestGroup or Test object. Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris Reviewed-by: Tony Hutter Reviewed-by: Tino Reichardt Reviewed-by: Igor Kozhukhov --- tests/test-runner/bin/test-runner.py.in | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/test-runner/bin/test-runner.py.in b/tests/test-runner/bin/test-runner.py.in index 92fb64fee..2538f99ca 100755 --- a/tests/test-runner/bin/test-runner.py.in +++ b/tests/test-runner/bin/test-runner.py.in @@ -746,8 +746,11 @@ class TestRun(object): for opt in TestRun.props: if config.has_option('DEFAULT', opt): - setattr(self, opt, config.get('DEFAULT', opt)) - self.outputdir = os.path.join(self.outputdir, self.timestamp) + if opt == 'outputdir': + outputdir = config.get('DEFAULT', opt) + setattr(self, opt, os.path.join(outputdir, self.timestamp)) + else: + setattr(self, opt, config.get('DEFAULT', opt)) testdir = options.testdir @@ -775,6 +778,11 @@ class TestRun(object): failsafe = config.get(sect, prop) setattr(testgroup, prop, os.path.join(testdir, failsafe)) + elif prop == 'outputdir': + outputdir = config.get(sect, prop) + setattr(self, opt, + os.path.join(outputdir, + self.timestamp)) else: setattr(testgroup, prop, config.get(sect, prop)) @@ -793,6 +801,11 @@ class TestRun(object): failsafe = config.get(sect, prop) setattr(test, prop, os.path.join(testdir, failsafe)) + elif prop == 'outputdir': + outputdir = config.get(sect, prop) + setattr(self, opt, + os.path.join(outputdir, + self.timestamp)) else: setattr(test, prop, config.get(sect, prop))