1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 15:02:34 +02:00
openrw/cmake/modules/llvm-cov-wrapper.in
2018-11-27 13:47:25 +01:00

26 lines
774 B
Python
Executable File

#!/usr/bin/env python
import re
import subprocess
import sys
llvm_cov_bin = "@LLVM_COV_BIN@"
# The wrapper must return the version for the "-v" and "--version" flags.
# llvm-cov only accepts --version
if any(h in sys.argv for h in ("-v", "--version",)):
p = subprocess.Popen([llvm_cov_bin, "--version"], stdout=subprocess.PIPE)
output = p.stdout.read().decode("utf8")
p.wait()
assert p.returncode == 0
versionmatch = re.search("([0-9]+\\.[0-9]+(?:\\.[0-9]+))", output)
if not versionmatch:
raise RuntimeError("Cannot detect version")
print(versionmatch)
print("{} version {}".format(sys.argv[0], versionmatch.group(1)))
sys.exit(0)
p = subprocess.Popen([llvm_cov_bin, "gcov"] + sys.argv[1:])
p.wait()
assert p.returncode == 0