github.com/google/syzkaller@v0.0.0-20251211124644-a066d2bc4b02/tools/syz-declextract/testdata/README.md (about) 1 This dir contains sources of a fake kernel that resembles Linux for testing of the `syz-declextract` tool. 2 3 For each `*.c` file there 3 golden files: 4 - `*.c.json` with the expected output of the clang tool 5 - `*.c.txt` with the expected syzlang descriptions 6 - `*.c.info` with the expected kernel interface list 7 8 Testing is done by `tools/syz-declextract` tests. 9 10 `TestClangTool` invokes the clang tool and verifies `*.c.json` contents. 11 The test requires the clang tool binary specified in the `-bin`, otherwise it skips testing. 12 You also want to run it with `-count=1` flag since the Go tool does not detect changes in the tool binary, 13 and will cache and reuse test results: 14 ``` 15 go test -count=1 ./tools/syz-declextract -bin=llvm/build/bin/syz-declextract 16 ``` 17 18 `TestDeclextract` verifies `*.c.txt` and `*.c.info` using `*.c.json` files as inputs 19 (it does not involve the clang tool and runs always). 20 21 All tests also support `-update` flag, which updates the golden files. 22 Generally you don't need to update them manually. 23 24 Since the test covers multiple packages, it's useful to run coverage as follows: 25 ``` 26 go test -count=1 -coverprofile=/tmp/cover -coverpkg="github.com/google/syzkaller/tools/syz-declextract,github.com/google/syzkaller/pkg/declextract,github.com/google/syzkaller/pkg/clangtool" ./tools/syz-declextract -bin=llvm/build/bin/syz-declextract 27 go tool cover -html /tmp/cover 28 ```