Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 7bc68c4

Browse files
author
Henning Makholm
committed
Adapt Go tests to codeql test
These changes make the tests work with the coming `codeql test` support. The `queries.xml` file defines which extractor the `codeql test` runner will use to extract databases for the tests. In the future one will be able to write this information in `qlpack.yml`, but we can't do that immediately because the _existing_ CodeQL tooling would refuse to parse a `qlpack.yml` that has the new field in it.
1 parent 2fc9e37 commit 7bc68c4

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

codeql-extractor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ file_types:
1414
display_name: Go
1515
extensions:
1616
- .go
17+
legacy_qltest_extraction: true

codeql-tools/index.cmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@echo off
2+
SETLOCAL EnableDelayedExpansion
3+
4+
type NUL && "%CODEQL_EXTRACTOR_GO_ROOT%/tools/%CODEQL_PLATFORM%/go-extractor.exe" -mod=vendor ./...
5+
exit /b %ERRORLEVEL%
6+
7+
ENDLOCAL

codeql-tools/index.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
set -eu
4+
5+
if [ "$CODEQL_PLATFORM" != "linux64" ] && [ "$CODEQL_PLATFORM" != "osx64" ] ; then
6+
echo "Automatic build detection for $CODEQL_PLATFORM is not implemented."
7+
exit 1
8+
fi
9+
10+
"$CODEQL_EXTRACTOR_GO_ROOT/tools/$CODEQL_PLATFORM/go-extractor" -mod=vendor ./...

ql/test/queries.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<queries language="go"/>

0 commit comments

Comments
 (0)