aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-06-03 16:03:49 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-06-04 09:50:32 +0000
commit131643847bb0eb1748a4a9c8c38be76c2c28469c (patch)
tree60a918c23595e026b3c2fdcfc77b04587f972eca /sys
parentda9e8155a4c58450c7d29339f10cea3dd75f15ae (diff)
sys/syz-sysgen: remove all files in the case set of arches has changed
If arched are renamed, old files will stay around and break builds. Remove all existing generated files for writing new ones.
Diffstat (limited to 'sys')
-rw-r--r--sys/syz-sysgen/sysgen.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/syz-sysgen/sysgen.go b/sys/syz-sysgen/sysgen.go
index b1ed731bb..f170ad410 100644
--- a/sys/syz-sysgen/sysgen.go
+++ b/sys/syz-sysgen/sysgen.go
@@ -91,6 +91,18 @@ func main() {
}
osutil.MkdirAll(filepath.Join(*outDir, "sys", OS, "gen"))
+ // Cleanup old files in the case set of architectures has chnaged.
+ allFiles, err := filepath.Glob(filepath.Join(*outDir, "sys", OS, "gen", "*.go"))
+ if err != nil {
+ tool.Failf("failed to glob: %v", err)
+ }
+ for _, file := range allFiles {
+ if strings.HasSuffix(file, "empty.go") {
+ continue
+ }
+ os.Remove(file)
+ }
+
var archs []string
for arch := range targets.List[OS] {
archs = append(archs, arch)