File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ test: all build/testdb/check-upgrade-path
118118 # use GOOS=linux because GOOS=darwin GOARCH=386 is no longer supported
119119 env GOOS=linux GOARCH=386 codeql$(EXE) test run ql/test/query-tests/Security/CWE-681 --search-path . --consistency-queries ql/test/consistency
120120 cd extractor; go test -mod=vendor ./... | grep -vF "[no test files]"
121+ bash extractor-smoke-test/test.sh || (echo "Extractor smoke test FAILED"; exit 1)
121122
122123.PHONY : build/testdb/check-upgrade-path
123124build/testdb/check-upgrade-path : build/testdb/go.dbscheme ql/src/go.dbscheme
Original file line number Diff line number Diff line change 1+ * .bqrs
2+ tracing-out.csv
3+ notracing-out.csv
4+ testdb
Original file line number Diff line number Diff line change 1+ "nd" , "col1"
2+ " entry" , " skip"
3+ " entry" , " skip"
4+ " function declaration" , " exit"
5+ " assignment to i" , " selection of Println"
6+ " skip" , " skip"
7+ " skip" , " function declaration"
8+ " skip" , " 1"
9+ " 1" , " assignment to i"
10+ " call to Println" , " exit"
11+ " selection of Println" , " i"
12+ " i" , " call to Println"
Original file line number Diff line number Diff line change 1+ module github.com/codeql-go-extractor-smoke-test
2+
3+ go 1.14
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import "fmt"
4+
5+ func main () {
6+ var i int = 1
7+ fmt .Println (i )
8+ }
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd ) "
6+ cd $DIR
7+
8+ rm -rf testdb
9+
10+ codeql database create --language=go testdb --search-path ..
11+ codeql query run ../ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.ql --database=testdb --output=notracing-out.bqrs --search-path ..
12+ codeql bqrs decode notracing-out.bqrs --format=csv --output=notracing-out.csv
13+ diff -w -u notracing-out.csv expected.csv
14+
15+ # Now do it again with tracing enabled
16+
17+ export CODEQL_EXTRACTOR_GO_BUILD_TRACING=on
18+
19+ rm -rf testdb
20+
21+ codeql database create --language=go testdb --search-path ..
22+ codeql query run ../ql/test/library-tests/semmle/go/controlflow/ControlFlowGraph/ControlFlowNode_getASuccessor.ql --database=testdb --output=tracing-out.bqrs --search-path ..
23+ codeql bqrs decode tracing-out.bqrs --format=csv --output=tracing-out.csv
24+ diff -w -u tracing-out.csv expected.csv
Original file line number Diff line number Diff line change @@ -145,9 +145,7 @@ func RunCmd(cmd *exec.Cmd) bool {
145145
146146func getOsToolsSubdir () (string , error ) {
147147 platform , set := os .LookupEnv ("CODEQL_PLATFORM" )
148- if ! set {
149- log .Print ("CODEQL_PLATFORM not set; this binary should be run from the `codeql` CLI. Falling back to use `runtime.GOOS`.\n " )
150- } else {
148+ if set && platform != "" {
151149 return platform , nil
152150 }
153151
You can’t perform that action at this time.
0 commit comments