Overwrite the timezone for JS/pixel/corpus tests on Linux
Set the TZ environment variable in test_runner.py, so all test suites
that use it run tests in the same TZ. Use America/Los_Angeles, AKA
PST/PDT, as that is what the existing test expectations assume.
For now, just do this on Linux, since that is the platform currently
failing the continuous build. Whereas trying to do this on Windows seems
to have the opposite effect and actually triggers the issue.
Bug: 461544934
Change-Id: I7ed7e02fe14b1440cb45e15e66d9ba4d3212c0fb
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/138410
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/testing/tools/test_runner.py b/testing/tools/test_runner.py
index 36bc147..75a96b9 100644
--- a/testing/tools/test_runner.py
+++ b/testing/tools/test_runner.py
@@ -29,6 +29,9 @@
# timestamp of the first commit to repo, 2014/5/9 17:48:50.
TEST_SEED_TIME = '1399672130'
+# Time zone used to make sure tests that depend on the current time are stable.
+TEST_DEFAULT_TIMEZONE = 'America/Los_Angeles'
+
# List of test types that should run text tests instead of pixel tests.
TEXT_TESTS = ['javascript']
@@ -302,6 +305,10 @@
# Clear out and create top level gold output directory before starting
skia_gold.clear_gold_output_dir(self.options.gold_output_dir)
+ # TODO(crbug.com/461544934): Check timezone behavior on other platforms.
+ if common.os_name() == 'linux':
+ os.environ['TZ'] = TEST_DEFAULT_TIMEZONE
+
with multiprocessing.Pool(
processes=self.options.num_workers,
initializer=_InitializePerProcessState,