From 75eae5a7ef67781b73f2b9038416542c7ea0612c Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 7 Sep 2022 16:37:17 +0200 Subject: executor: test extension points Test that extension points keep stable interface and work. --- executor/common_ext_test.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 executor/common_ext_test.go (limited to 'executor/common_ext_test.go') 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) + } +} -- cgit mrf-deployment