aboutsummaryrefslogtreecommitdiffstats
path: root/testscript/main.py
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2020-04-30 19:59:28 +0000
committerbloodstalker <thabogre@gmail.com>2020-04-30 19:59:28 +0000
commit0f0799aec14477d27a0cd145b7c5b0e283591b6f (patch)
tree87b276d6d22df27444feac2ad33bf6c3c03e41e9 /testscript/main.py
parentremoved the boost dependency again (diff)
downloadcgrep-0f0799aec14477d27a0cd145b7c5b0e283591b6f.tar.gz
cgrep-0f0799aec14477d27a0cd145b7c5b0e283591b6f.zip
added a note regarding what to do when you get the `stddef.h not found`.
testscript is still WIP.
Diffstat (limited to 'testscript/main.py')
-rwxr-xr-xtestscript/main.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/testscript/main.py b/testscript/main.py
index fddc3a3..1015b21 100755
--- a/testscript/main.py
+++ b/testscript/main.py
@@ -5,6 +5,7 @@ import argparse
import subprocess
import os
import sys
+import re
test_files = ["/home/bloodstalker/extra/cgrep/cgrep.cpp"]
@@ -60,14 +61,19 @@ def main():
argparser = Argparser()
cgrep_exe = "cgrep"
os.chdir("../")
- print(os.getcwd())
+ # get LLVM libdir
+ llvm_libdir = call_from_shell_list(["llvm-config", "--libdir"])
+ # get LLVM version. upstream builds can have extra unwanted text attached.
+ llvm_version = re.findall("[0-9]*\.[0-9]*\.[0-9]*", call_from_shell_list(["llvm-config", "--version"]).stdout.decode("utf-8"))
+ # buld the magic sause. we dont wanna get stddef.h not found.
+ clang_builtin_headers = "--extra-arg=-I" + llvm_libdir.stdout.decode("utf-8")[:-1] + "/clang/" + llvm_version[0] + "/include"
for cgrep_test_arg in cgrep_test_args:
arg_list = cgrep_test_arg.split()
arg_list.insert(0, cgrep_exe)
+ arg_list.append(clang_builtin_headers)
arg_list.append(test_files[0])
print(arg_list)
ret = call_from_shell_list(arg_list)
- #print("ret:", ret.returncode)
print("ret:", ret.stdout.decode("utf-8"), end="")
print("ret:", ret.stderr.decode("utf-8"), end="")