aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-08-22 17:18:02 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-08-22 21:26:42 +0200
commit7288521c2ab2ce481a739e2f9d5dc0ec4642fc66 (patch)
tree3c2d1574f64cdba901e734b447f338d748d1b4c1 /pkg
parent0dba77942f44965df41ae0cec26668cdb176b1a5 (diff)
pkg/ipc: run cross-arch executor tests
We may run some cross-arch tests using qemu-user.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/ipc/ipc_test.go33
1 files changed, 23 insertions, 10 deletions
diff --git a/pkg/ipc/ipc_test.go b/pkg/ipc/ipc_test.go
index 3460657bc..f0e19ed33 100644
--- a/pkg/ipc/ipc_test.go
+++ b/pkg/ipc/ipc_test.go
@@ -18,6 +18,7 @@ import (
"github.com/google/syzkaller/pkg/osutil"
"github.com/google/syzkaller/prog"
_ "github.com/google/syzkaller/sys"
+ "github.com/google/syzkaller/sys/targets"
)
const timeout = 10 * time.Second
@@ -57,17 +58,29 @@ func initTest(t *testing.T) (*prog.Target, rand.Source, int, bool, bool) {
// TestExecutor runs all internal executor unit tests.
// We do it here because we already build executor binary here.
func TestExecutor(t *testing.T) {
- target, err := prog.GetTarget(runtime.GOOS, runtime.GOARCH)
- if err != nil {
- t.Fatal(err)
- }
- bin := buildExecutor(t, target)
- defer os.Remove(bin)
- output, err := osutil.RunCmd(time.Minute, "", bin, "test")
- if err != nil {
- t.Fatal(err)
+ t.Parallel()
+ for _, sysTarget := range targets.List[runtime.GOOS] {
+ sysTarget := sysTarget
+ t.Run(sysTarget.Arch, func(t *testing.T) {
+ if sysTarget.BrokenCompiler != "" {
+ t.Skipf("skipping, broken cross-compiler: %v", sysTarget.BrokenCompiler)
+ }
+ t.Parallel()
+ target, err := prog.GetTarget(runtime.GOOS, sysTarget.Arch)
+ if err != nil {
+ t.Fatal(err)
+ }
+ bin := buildExecutor(t, target)
+ defer os.Remove(bin)
+ // qemu-user may allow us to run some cross-arch binaries.
+ if _, err := osutil.RunCmd(time.Minute, "", bin, "test"); err != nil {
+ if sysTarget.Arch == runtime.GOOS || sysTarget.VMArch == runtime.GOOS {
+ t.Fatal(err)
+ }
+ t.Skipf("skipping, cross-arch binary failed: %v", err)
+ }
+ })
}
- t.Logf("executor output:\n%s", output)
}
func TestExecute(t *testing.T) {