Files
codeql/swift/integration-tests/create_database_utils.py
Paolo Tranquilli 901e066355 Swift: locally run integration tests
Minimal recreations of internal `integration-tests-runner.py` and
`create_database_utils.py` are provided to be able to run the
integration tests on the codeql repository with a released codeql CLI.

For the moment we skip the database checks by default, as we are still
producing inconsistent results.
2022-07-01 15:00:05 +02:00

27 lines
758 B
Python

"""
recreation of internal `create_database_utils.py` to run the tests locally, with minimal
and swift-specialized functionality
"""
import subprocess
import pathlib
import sys
def run_codeql_database_create(cmds, lang, keep_trap=True):
assert lang == 'swift'
codeql_root = pathlib.Path(__file__).parents[2]
cmd = [
"codeql", "database", "create",
"-s", ".", "-l", "swift", "--internal-use-lua-tracing", f"--search-path={codeql_root}",
]
if keep_trap:
cmd.append("--keep-trap")
for c in cmds:
cmd += ["-c", c]
cmd.append("db")
res = subprocess.run(cmd)
if res.returncode:
print("FAILED", file=sys.stderr)
print(" ", *cmd, file=sys.stderr)
sys.exit(res.returncode)