-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
From Go 1.19, the build constraint 'unix' proposed in golang/go#20322 is satisfied by any sufficiently Unix-like value of GOOS, as defined by src/go/build/syslist.go. This commit adds a predefined 'unix' condition with the same meaning, available for use in test scripts. The condition is satisfied if the target GOOS is one of the list of Unix-like systems defined in 'imports.UnixOS'. Fixes #166. Co-authored-by: Daniel Martí <[email protected]>
- Loading branch information
Showing
3 changed files
with
28 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
[!exec:sh] skip 'sh not found in $PATH' | ||
|
||
# test that exactly one of gc and gccgo is set | ||
[gc] exec sh -c 'echo gc >> go-compiler' | ||
[gccgo] exec sh -c 'echo gccgo >> go-compiler' | ||
grep '\A(gc|gccgo)\n\z' go-compiler | ||
[gc] mkdir gc_true | ||
[gccgo] mkdir gccgo_true | ||
|
||
[gc] ! exists gccgo_true | ||
[!gc] exists gccgo_true | ||
[gccgo] ! exists gc_true | ||
[!gccgo] exists gc_true | ||
|
||
# test that go version build tags are set | ||
[go1.1] exec sh -c 'echo go1.1 >> go-version' | ||
[go2.1] exec sh -c 'echo go2.1 >> go-version' | ||
grep '\Ago1\.1\n\z' go-version | ||
[go1.1] mkdir go1.x | ||
[go2.1] mkdir go2.x | ||
|
||
exists go1.x | ||
! exists go2.x | ||
|
||
# unix should be true on Linux and MacOS, but not on Windows. | ||
# Both platforms are tested on CI. | ||
[unix] mkdir unix_true | ||
|
||
[linux] exists unix_true | ||
[darwin] exists unix_true | ||
[windows] ! exists unix_true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters