mirror of
https://github.com/github/codeql.git
synced 2026-05-04 13:15:21 +02:00
Codegen: use one generated test file per directory
This collapses all generated test QL sources into a single one per directory, using query predicates to run the different tests. This should improve the time required to run generated tests.
This commit is contained in:
@@ -2,12 +2,28 @@
|
||||
import codeql.rust.elements
|
||||
import TestUtils
|
||||
|
||||
from StructExprField x, int getNumberOfAttrs, string hasExpr, string hasIdentifier
|
||||
where
|
||||
query predicate instances(
|
||||
StructExprField x, string getNumberOfAttrs__label, int getNumberOfAttrs, string hasExpr__label,
|
||||
string hasExpr, string hasIdentifier__label, string hasIdentifier
|
||||
) {
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
getNumberOfAttrs__label = "getNumberOfAttrs:" and
|
||||
getNumberOfAttrs = x.getNumberOfAttrs() and
|
||||
hasExpr__label = "hasExpr:" and
|
||||
(if x.hasExpr() then hasExpr = "yes" else hasExpr = "no") and
|
||||
hasIdentifier__label = "hasIdentifier:" and
|
||||
if x.hasIdentifier() then hasIdentifier = "yes" else hasIdentifier = "no"
|
||||
select x, "getNumberOfAttrs:", getNumberOfAttrs, "hasExpr:", hasExpr, "hasIdentifier:",
|
||||
hasIdentifier
|
||||
}
|
||||
|
||||
query predicate getAttr(StructExprField x, int index, Attr getAttr) {
|
||||
toBeTested(x) and not x.isUnknown() and getAttr = x.getAttr(index)
|
||||
}
|
||||
|
||||
query predicate getExpr(StructExprField x, Expr getExpr) {
|
||||
toBeTested(x) and not x.isUnknown() and getExpr = x.getExpr()
|
||||
}
|
||||
|
||||
query predicate getIdentifier(StructExprField x, NameRef getIdentifier) {
|
||||
toBeTested(x) and not x.isUnknown() and getIdentifier = x.getIdentifier()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user