mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Merge pull request #16184 from github/mbg/go/integration-tests-lib
Go: Add integration test library
This commit is contained in:
18
go/integration-tests-lib/go_integration_test.py
Normal file
18
go/integration-tests-lib/go_integration_test.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import os
|
||||
from create_database_utils import *
|
||||
from diagnostics_test_utils import *
|
||||
|
||||
def go_integration_test(source = "src"):
|
||||
# Set up a GOPATH relative to this test's root directory;
|
||||
# we set os.environ instead of using extra_env because we
|
||||
# need it to be set for the call to "go clean -modcache" later
|
||||
goPath = os.path.join(os.path.abspath(os.getcwd()), ".go")
|
||||
os.environ['GOPATH'] = goPath
|
||||
|
||||
run_codeql_database_create([], lang="go", source=source)
|
||||
|
||||
check_diagnostics()
|
||||
|
||||
# Clean up the temporary GOPATH to prevent Bazel failures next
|
||||
# time the tests are run; see https://github.com/golang/go/issues/27161
|
||||
subprocess.call(["go", "clean", "-modcache"])
|
||||
Reference in New Issue
Block a user