Skip to content

Commit f18c6e3

Browse files
aykevldeadprogram
authored andcommitted
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.
1 parent 2d5a8d4 commit f18c6e3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

main_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ func emuCheck(t *testing.T, options compileopts.Options) {
297297
}
298298

299299
func optionsFromTarget(target string, sema chan struct{}) compileopts.Options {
300+
separators := strings.Count(target, "/")
301+
if (separators == 1 || separators == 2) && !strings.HasSuffix(target, ".json") {
302+
return optionsFromOSARCH(target, sema)
303+
}
300304
return compileopts.Options{
301305
// GOOS/GOARCH are only used if target == ""
302306
GOOS: goenv.Get("GOOS"),

0 commit comments

Comments
 (0)