diff options
| author | Alexander Egorenkov <eaibmz@gmail.com> | 2024-06-12 12:56:55 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2024-06-13 13:03:06 +0000 |
| commit | af14338446028bc58d040a678f63772e9c456e74 (patch) | |
| tree | ae1b4550fc2783b9b8933e5d05615ec4803f729a /sys/targets | |
| parent | 2a27d56f53253786439ff9ae7711fd75abd9bc6e (diff) | |
sys/targets: fix BuildOS initialization for TestOS
Move the initialization of the target's BuildOS into initTarget()
function for TestOS because a correct value of BuildOS is required not to
falsely spoil native compiler binaries for TestOS and by that prevent
TestOS unit test from compiling.
$ go test -v -count=1 -run=TestCover/32 ./pkg/runtest/
=== RUN TestCover
=== PAUSE TestCover
=== CONT TestCover
=== RUN TestCover/32
=== PAUSE TestCover/32
=== CONT TestCover/32
build.go:39: failed to build executor: failed to build program:
compiler invocation: cant-build-test-on-linux
--- FAIL: TestCover (0.21s)
--- FAIL: TestCover/32 (0.00s)
FAIL
FAIL github.com/google/syzkaller/pkg/runtest 0.325s
FAIL
Signed-off-by: Alexander Egorenkov <eaibmz@gmail.com>
Diffstat (limited to 'sys/targets')
| -rw-r--r-- | sys/targets/targets.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/targets/targets.go b/sys/targets/targets.go index 6cf5d8b9e..d4743c28f 100644 --- a/sys/targets/targets.go +++ b/sys/targets/targets.go @@ -654,7 +654,6 @@ func init() { if runtime.GOOS == OpenBSD { target.BrokenCompiler = "can't build TestOS on OpenBSD due to missing syscall function." } - target.BuildOS = goos } } @@ -708,7 +707,11 @@ func initTarget(target *Target, OS, arch string) { } } if target.BuildOS == "" { - target.BuildOS = OS + if OS == TestOS { + target.BuildOS = runtime.GOOS + } else { + target.BuildOS = OS + } } if runtime.GOOS != target.BuildOS { // Spoil native binaries if they are not usable, so that nobody tries to use them later. |
