From 989d95c38cc4c665a9ff942240ed87cb38138ec7 Mon Sep 17 00:00:00 2001 From: Dimitri Lajou Date: Wed, 26 Mar 2025 14:32:02 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20modification=20des=20scripts=20pour=20g?= =?UTF-8?q?=C3=A9rer=20les=20versions=20de=20clang?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compile | 23 ++++++++++++++++++++++- runAllTests.py | 13 ++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/compile b/compile index c90b242..d4cb55b 100755 --- a/compile +++ b/compile @@ -13,4 +13,25 @@ name="`dirname $1`/`basename $1 .vsl`" # translating from VSL to LLVM IR (.ll) java -jar build/libs/TP2.jar < $name.vsl > $name.ll -clang $name.ll -o $name +# Check clang version +if command -v clang-20 2>&1 >/dev/null +then + cl=clang-20 +else +if command -v clang-19 2>&1 >/dev/null +then + cl=clang-19 +else +if command -v clang-18 2>&1 >/dev/null +then + cl=clang-18 +else +if command -v clang-17 2>&1 >/dev/null +then + cl=clang-17 +else + cl=clang +fi fi fi fi + +# Compile using clang +$cl $name.ll -o $name \ No newline at end of file diff --git a/runAllTests.py b/runAllTests.py index e3595c5..d9ff4bb 100755 --- a/runAllTests.py +++ b/runAllTests.py @@ -9,6 +9,17 @@ from colorama import Style stats = {} +# Détermine quel est l'exécutable clang utilisable. +# Note : à l'istic c'est clang-19 +def clangName(): + for name in ["clang-" + str(v) for v in range(20,16,-1)]: + p = subprocess.run(f"command -v {name} 2>&1 >/dev/null", shell=True) + if p.returncode == 0 : + return name + return "clang" + +clang = clangName() + def runTestNormalLevel(level): print(f"Running test of level {level}") stats[level] = (0,0,0,0) @@ -37,7 +48,7 @@ def runNormalTest(i, dirname,filename): # LLVM -> Bin if vslToLLVM : - p = subprocess.run(f"clang {basename}.ll -o {basename} 2>/dev/null", shell=True) + p = subprocess.run(f"{clang} {basename}.ll -o {basename} 2>/dev/null", shell=True) if p.returncode == 0: llvmToBin = True executionCorrect = True