diff --git a/share/smack/frontend.py b/share/smack/frontend.py index 6fb9cfe66..f04eef090 100644 --- a/share/smack/frontend.py +++ b/share/smack/frontend.py @@ -332,17 +332,14 @@ def find_target(config, options=None): entries = os.listdir(bcbase) bcs = [] - for entry in entries: - if entry.startswith(target_name + '-') and entry.endswith('.bc'): - bcs.append(bcbase + entry) - - bc_file = temporary_file( - os.path.splitext( - os.path.basename(input_file))[0], - '.bc', - args) - try_command([llvm_exact_bin('llvm-link')] + bcs + ['-o', bc_file]) - return bc_file + # Matches either target_name.bc or target_name-0123456789abcdef.bc + # depending on platform + target_pattern = target_name + r'(-[a-f0-9]{16})?\.bc' + r = re.compile(target_pattern) + bcs = list(filter(r.match, entries)) + assert (len(bcs) == 1) + + return bcbase + bcs[0] def default_rust_compile_args(args): diff --git a/test/regtest.py b/test/regtest.py index 98ca376ae..3d22091b9 100755 --- a/test/regtest.py +++ b/test/regtest.py @@ -14,6 +14,7 @@ import time import sys import shlex +import pathlib OVERRIDE_FIELDS = ['verifiers', 'memory', 'time-limit', 'memory-limit', 'skip'] APPEND_FIELDS = ['flags', 'checkbpl', 'checkout'] @@ -70,11 +71,12 @@ def merge(metadata, yamldata): def metadata(file): m = {} prefix = [] + path = pathlib.Path(file) - for d in path.dirname(file).split('/'): + for d in ('./',) + path.parent.parts: prefix += [d] - yaml_file = path.join(*(prefix + ['config.yml'])) - if path.isfile(yaml_file): + yaml_file = pathlib.Path(*(prefix + ['config.yml'])) + if yaml_file.is_file(): with open(yaml_file, "r") as f: data = yaml.safe_load(f) merge(m, data)