1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00
openrw/cmake/modules/llvm-cov-wrapper.in

26 lines
774 B
Plaintext
Raw Normal View History

#!/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