diff --git a/ql/src/codeql_ql/ast/Ast.qll b/ql/src/codeql_ql/ast/Ast.qll index cc876063333..f650dd122c2 100644 --- a/ql/src/codeql_ql/ast/Ast.qll +++ b/ql/src/codeql_ql/ast/Ast.qll @@ -2382,8 +2382,6 @@ module YAML { // to not expose the entire `File` API on `QlPack`. private newtype TQLPack = MKQlPack(File file) { file.getBaseName() = "qlpack.yml" } - YAMLEntry test() { not result.isRoot() } - /** * A `qlpack.yml` file. */ diff --git a/ql/test/callgraph/callgraph.expected b/ql/test/callgraph/callgraph.expected index 11bbcc896d1..ec7362a187e 100644 --- a/ql/test/callgraph/callgraph.expected +++ b/ql/test/callgraph/callgraph.expected @@ -1,3 +1,4 @@ +getTarget | Foo.qll:5:26:5:30 | PredicateCall | Foo.qll:3:1:3:26 | ClasslessPredicate foo | | Foo.qll:10:21:10:25 | PredicateCall | Foo.qll:8:3:8:28 | ClassPredicate bar | | Foo.qll:14:30:14:40 | MemberCall | Foo.qll:10:3:10:27 | ClassPredicate baz | @@ -8,3 +9,7 @@ | Foo.qll:31:5:31:12 | PredicateCall | Foo.qll:24:3:24:32 | ClasslessPredicate alias0 | | Foo.qll:36:36:36:65 | MemberCall | file://:0:0:0:0 | replaceAll | | Foo.qll:38:39:38:67 | MemberCall | file://:0:0:0:0 | regexpCapture | +| packs/src/SrcThing.qll:4:3:4:8 | PredicateCall | packs/lib/LibThing/Foo.qll:1:1:1:30 | ClasslessPredicate foo | +| packs/src/SrcThing.qll:5:3:5:8 | PredicateCall | packs/src/SrcThing.qll:8:1:8:30 | ClasslessPredicate bar | +dependsOn +| packs/src/qlpack.yml:1:1:1:4 | ql-testing-src-pack | packs/lib/qlpack.yml:1:1:1:4 | ql-testing-lib-pack | diff --git a/ql/test/callgraph/callgraph.ql b/ql/test/callgraph/callgraph.ql index 4b68e49e361..9ff79048b84 100644 --- a/ql/test/callgraph/callgraph.ql +++ b/ql/test/callgraph/callgraph.ql @@ -1,3 +1,5 @@ import ql query AstNode getTarget(Call call) { result = call.getTarget() } + +query YAML::QLPack dependsOn(YAML::QLPack pack) { result = pack.getADependency() } diff --git a/ql/test/callgraph/packs/lib/LibThing/Foo.qll b/ql/test/callgraph/packs/lib/LibThing/Foo.qll new file mode 100644 index 00000000000..56454a95557 --- /dev/null +++ b/ql/test/callgraph/packs/lib/LibThing/Foo.qll @@ -0,0 +1 @@ +predicate foo(int i) { i = 3 } diff --git a/ql/test/callgraph/packs/lib/qlpack.yml b/ql/test/callgraph/packs/lib/qlpack.yml new file mode 100644 index 00000000000..92e83d1e3d8 --- /dev/null +++ b/ql/test/callgraph/packs/lib/qlpack.yml @@ -0,0 +1,3 @@ +name: ql-testing-lib-pack +version: 0.1.0 +extractor: ql-test-stuff \ No newline at end of file diff --git a/ql/test/callgraph/packs/src/SrcThing.qll b/ql/test/callgraph/packs/src/SrcThing.qll new file mode 100644 index 00000000000..77c812235d9 --- /dev/null +++ b/ql/test/callgraph/packs/src/SrcThing.qll @@ -0,0 +1,8 @@ +import LibThing.Foo + +query predicate test(int i) { + foo(i) and + bar(i) +} + +predicate bar(int i) { i = 4 } diff --git a/ql/test/callgraph/packs/src/qlpack.yml b/ql/test/callgraph/packs/src/qlpack.yml new file mode 100644 index 00000000000..dcf148fe721 --- /dev/null +++ b/ql/test/callgraph/packs/src/qlpack.yml @@ -0,0 +1,4 @@ +name: ql-testing-src-pack +version: 0.1.0 +dependencies: + ql-testing-lib-pack: "*" \ No newline at end of file diff --git a/tools/qltest.cmd b/tools/qltest.cmd index 374810e3804..2573d4f929e 100644 --- a/tools/qltest.cmd +++ b/tools/qltest.cmd @@ -4,6 +4,8 @@ type NUL && "%CODEQL_DIST%\codeql.exe" database index-files ^ --prune=**/*.testproj ^ --include-extension=.ql ^ --include-extension=.qll ^ + --include-extension=.dbscheme ^ + --include-extension=.yml ^ --size-limit=5m ^ --language=ql ^ "%CODEQL_EXTRACTOR_QL_WIP_DATABASE%" diff --git a/tools/qltest.sh b/tools/qltest.sh index 19547bfa5df..3712b2a5a10 100755 --- a/tools/qltest.sh +++ b/tools/qltest.sh @@ -6,6 +6,8 @@ exec "${CODEQL_DIST}/codeql" database index-files \ --prune="**/*.testproj" \ --include-extension=.ql \ --include-extension=.qll \ + --include-extension=.dbscheme \ + --include-extension=.yml \ --size-limit=5m \ --language=ql \ --working-dir=.\