diff options
author | Ian Lance Taylor <iant@golang.org> | 2021-11-10 09:35:59 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-11-11 04:54:05 +0000 |
commit | 4b27d40b508a1d37ffcd84a411408309804d2a2a (patch) | |
tree | 6acafbbbef89092c6e84a601c70572c2c168962e /misc | |
parent | d5a5a13ad987db9bcdda8c6cecb84ed8583ea68d (diff) | |
download | go-4b27d40b508a1d37ffcd84a411408309804d2a2a.tar.gz go-4b27d40b508a1d37ffcd84a411408309804d2a2a.zip |
misc/cgo/testshared: correct test of gccgo version number
We still don't run the gccgo tests, because they don't run in module mode.
But now we at least get the version number check right.
Change-Id: Ifde4512c30605d1cb7e3a521f381a05c783549b7
Reviewed-on: https://go-review.googlesource.com/c/go/+/362996
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/cgo/testshared/shared_test.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/misc/cgo/testshared/shared_test.go b/misc/cgo/testshared/shared_test.go index 672811fe0e..d5d018f151 100644 --- a/misc/cgo/testshared/shared_test.go +++ b/misc/cgo/testshared/shared_test.go @@ -20,6 +20,7 @@ import ( "regexp" "runtime" "sort" + "strconv" "strings" "testing" "time" @@ -694,7 +695,15 @@ func requireGccgo(t *testing.T) { if err != nil { t.Fatalf("%s -dumpversion failed: %v\n%s", gccgoPath, err, output) } - if string(output) < "5" { + dot := bytes.Index(output, []byte{'.'}) + if dot > 0 { + output = output[:dot] + } + major, err := strconv.Atoi(string(output)) + if err != nil { + t.Skipf("can't parse gccgo version number %s", output) + } + if major < 5 { t.Skipf("gccgo too old (%s)", strings.TrimSpace(string(output))) } |