mirror of
https://github.com/github/codeql.git
synced 2026-05-14 11:19:27 +02:00
These use the annotated, self-verifying test files to check various consistency requirements. Some of these may be expressing the same thing in different ways, but it's fairly cheap to keep them around, so I have not attempted to produce a minimal set of queries for this.
19 lines
685 B
Plaintext
19 lines
685 B
Plaintext
/**
|
|
* Checks that timestamps form a contiguous sequence {0, 1, ..., max}
|
|
* within each test function. Every integer in the range must appear
|
|
* in at least one annotation (live or dead).
|
|
*/
|
|
|
|
import python
|
|
import TimerUtils
|
|
|
|
from TestFunction f, int missing, int maxTs, TimerAnnotation maxAnn
|
|
where
|
|
maxTs = max(TimerAnnotation a | a.getTestFunction() = f | a.getATimestamp()) and
|
|
maxAnn.getTestFunction() = f and
|
|
maxAnn.getATimestamp() = maxTs and
|
|
missing = [0 .. maxTs] and
|
|
not exists(TimerAnnotation a | a.getTestFunction() = f and a.getATimestamp() = missing)
|
|
select f, "Missing timestamp " + missing + " (max is $@)", maxAnn.getTimestampExpr(maxTs),
|
|
maxTs.toString()
|