diff --git a/CODEOWNERS b/CODEOWNERS index bceaafdbc07c..4b5bfd124d2a 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -11,7 +11,6 @@ /go/codeql-tools/ @github/codeql-go @github/code-scanning-language-coverage /go/downgrades/ @github/codeql-go @github/code-scanning-language-coverage /go/extractor/ @github/codeql-go @github/code-scanning-language-coverage -/go/extractor-smoke-test/ @github/codeql-go @github/code-scanning-language-coverage /go/ql/test/extractor-tests/ @github/codeql-go @github/code-scanning-language-coverage /java/ @github/codeql-java /javascript/ @github/codeql-javascript diff --git a/go/Makefile b/go/Makefile index 0b9dc9e4ea4c..86c690fcad9b 100644 --- a/go/Makefile +++ b/go/Makefile @@ -58,7 +58,6 @@ test: all build/testdb/check-upgrade-path # 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 --search-path .. --check-diff-informed --consistency-queries ql/consistency-queries --compilation-cache=$(cache) --dynamic-join-order-mode=$(rtjo) cd extractor; $(BAZEL) test ... - bash extractor-smoke-test/test.sh || (echo "Extractor smoke test FAILED"; exit 1) .PHONY: build/testdb/check-upgrade-path build/testdb/check-upgrade-path : build/testdb/go.dbscheme ql/lib/go.dbscheme diff --git a/go/extractor-smoke-test/.gitignore b/go/extractor-smoke-test/.gitignore deleted file mode 100644 index e32b11d7ee16..000000000000 --- a/go/extractor-smoke-test/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.bqrs -tracing-out.csv -notracing-out.csv -testdb diff --git a/go/extractor-smoke-test/expected.csv b/go/extractor-smoke-test/expected.csv deleted file mode 100644 index cb0eb08f8f42..000000000000 --- a/go/extractor-smoke-test/expected.csv +++ /dev/null @@ -1,12 +0,0 @@ -"1","assignment to i" -"assignment to i","selection of Println" -"call to Println","exit" -"entry","skip" -"entry","skip" -"function declaration","exit" -"i","call to Println" -"nd","col1" -"selection of Println","i" -"skip","1" -"skip","function declaration" -"skip","skip" diff --git a/go/extractor-smoke-test/go.mod b/go/extractor-smoke-test/go.mod deleted file mode 100644 index 0659b4eaec81..000000000000 --- a/go/extractor-smoke-test/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/codeql-go-extractor-smoke-test - -go 1.14 diff --git a/go/extractor-smoke-test/main.go b/go/extractor-smoke-test/main.go deleted file mode 100644 index 2f7b1325daa0..000000000000 --- a/go/extractor-smoke-test/main.go +++ /dev/null @@ -1,8 +0,0 @@ -package main - -import "fmt" - -func main() { - var i int = 1 - fmt.Println(i) -} diff --git a/go/extractor-smoke-test/test.sh b/go/extractor-smoke-test/test.sh deleted file mode 100755 index bd22da4d906e..000000000000 --- a/go/extractor-smoke-test/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -set -e - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" -cd $DIR - -rm -rf 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 -diff -w -u <(sort notracing-out.csv) expected.csv - -# Now do it again with tracing enabled - -export CODEQL_EXTRACTOR_GO_BUILD_TRACING=on - -rm -rf 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 -w -u <(sort tracing-out.csv) expected.csv diff --git a/go/ql/integration-tests/test-extraction/test.py b/go/ql/integration-tests/test-extraction/test.py index e25b46801146..7b6caad350a1 100644 --- a/go/ql/integration-tests/test-extraction/test.py +++ b/go/ql/integration-tests/test-extraction/test.py @@ -5,3 +5,12 @@ def test_traced(codeql, go): def test_autobuild(codeql, go): codeql.database.create(source_root="src", extractor_option = ["extract_tests=true"]) + +def test_autobuild_traced(codeql, go): + # Autobuild under build tracing must produce the same database as untraced + # autobuild and explicit traced builds, all checked against test.expected. + codeql.database.create( + source_root="src", + extractor_option = ["extract_tests=true"], + _env={"CODEQL_EXTRACTOR_GO_BUILD_TRACING": "on"}, + )