Tracing test code
- Vorherrschende Sprache
- CodeQL
- Sterne
- 10.1k
- Forks
- 2.1k
- Ø Merge
- 2 T. 15 Std.
- Gemergte PRs (30 T.)
- 141
Beschreibung
For some use-cases (probably not security), it would be useful to instrument test code. This involves some correctness properties, and in my case a custom query to check proper use of the GORM database interface (checking the `Error` code after a SQL query).
I tried commands such as:
codeql database create ../ -l go -c "go test ./foo -c -count 1"
However, the tracer log indicates that we do not consider `go test` suitable for tracing.
Renaming all the `_test.go` files and then building them normally runs into problems with the implicit package structure around tests, e.g:
find . -name '*_test.go' | perl -p -e 's#(.*)_test.go#\1#' | xargs -I {} mv {}_test.go {}_tmp.go
rg 'package .*_test' -l | xargs perl -p -i -e 's#package (.*)_test#package \1#'
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.