From d1a88510856c352db84d1b8ffa252c0a9ce30dec Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sat, 17 Nov 2018 11:20:17 -0800 Subject: sys/targest: introduce target.BuildOS We can't cross-compile native binaries from just any OS to any other. For most OSes we can do only native compilation. Some can only be compiled from linux. To date we avoided this problem completely (mostly assumed linux build OS). Make this notion of what can build what explicit. --- pkg/csource/csource_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pkg/csource') diff --git a/pkg/csource/csource_test.go b/pkg/csource/csource_test.go index 8545efba8..9743b6356 100644 --- a/pkg/csource/csource_test.go +++ b/pkg/csource/csource_test.go @@ -14,6 +14,7 @@ import ( "github.com/google/syzkaller/prog" _ "github.com/google/syzkaller/sys" + "github.com/google/syzkaller/sys/targets" ) func TestGenerate(t *testing.T) { @@ -23,11 +24,10 @@ func TestGenerate(t *testing.T) { } t.Parallel() for _, target := range prog.AllTargets() { - switch target.OS { - case "netbsd", "windows": + target := target + if runtime.GOOS != targets.Get(target.OS, target.Arch).BuildOS { continue } - target := target t.Run(target.OS+"/"+target.Arch, func(t *testing.T) { if target.OS == "linux" && target.Arch == "arm" { // This currently fails (at least with my arm-linux-gnueabihf-gcc-4.8) with: -- cgit mrf-deployment