mirror of
https://github.com/github/codeql.git
synced 2026-05-14 19:29:28 +02:00
These tests consist of various Python constructions (hopefully a somewhat comprehensive set) with specific timestamp annotations scattered throughout. When the tests are run using the Python 3 interpreter, these annotations are checked and compared to the "current timestamp" to see that they are in agreement. This is what makes the tests "self-validating". There are a few different kinds of annotations: the basic `t[4]` style (meaning this is executed at timestamp 4), the `t.dead[4]` variant (meaning this _would_ happen at timestamp 4, but it is in a dead branch), and `t.never` (meaning this is never executed at all). In addition to this, there is a query, MissingAnnotations, which checks whether we have applied these annotations maximally. Many expression nodes are not actually annotatable, so there is a sizeable list of excluded nodes for that query.
16 lines
431 B
Plaintext
16 lines
431 B
Plaintext
/**
|
|
* Finds expressions in test functions that lack a timer annotation
|
|
* and are not part of the timer mechanism or otherwise excluded.
|
|
* An empty result means every annotatable expression is covered.
|
|
*/
|
|
|
|
import python
|
|
import TimerUtils
|
|
|
|
from TestFunction f, Expr e
|
|
where
|
|
e.getScope().getEnclosingScope*() = f and
|
|
not isTimerMechanism(e, f) and
|
|
not isUnannotatable(e)
|
|
select e, "Missing annotation in $@", f, f.getName()
|