Skip to content

Commit 0954584

Browse files
committed
QL: add test for qlpacks, and get them to work
1 parent 6fe7579 commit 0954584

File tree

7 files changed

+25
-0
lines changed

7 files changed

+25
-0
lines changed

ql/test/callgraph/callgraph.expected

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
getTarget
12
| Foo.qll:5:26:5:30 | PredicateCall | Foo.qll:3:1:3:26 | ClasslessPredicate foo |
23
| Foo.qll:10:21:10:25 | PredicateCall | Foo.qll:8:3:8:28 | ClassPredicate bar |
34
| Foo.qll:14:30:14:40 | MemberCall | Foo.qll:10:3:10:27 | ClassPredicate baz |
@@ -8,3 +9,7 @@
89
| Foo.qll:31:5:31:12 | PredicateCall | Foo.qll:24:3:24:32 | ClasslessPredicate alias0 |
910
| Foo.qll:36:36:36:65 | MemberCall | file://:0:0:0:0 | replaceAll |
1011
| Foo.qll:38:39:38:67 | MemberCall | file://:0:0:0:0 | regexpCapture |
12+
| packs/src/SrcThing.qll:4:3:4:8 | PredicateCall | packs/lib/LibThing/Foo.qll:1:1:1:30 | ClasslessPredicate foo |
13+
| packs/src/SrcThing.qll:5:3:5:8 | PredicateCall | packs/src/SrcThing.qll:8:1:8:30 | ClasslessPredicate bar |
14+
dependsOn
15+
| packs/src/qlpack.yml:1:1:1:4 | ql-testing-src-pack | packs/lib/qlpack.yml:1:1:1:4 | ql-testing-lib-pack |

ql/test/callgraph/callgraph.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
import ql
22

33
query AstNode getTarget(Call call) { result = call.getTarget() }
4+
5+
query YAML::QLPack dependsOn(YAML::QLPack pack) { result = pack.getADependency() }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
predicate foo(int i) { i = 3 }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: ql-testing-lib-pack
2+
version: 0.1.0
3+
extractor: ql-test-stuff
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import LibThing.Foo
2+
3+
query predicate test(int i) {
4+
foo(i) and
5+
bar(i)
6+
}
7+
8+
predicate bar(int i) { i = 4 }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: ql-testing-src-pack
2+
version: 0.1.0
3+
dependencies:
4+
ql-testing-lib-pack: "*"

tools/qltest.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ exec "${CODEQL_DIST}/codeql" database index-files \
66
--prune="**/*.testproj" \
77
--include-extension=.ql \
88
--include-extension=.qll \
9+
--include-extension=.dbscheme \
10+
--include-extension=.yml \
911
--size-limit=5m \
1012
--language=ql \
1113
--working-dir=.\

0 commit comments

Comments
 (0)