diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2022-09-07 16:37:17 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2022-11-01 10:23:09 -0700 |
| commit | 75eae5a7ef67781b73f2b9038416542c7ea0612c (patch) | |
| tree | 6f4face7bb7d0343f741e759af4004129e198b92 /executor/common_ext_test.go | |
| parent | edac4fd1041732ed5d430221343f99db42a99319 (diff) | |
executor: test extension points
Test that extension points keep stable interface and work.
Diffstat (limited to 'executor/common_ext_test.go')
| -rw-r--r-- | executor/common_ext_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/executor/common_ext_test.go b/executor/common_ext_test.go new file mode 100644 index 000000000..45ba3a3cf --- /dev/null +++ b/executor/common_ext_test.go @@ -0,0 +1,34 @@ +// Copyright 2022 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +package executor + +import ( + "bytes" + "os" + "testing" + "time" + + "github.com/google/syzkaller/pkg/csource" + "github.com/google/syzkaller/pkg/osutil" + "github.com/google/syzkaller/prog" +) + +func TestCommonExt(t *testing.T) { + target, err := prog.GetTarget("test", "64_fork") + if err != nil { + t.Fatal(err) + } + bin, err := csource.BuildFile(target, "executor.cc", "-DSYZ_TEST_COMMON_EXT_EXAMPLE=1") + if err != nil { + t.Fatal(err) + } + defer os.Remove(bin) + out, err := osutil.RunCmd(time.Minute, "", bin, "setup") + if err != nil { + t.Fatal(err) + } + if !bytes.Contains(out, []byte("example setup_ext called")) { + t.Fatalf("setup_ext wasn't called:\n%s", out) + } +} |
