mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +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:
@@ -1 +1,6 @@
|
||||
instances
|
||||
| gen_array_repeat_expr.rs:5:5:5:11 | [1; 10] | getNumberOfExprs: | 2 | getNumberOfAttrs: | 0 | getRepeatOperand: | gen_array_repeat_expr.rs:5:6:5:6 | 1 | getRepeatLength: | gen_array_repeat_expr.rs:5:9:5:10 | 10 |
|
||||
getExpr
|
||||
| gen_array_repeat_expr.rs:5:5:5:11 | [1; 10] | 0 | gen_array_repeat_expr.rs:5:6:5:6 | 1 |
|
||||
| gen_array_repeat_expr.rs:5:5:5:11 | [1; 10] | 1 | gen_array_repeat_expr.rs:5:9:5:10 | 10 |
|
||||
getAttr
|
||||
|
||||
@@ -2,15 +2,27 @@
|
||||
import codeql.rust.elements
|
||||
import TestUtils
|
||||
|
||||
from
|
||||
ArrayRepeatExpr x, int getNumberOfExprs, int getNumberOfAttrs, Expr getRepeatOperand,
|
||||
Expr getRepeatLength
|
||||
where
|
||||
query predicate instances(
|
||||
ArrayRepeatExpr x, string getNumberOfExprs__label, int getNumberOfExprs,
|
||||
string getNumberOfAttrs__label, int getNumberOfAttrs, string getRepeatOperand__label,
|
||||
Expr getRepeatOperand, string getRepeatLength__label, Expr getRepeatLength
|
||||
) {
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
getNumberOfExprs__label = "getNumberOfExprs:" and
|
||||
getNumberOfExprs = x.getNumberOfExprs() and
|
||||
getNumberOfAttrs__label = "getNumberOfAttrs:" and
|
||||
getNumberOfAttrs = x.getNumberOfAttrs() and
|
||||
getRepeatOperand__label = "getRepeatOperand:" and
|
||||
getRepeatOperand = x.getRepeatOperand() and
|
||||
getRepeatLength__label = "getRepeatLength:" and
|
||||
getRepeatLength = x.getRepeatLength()
|
||||
select x, "getNumberOfExprs:", getNumberOfExprs, "getNumberOfAttrs:", getNumberOfAttrs,
|
||||
"getRepeatOperand:", getRepeatOperand, "getRepeatLength:", getRepeatLength
|
||||
}
|
||||
|
||||
query predicate getExpr(ArrayRepeatExpr x, int index, Expr getExpr) {
|
||||
toBeTested(x) and not x.isUnknown() and getExpr = x.getExpr(index)
|
||||
}
|
||||
|
||||
query predicate getAttr(ArrayRepeatExpr x, int index, Attr getAttr) {
|
||||
toBeTested(x) and not x.isUnknown() and getAttr = x.getAttr(index)
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
// generated by codegen, do not edit
|
||||
import codeql.rust.elements
|
||||
import TestUtils
|
||||
|
||||
from ArrayRepeatExpr x, int index
|
||||
where toBeTested(x) and not x.isUnknown()
|
||||
select x, index, x.getAttr(index)
|
||||
@@ -1,2 +0,0 @@
|
||||
| gen_array_repeat_expr.rs:5:5:5:11 | [1; 10] | 0 | gen_array_repeat_expr.rs:5:6:5:6 | 1 |
|
||||
| gen_array_repeat_expr.rs:5:5:5:11 | [1; 10] | 1 | gen_array_repeat_expr.rs:5:9:5:10 | 10 |
|
||||
@@ -1,7 +0,0 @@
|
||||
// generated by codegen, do not edit
|
||||
import codeql.rust.elements
|
||||
import TestUtils
|
||||
|
||||
from ArrayRepeatExpr x, int index
|
||||
where toBeTested(x) and not x.isUnknown()
|
||||
select x, index, x.getExpr(index)
|
||||
7
rust/ql/test/extractor-tests/generated/ArrayRepeatExpr/Cargo.lock
generated
Normal file
7
rust/ql/test/extractor-tests/generated/ArrayRepeatExpr/Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "test"
|
||||
version = "0.0.1"
|
||||
Reference in New Issue
Block a user