Skip to content

Commit 1bd7aef

Browse files
committed
Fix search paths.
It turns out we still need to supply this option, so `codeql` goes looking for the extractor paths specified in the `codeql-workspace.yml` file.
1 parent c30cc0f commit 1bd7aef

File tree

11 files changed

+19
-15
lines changed

11 files changed

+19
-15
lines changed

.github/workflows/csharp-qltest.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
key: csharp-qltest-${{ matrix.slice }}
6666
- name: Run QL tests
6767
run: |
68-
codeql test run --threads=0 --ram 50000 --slice ${{ matrix.slice }} --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
68+
codeql test run --threads=0 --ram 50000 --slice ${{ matrix.slice }} --search-path "${{ github.workspace }}" --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
6969
env:
7070
GITHUB_TOKEN: ${{ github.token }}
7171
unit-tests:
@@ -101,6 +101,6 @@ jobs:
101101
# Update existing stubs in the repo with the freshly generated ones
102102
mv "$STUBS_PATH/output/stubs/_frameworks" ql/test/resources/stubs/
103103
git status
104-
codeql test run --threads=0 --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries -- ql/test/library-tests/dataflow/flowsources/aspremote
104+
codeql test run --threads=0 --search-path "${{ github.workspace }}" --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries -- ql/test/library-tests/dataflow/flowsources/aspremote
105105
env:
106106
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/ql-for-ql-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- name: Make database and analyze
6161
run: |
6262
./ql/target/release/buramu | tee deprecated.blame # Add a blame file for the extractor to parse.
63-
${CODEQL} database create -l=ql ${DB}
63+
${CODEQL} database create -l=ql ${DB} --search-path "${{ github.workspace }}"
6464
${CODEQL} database analyze -j0 --format=sarif-latest --output=ql-for-ql.sarif ${DB} ql/ql/src/codeql-suites/ql-code-scanning.qls --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
6565
env:
6666
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}

.github/workflows/ql-for-ql-dataset_measure.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ jobs:
5353
- name: Create database
5454
run: |
5555
"${CODEQL}" database create \
56-
--threads 4 \
56+
--search-path "${{ github.workspace }}"
57+
--threads 4 \
5758
--language ql --source-root "${{ github.workspace }}/repo" \
5859
"${{ runner.temp }}/database"
5960
env:

.github/workflows/ql-for-ql-tests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
key: ql-for-ql-tests
5454
- name: Run QL tests
5555
run: |
56-
"${CODEQL}" test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/ql/consistency-queries --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" ql/ql/test
56+
"${CODEQL}" test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}" --consistency-queries ql/ql/consistency-queries --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" ql/ql/test
5757
env:
5858
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
5959

@@ -100,12 +100,12 @@ jobs:
100100
- name: Run a single QL tests - Unix
101101
if: runner.os != 'Windows'
102102
run: |
103-
"${CODEQL}" test run --check-databases ql/ql/test/queries/style/DeadCode/DeadCode.qlref
103+
"${CODEQL}" test run --check-databases --search-path "${{ github.workspace }}" ql/ql/test/queries/style/DeadCode/DeadCode.qlref
104104
env:
105105
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
106106
- name: Run a single QL tests - Windows
107107
if: runner.os == 'Windows'
108108
shell: pwsh
109109
run: |
110110
$Env:PATH += ";$(dirname ${{ steps.find-codeql.outputs.codeql-path }})"
111-
codeql test run --check-databases ql/ql/test/queries/style/DeadCode/DeadCode.qlref
111+
codeql test run --check-databases --search-path "${{ github.workspace }}" ql/ql/test/queries/style/DeadCode/DeadCode.qlref

.github/workflows/ruby-dataset-measure.yml

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
- name: Create database
4545
run: |
4646
codeql database create \
47+
--search-path "${{ github.workspace }}" \
4748
--threads 4 \
4849
--language ruby --source-root "${{ github.workspace }}/repo" \
4950
"${{ runner.temp }}/database"

.github/workflows/ruby-qltest.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ jobs:
6868
key: ruby-qltest
6969
- name: Run QL tests
7070
run: |
71-
codeql test run --threads=0 --ram 50000 --check-databases --check-undefined-labels --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
71+
codeql test run --threads=0 --ram 50000 --search-path "${{ github.workspace }}" --check-databases --check-undefined-labels --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
7272
env:
7373
GITHUB_TOKEN: ${{ github.token }}

go/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ ql/lib/go.dbscheme.stats: ql/lib/go.dbscheme build/stats/src.stamp extractor
4545
codeql dataset measure -o $@ build/stats/database/db-go
4646

4747
test: all build/testdb/check-upgrade-path
48-
codeql test run -j0 ql/test --consistency-queries ql/test/consistency --compilation-cache=$(cache)
48+
codeql test run -j0 ql/test --search-path .. --consistency-queries ql/test/consistency --compilation-cache=$(cache)
4949
# use GOOS=linux because GOOS=darwin GOARCH=386 is no longer supported
50-
env GOOS=linux GOARCH=386 codeql$(EXE) test run -j0 ql/test/query-tests/Security/CWE-681 --consistency-queries ql/test/consistency --compilation-cache=$(cache)
50+
env GOOS=linux GOARCH=386 codeql$(EXE) test run -j0 ql/test/query-tests/Security/CWE-681 --search-path .. --consistency-queries ql/test/consistency --compilation-cache=$(cache)
5151
cd extractor; bazel test ...
5252
bash extractor-smoke-test/test.sh || (echo "Extractor smoke test FAILED"; exit 1)
5353

go/extractor-smoke-test/test.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cd $DIR
77

88
rm -rf testdb
99

10-
codeql database create --language=go testdb
10+
codeql database create --language=go testdb --search-path ../..
1111
codeql dataset check testdb/db-go
1212
codeql query run ../ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.ql --database=testdb --output=notracing-out.bqrs --search-path ..
1313
codeql bqrs decode notracing-out.bqrs --format=csv --output=notracing-out.csv
@@ -19,7 +19,7 @@ export CODEQL_EXTRACTOR_GO_BUILD_TRACING=on
1919

2020
rm -rf testdb
2121

22-
codeql database create --language=go testdb
22+
codeql database create --language=go testdb --search-path ../..
2323
codeql dataset check testdb/db-go
2424
codeql query run ../ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.ql --database=testdb --output=tracing-out.bqrs --search-path ..
2525
codeql bqrs decode tracing-out.bqrs --format=csv --output=tracing-out.csv

ruby/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ extractor: $(FILES) $(BIN_FILES)
6565
cp extractor/target/release/codeql-extractor-ruby$(EXE) extractor-pack/tools/$(CODEQL_PLATFORM)/extractor$(EXE)
6666

6767
test: extractor dbscheme
68-
codeql test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test
68+
codeql test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path .. --consistency-queries ql/consistency-queries ql/test

ruby/doc/HOWTO.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ First, get an extractor pack. There are two options:
3131
Then run
3232

3333
```bash
34-
codeql database create <database-path> -l ruby -s <project-source-path>
34+
codeql database create <database-path> -l ruby -s <project-source-path> --search-path <extractor-pack-path>
3535
```
3636

3737
## Running qltests
3838

3939
Run
4040

4141
```bash
42-
codeql test run <test-path>
42+
codeql test run <test-path> --search-path <extractor-pack-path>
4343
```
4444

4545
## Writing database upgrade scripts

swift/actions/run-ql-tests/action.yml

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ runs:
2020
codeql test run \
2121
--threads=0 \
2222
--ram 50000 \
23+
--search-path "$GITHUB_WORKSPACE" \
2324
--check-databases \
2425
--check-unused-labels \
2526
--check-repeated-labels \
@@ -31,3 +32,4 @@ runs:
3132
swift/ql/test
3233
env:
3334
GITHUB_TOKEN: ${{ github.token }}
35+
GITHUB_WORKSPACE: ${{ github.workspace }}

0 commit comments

Comments
 (0)