mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-23 03:19:51 +00:00
Makefile: enforce formatting of sys files in presubmit
This commit is contained in:
parent
5b461e7ecd
commit
41bbf437e1
6
Makefile
6
Makefile
@ -10,6 +10,7 @@ endif
|
||||
manager fuzzer executor \
|
||||
ci hub \
|
||||
execprog mutate prog2c stress repro upgrade db \
|
||||
bin/syz-sysgen bin/syz-extract bin/syz-fmt \
|
||||
extract generate \
|
||||
android \
|
||||
format tidy test arch presubmit clean
|
||||
@ -81,9 +82,12 @@ generate: bin/syz-sysgen
|
||||
bin/syz-sysgen:
|
||||
go build $(GOFLAGS) -o $@ ./sys/syz-sysgen
|
||||
|
||||
format:
|
||||
format: bin/syz-fmt
|
||||
go fmt ./...
|
||||
clang-format --style=file -i executor/*.cc executor/*.h tools/kcovtrace/*.c
|
||||
bin/syz-fmt sys
|
||||
bin/syz-fmt:
|
||||
go build $(GOFLAGS) -o $@ ./tools/syz-fmt
|
||||
|
||||
tidy:
|
||||
# A single check is enabled for now. But it's always fixable and proved to be useful.
|
||||
|
@ -42,12 +42,10 @@ func TestParseAll(t *testing.T) {
|
||||
if len(top) != len(top2) {
|
||||
t.Fatalf("formatting number of top level decls: %v/%v", len(top), len(top2))
|
||||
}
|
||||
if false {
|
||||
// While sys files are not formatted, formatting in fact changes it.
|
||||
for i := range top {
|
||||
if !reflect.DeepEqual(top[i], top2[i]) {
|
||||
t.Fatalf("formatting changed code:\n%#v\nvs:\n%#v", top[i], top2[i])
|
||||
}
|
||||
// While sys files are not formatted, formatting in fact changes it.
|
||||
for i := range top {
|
||||
if !reflect.DeepEqual(top[i], top2[i]) {
|
||||
t.Fatalf("formatting changed code:\n%#v\nvs:\n%#v", top[i], top2[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ func processFile(file string, mode os.FileMode) {
|
||||
if bytes.Equal(data, formatted) {
|
||||
return
|
||||
}
|
||||
fmt.Printf("reformatting %v\n", file)
|
||||
if err := os.Rename(file, file+"~"); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user