Skip to content

Commit 3355db9

Browse files
dmitshurgopherbot
authored andcommitted
[release-branch.go1.22] time: accept "+01" in TestLoadFixed on OpenBSD
This stops the test from failing with a known failure mode, and creates time to look into what the next steps should be, if any. For #69840. Fixes #70238. Change-Id: I060903d256ed65c5dfcd70ae76eb361cab63186f Reviewed-on: https://go-review.googlesource.com/c/go/+/625197 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Eric Grosse <grosse@gmail.com> (cherry picked from commit bea9b91) Reviewed-on: https://go-review.googlesource.com/c/go/+/627416 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Commit-Queue: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
1 parent 8af39d3 commit 3355db9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/time/time_test.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"math/rand"
1515
"os"
1616
"runtime"
17+
"slices"
1718
"strings"
1819
"sync"
1920
"testing"
@@ -1084,10 +1085,15 @@ func TestLoadFixed(t *testing.T) {
10841085
// So GMT+1 corresponds to -3600 in the Go zone, not +3600.
10851086
name, offset := Now().In(loc).Zone()
10861087
// The zone abbreviation is "-01" since tzdata-2016g, and "GMT+1"
1087-
// on earlier versions; we accept both. (Issue #17276).
1088-
if !(name == "GMT+1" || name == "-01") || offset != -1*60*60 {
1089-
t.Errorf("Now().In(loc).Zone() = %q, %d, want %q or %q, %d",
1090-
name, offset, "GMT+1", "-01", -1*60*60)
1088+
// on earlier versions; we accept both. (Issue 17276.)
1089+
wantName := []string{"GMT+1", "-01"}
1090+
// The zone abbreviation may be "+01" on OpenBSD. (Issue 69840.)
1091+
if runtime.GOOS == "openbsd" {
1092+
wantName = append(wantName, "+01")
1093+
}
1094+
if !slices.Contains(wantName, name) || offset != -1*60*60 {
1095+
t.Errorf("Now().In(loc).Zone() = %q, %d, want %q (one of), %d",
1096+
name, offset, wantName, -1*60*60)
10911097
}
10921098
}
10931099

0 commit comments

Comments
 (0)