aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/syz-sysgen/check.go26
-rw-r--r--sys/syz-sysgen/sysgen.go7
2 files changed, 32 insertions, 1 deletions
diff --git a/sys/syz-sysgen/check.go b/sys/syz-sysgen/check.go
new file mode 100644
index 000000000..aee850a9a
--- /dev/null
+++ b/sys/syz-sysgen/check.go
@@ -0,0 +1,26 @@
+// Copyright 2023 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 main
+
+import (
+ "fmt"
+
+ "github.com/google/syzkaller/pkg/ast"
+ "github.com/google/syzkaller/pkg/compiler"
+)
+
+// constsAreAllDefined() ensures that for every const there's at least one arch that defines it.
+func constsAreAllDefined(consts *compiler.ConstFile, constInfo map[string]*compiler.ConstInfo,
+ eh ast.ErrorHandler) {
+ // We cannot perform this check inside pkg/compiler because it's
+ // given a const slice for only one architecture.
+ for _, info := range constInfo {
+ for _, def := range info.Consts {
+ if consts.ExistsAny(def.Name) {
+ continue
+ }
+ eh(def.Pos, fmt.Sprintf("%s is defined for none of the arches", def.Name))
+ }
+ }
+}
diff --git a/sys/syz-sysgen/sysgen.go b/sys/syz-sysgen/sysgen.go
index 70b38fee5..2ab6cdbab 100644
--- a/sys/syz-sysgen/sysgen.go
+++ b/sys/syz-sysgen/sysgen.go
@@ -202,7 +202,12 @@ func processJob(job *Job, descriptions *ast.Description, constFile *compiler.Con
// Don't print warnings, they are printed in syz-check.
job.Errors = nil
- job.OK = true
+ // But let's fail on always actionable errors.
+ if job.Target.OS != targets.Fuchsia {
+ // There are too many broken consts on Fuchsia.
+ constsAreAllDefined(constFile, job.ConstInfo, eh)
+ }
+ job.OK = len(job.Errors) == 0
}
func generate(target *targets.Target, prg *compiler.Prog, consts map[string]uint64, out io.Writer) {