diff --git a/.github/workflows/csharp-qltest.yml b/.github/workflows/csharp-qltest.yml index 0eb9f243343..66326539e6e 100644 --- a/.github/workflows/csharp-qltest.yml +++ b/.github/workflows/csharp-qltest.yml @@ -65,7 +65,7 @@ jobs: key: csharp-qltest-${{ matrix.slice }} - name: Run QL tests run: | - 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 }}" + 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 }}" env: GITHUB_TOKEN: ${{ github.token }} unit-tests: @@ -101,6 +101,6 @@ jobs: # Update existing stubs in the repo with the freshly generated ones mv "$STUBS_PATH/output/stubs/_frameworks" ql/test/resources/stubs/ git status - 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 + 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 env: GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/ql-for-ql-build.yml b/.github/workflows/ql-for-ql-build.yml index 055560dc9fc..2082629d9c8 100644 --- a/.github/workflows/ql-for-ql-build.yml +++ b/.github/workflows/ql-for-ql-build.yml @@ -60,7 +60,7 @@ jobs: - name: Make database and analyze run: | ./ql/target/release/buramu | tee deprecated.blame # Add a blame file for the extractor to parse. - ${CODEQL} database create -l=ql ${DB} + ${CODEQL} database create -l=ql ${DB} --search-path "${{ github.workspace }}" ${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 }}" env: CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} diff --git a/.github/workflows/ql-for-ql-dataset_measure.yml b/.github/workflows/ql-for-ql-dataset_measure.yml index 6c821572e77..e53cce8ff8e 100644 --- a/.github/workflows/ql-for-ql-dataset_measure.yml +++ b/.github/workflows/ql-for-ql-dataset_measure.yml @@ -53,7 +53,8 @@ jobs: - name: Create database run: | "${CODEQL}" database create \ - --threads 4 \ + --search-path "${{ github.workspace }}" + --threads 4 \ --language ql --source-root "${{ github.workspace }}/repo" \ "${{ runner.temp }}/database" env: diff --git a/.github/workflows/ql-for-ql-tests.yml b/.github/workflows/ql-for-ql-tests.yml index 2412416502b..bc247165198 100644 --- a/.github/workflows/ql-for-ql-tests.yml +++ b/.github/workflows/ql-for-ql-tests.yml @@ -53,7 +53,7 @@ jobs: key: ql-for-ql-tests - name: Run QL tests run: | - "${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 + "${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 env: CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} @@ -100,7 +100,7 @@ jobs: - name: Run a single QL tests - Unix if: runner.os != 'Windows' run: | - "${CODEQL}" test run --check-databases ql/ql/test/queries/style/DeadCode/DeadCode.qlref + "${CODEQL}" test run --check-databases --search-path "${{ github.workspace }}" ql/ql/test/queries/style/DeadCode/DeadCode.qlref env: CODEQL: ${{ steps.find-codeql.outputs.codeql-path }} - name: Run a single QL tests - Windows @@ -108,4 +108,4 @@ jobs: shell: pwsh run: | $Env:PATH += ";$(dirname ${{ steps.find-codeql.outputs.codeql-path }})" - codeql test run --check-databases ql/ql/test/queries/style/DeadCode/DeadCode.qlref + codeql test run --check-databases --search-path "${{ github.workspace }}" ql/ql/test/queries/style/DeadCode/DeadCode.qlref diff --git a/.github/workflows/ruby-dataset-measure.yml b/.github/workflows/ruby-dataset-measure.yml index dd42ec645b1..d6e3c9216fc 100644 --- a/.github/workflows/ruby-dataset-measure.yml +++ b/.github/workflows/ruby-dataset-measure.yml @@ -44,6 +44,7 @@ jobs: - name: Create database run: | codeql database create \ + --search-path "${{ github.workspace }}" \ --threads 4 \ --language ruby --source-root "${{ github.workspace }}/repo" \ "${{ runner.temp }}/database" diff --git a/.github/workflows/ruby-qltest.yml b/.github/workflows/ruby-qltest.yml index 2ab6616fc74..224e1c129b4 100644 --- a/.github/workflows/ruby-qltest.yml +++ b/.github/workflows/ruby-qltest.yml @@ -68,6 +68,6 @@ jobs: key: ruby-qltest - name: Run QL tests run: | - 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 }}" + 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 }}" env: GITHUB_TOKEN: ${{ github.token }} diff --git a/go/Makefile b/go/Makefile index 60d4fa2a63a..bc4bc25e5da 100644 --- a/go/Makefile +++ b/go/Makefile @@ -45,9 +45,9 @@ ql/lib/go.dbscheme.stats: ql/lib/go.dbscheme build/stats/src.stamp extractor codeql dataset measure -o $@ build/stats/database/db-go test: all build/testdb/check-upgrade-path - codeql test run -j0 ql/test --consistency-queries ql/test/consistency --compilation-cache=$(cache) + codeql test run -j0 ql/test --search-path .. --consistency-queries ql/test/consistency --compilation-cache=$(cache) # use GOOS=linux because GOOS=darwin GOARCH=386 is no longer supported - 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) + 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) cd extractor; bazel test ... bash extractor-smoke-test/test.sh || (echo "Extractor smoke test FAILED"; exit 1) diff --git a/go/extractor-smoke-test/test.sh b/go/extractor-smoke-test/test.sh index 2e7d5b927b0..bd22da4d906 100755 --- a/go/extractor-smoke-test/test.sh +++ b/go/extractor-smoke-test/test.sh @@ -7,7 +7,7 @@ cd $DIR rm -rf testdb -codeql database create --language=go testdb +codeql database create --language=go testdb --search-path ../.. codeql dataset check testdb/db-go codeql query run ../ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.ql --database=testdb --output=notracing-out.bqrs --search-path .. codeql bqrs decode notracing-out.bqrs --format=csv --output=notracing-out.csv @@ -19,7 +19,7 @@ export CODEQL_EXTRACTOR_GO_BUILD_TRACING=on rm -rf testdb -codeql database create --language=go testdb +codeql database create --language=go testdb --search-path ../.. codeql dataset check testdb/db-go codeql query run ../ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.ql --database=testdb --output=tracing-out.bqrs --search-path .. codeql bqrs decode tracing-out.bqrs --format=csv --output=tracing-out.csv diff --git a/ruby/Makefile b/ruby/Makefile index 7cc41bdbd69..d40bc33698b 100644 --- a/ruby/Makefile +++ b/ruby/Makefile @@ -65,4 +65,4 @@ extractor: $(FILES) $(BIN_FILES) cp extractor/target/release/codeql-extractor-ruby$(EXE) extractor-pack/tools/$(CODEQL_PLATFORM)/extractor$(EXE) test: extractor dbscheme - 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 + 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 diff --git a/ruby/doc/HOWTO.md b/ruby/doc/HOWTO.md index df98b32fd3f..ccfb8c9bc5e 100644 --- a/ruby/doc/HOWTO.md +++ b/ruby/doc/HOWTO.md @@ -31,7 +31,7 @@ First, get an extractor pack. There are two options: Then run ```bash -codeql database create -l ruby -s +codeql database create -l ruby -s --search-path ``` ## Running qltests @@ -39,7 +39,7 @@ codeql database create -l ruby -s Run ```bash -codeql test run +codeql test run --search-path ``` ## Writing database upgrade scripts diff --git a/swift/actions/run-ql-tests/action.yml b/swift/actions/run-ql-tests/action.yml index 51cdb03c5f6..23d1b8f5da6 100644 --- a/swift/actions/run-ql-tests/action.yml +++ b/swift/actions/run-ql-tests/action.yml @@ -20,6 +20,7 @@ runs: codeql test run \ --threads=0 \ --ram 50000 \ + --search-path "$GITHUB_WORKSPACE" \ --check-databases \ --check-unused-labels \ --check-repeated-labels \ @@ -31,3 +32,4 @@ runs: swift/ql/test env: GITHUB_TOKEN: ${{ github.token }} + GITHUB_WORKSPACE: ${{ github.workspace }}