mirror of
https://github.com/github/codeql.git
synced 2026-02-08 11:11:06 +01:00
Merge pull request #116 from github/erik-krogh/qlpack-test
add test for qlpacks
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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 |
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import ql
|
||||
|
||||
query AstNode getTarget(Call call) { result = call.getTarget() }
|
||||
|
||||
query YAML::QLPack dependsOn(YAML::QLPack pack) { result = pack.getADependency() }
|
||||
|
||||
1
ql/test/callgraph/packs/lib/LibThing/Foo.qll
Normal file
1
ql/test/callgraph/packs/lib/LibThing/Foo.qll
Normal file
@@ -0,0 +1 @@
|
||||
predicate foo(int i) { i = 3 }
|
||||
3
ql/test/callgraph/packs/lib/qlpack.yml
Normal file
3
ql/test/callgraph/packs/lib/qlpack.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
name: ql-testing-lib-pack
|
||||
version: 0.1.0
|
||||
extractor: ql-test-stuff
|
||||
8
ql/test/callgraph/packs/src/SrcThing.qll
Normal file
8
ql/test/callgraph/packs/src/SrcThing.qll
Normal file
@@ -0,0 +1,8 @@
|
||||
import LibThing.Foo
|
||||
|
||||
query predicate test(int i) {
|
||||
foo(i) and
|
||||
bar(i)
|
||||
}
|
||||
|
||||
predicate bar(int i) { i = 4 }
|
||||
4
ql/test/callgraph/packs/src/qlpack.yml
Normal file
4
ql/test/callgraph/packs/src/qlpack.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
name: ql-testing-src-pack
|
||||
version: 0.1.0
|
||||
dependencies:
|
||||
ql-testing-lib-pack: "*"
|
||||
@@ -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%"
|
||||
|
||||
@@ -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=.\
|
||||
|
||||
Reference in New Issue
Block a user