From eaaa0de74d10415570c1cd24c54c99d4623b5862 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Fri, 26 Jun 2020 13:35:15 +0200 Subject: [PATCH] tests/builtins.sh: change GMT to UTC before testing (re: c9634e90) Apparently some systems are still configured to use GMT instead of UTC after all. This included our own GitHub CI runner config. Oops. This made the previous commit fail to pass the CI test run. We can't win this one, it's got to be either one or the other. UTC is the international standard on which civil time is based. GMT is often taken as synonymous for UTC, but in navigation, it can differ from UTC by up to 0.9 seconds. Ref.: https://en.wikipedia.org/w/index.php?title=Greenwich_Mean_Time&oldid=963422787 The more ambiguous term should not be the first preference. src/cmd/ksh93/tests/builtins.sh: - Before checking 'printf %T now' output against 'date' output, change any ' GMT ' in the latter to ' UTC '. .github/workflows/ci.yml: - Set time zone to UTC, not GMT. --- .github/workflows/ci.yml | 2 +- src/cmd/ksh93/tests/builtins.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7ef253fc..8da245115 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,6 @@ jobs: run: bin/package make - name: Regression tests run: | - export TZ=GMT + export TZ=UTC ulimit -n 1024 script -q -e -c "bin/shtests" diff --git a/src/cmd/ksh93/tests/builtins.sh b/src/cmd/ksh93/tests/builtins.sh index c1bc4a435..948c1c451 100755 --- a/src/cmd/ksh93/tests/builtins.sh +++ b/src/cmd/ksh93/tests/builtins.sh @@ -311,8 +311,8 @@ fi [[ $(printf '%q\n') == '' ]] || err_exit 'printf "%q" with missing arguments' # we won't get hit by the one second boundary twice, right? expect= actual= -{ expect=$(LC_ALL=C date) && actual=$(LC_ALL=C printf '%T\n' now) && [[ $actual == "$expect" ]]; } || -{ expect=$(LC_ALL=C date) && actual=$(LC_ALL=C printf '%T\n' now) && [[ $actual == "$expect" ]]; } || +{ expect=$(LC_ALL=C date | sed 's/ GMT / UTC /') && actual=$(LC_ALL=C printf '%T\n' now) && [[ $actual == "$expect" ]]; } || +{ expect=$(LC_ALL=C date | sed 's/ GMT / UTC /') && actual=$(LC_ALL=C printf '%T\n' now) && [[ $actual == "$expect" ]]; } || err_exit 'printf "%T" now' "(expected $(printf %q "$expect"), got $(printf %q "$actual"))" behead() {