Skip to content

Commit

Permalink
minor enhancement in check script
Browse files Browse the repository at this point in the history
Checks the installed compiler really advertises the expected version.

Signed-off-by: Marc Poulhiès <[email protected]>
  • Loading branch information
dkm committed May 29, 2024
1 parent 3a29813 commit 8af1dc8
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions check_and_update_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import re
from collections import defaultdict
import json

import subprocess
import argparse

LANGS=[ "ADA", "D", "FORTRAN", "CXX", "GO", "C", "OBJC", "OBJCXX" ]
Expand Down Expand Up @@ -390,7 +390,18 @@ def findFile (arch: str, lang: str, version: str, directory: str, suffix: str):
raise Woops("Can't find '{target_dir}, something's wrong")

def findCompiler (arch: str, lang: str, version: str, directory: str):
return findFile(arch, lang, version, directory, COMPILER_SUFFIX[lang])
candidate = findFile(arch, lang, version, directory, COMPILER_SUFFIX[lang])
version_found = False
lines = subprocess.check_output([candidate, "--version"]).decode("utf-8").splitlines()
for l in lines:
if re.search(version, l):
version_found = True

if not version_found:
text = '\n'.join(lines)
raise Woops(f"Compiler found ({candidate}) doesn't expose the correct version: {text}")

return candidate

def CompilerId (arch: str, version: str, lang: str):
renamed_arch = arch
Expand Down Expand Up @@ -639,6 +650,9 @@ def check_lang_enabled_in_ctng (args, lang):
if args.summary:
with open(args.summary, "a") as f:
f.write(f"NOT OK (ERROR): {args.arch} {args.version} {lang}\n")
f.write(str(err))
f.write("\n")

else:
raise err

Expand Down

0 comments on commit 8af1dc8

Please sign in to comment.