From f18c6e342f834988caf43fd652b2baae9c3093f0 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Thu, 27 Jun 2024 19:31:35 +0200 Subject: test: support GOOS/GOARCH pairs in the -target flag This means it's possible to test just a particular OS/arch with a command like this: go test -run=Build -target=linux/arm I found it useful while working on MIPS support. --- main_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main_test.go b/main_test.go index 0f0d52f4d..1ea16cd14 100644 --- a/main_test.go +++ b/main_test.go @@ -297,6 +297,10 @@ func emuCheck(t *testing.T, options compileopts.Options) { } func optionsFromTarget(target string, sema chan struct{}) compileopts.Options { + separators := strings.Count(target, "/") + if (separators == 1 || separators == 2) && !strings.HasSuffix(target, ".json") { + return optionsFromOSARCH(target, sema) + } return compileopts.Options{ // GOOS/GOARCH are only used if target == "" GOOS: goenv.Get("GOOS"), -- cgit v1.2.3