memgraph/tools/tests/apollo_runs.py
Matej Ferencevic 499ad3ba15 Add initial version of Apollo config files
Summary:
Improve Apollo config files

Add name to apollo_build

Remove old generate script from build

Add build_release symlink to release build

Rename 'args' to 'arguments'

Add run definition for cppcheck

Host doxygen documentation

Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1095
2018-01-10 14:46:10 +01:00

40 lines
1.2 KiB
Python
Executable File

#!/usr/bin/env python3
import json
import os
import re
import subprocess
# paths
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
TESTS_DIR_REL = os.path.join("..", "..", "build", "tools", "tests")
TESTS_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, TESTS_DIR_REL))
# ctest tests
ctest_output = subprocess.run(["ctest", "-N"], cwd=TESTS_DIR, check=True,
stdout=subprocess.PIPE).stdout.decode("utf-8")
runs = []
# test ordering: first unit, then concurrent, then everything else
for row in ctest_output.split("\n"):
# Filter rows only containing tests.
if not re.match("^\s*Test\s+#", row): continue
name = row.split(":")[1].strip()
path = os.path.join(TESTS_DIR_REL, name)
dirname, basename = os.path.split(path)
files = [basename, "CTestTestfile.cmake"]
# extra files for specific tests
if name == "test_mg_import_csv":
files.extend(["csv", "mg_recovery_check", "../src/mg_import_csv"])
runs.append({
"name": "tools__" + name,
"cd": dirname,
"commands": "ctest --output-on-failure -R \"^{}$\"".format(name),
"infiles": files,
})
print(json.dumps(runs, indent=4, sort_keys=True))