From 0f0799aec14477d27a0cd145b7c5b0e283591b6f Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Fri, 1 May 2020 00:29:28 +0430 Subject: added a note regarding what to do when you get the `stddef.h not found`. testscript is still WIP. --- testscript/main.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'testscript') 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="") -- cgit v1.2.3