aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/csource_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-11-14 18:36:26 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-11-16 09:58:54 +0100
commitca13dd2ab5a486a0ab0bf5825bae9a087d854412 (patch)
treebb2d71be13da30c9226fa21e85d0a117b9b5fe21 /pkg/csource/csource_test.go
parent2ac1d00f55d2dd477e6a004c2e03f6947e867d6b (diff)
pkg/csoruce: test that executor does not mis-spell any of the SYZ_* macros
Diffstat (limited to 'pkg/csource/csource_test.go')
-rw-r--r--pkg/csource/csource_test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/pkg/csource/csource_test.go b/pkg/csource/csource_test.go
index 64fd1e936..914ecaa71 100644
--- a/pkg/csource/csource_test.go
+++ b/pkg/csource/csource_test.go
@@ -10,6 +10,7 @@ import (
"os"
"os/exec"
"path/filepath"
+ "regexp"
"runtime"
"strings"
"testing"
@@ -160,3 +161,23 @@ func TestSysTests(t *testing.T) {
})
}
}
+
+func TestExecutorMacros(t *testing.T) {
+ // Ensure that executor does not mis-spell any of the SYZ_* macros.
+ target, _ := prog.GetTarget("test", "64")
+ p := target.Generate(rand.NewSource(0), 1, nil)
+ expected := commonDefines(p, Options{})
+ expected["SYZ_EXECUTOR"] = true
+ expected["SYZ_HAVE_SETUP_LOOP"] = true
+ expected["SYZ_HAVE_RESET_LOOP"] = true
+ expected["SYZ_HAVE_SETUP_TEST"] = true
+ macros := regexp.MustCompile("SYZ_[A-Za-z0-9_]+").FindAllString(commonHeader, -1)
+ for _, macro := range macros {
+ if strings.HasPrefix(macro, "SYZ_HAVE_") {
+ continue
+ }
+ if _, ok := expected[macro]; !ok {
+ t.Errorf("unexpected macro: %v", macro)
+ }
+ }
+}