diff --git a/lld/test/MachO/lc-build-version.s b/lld/test/MachO/lc-build-version.s --- a/lld/test/MachO/lc-build-version.s +++ b/lld/test/MachO/lc-build-version.s @@ -1,7 +1,7 @@ # REQUIRES: x86 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o # RUN: lld -flavor darwinnew -Z -platform_version macos 10.14.1 10.15 -o %t %t.o -# RUN: llvm-objdump --macho --all-headers %t | FileCheck %s +# RUN: llvm-objdump --macho --all-headers %t | FileCheck %s -DLLD_VERSION=%llvm_version # CHECK: cmd LC_BUILD_VERSION # CHECK-NEXT: cmdsize 32 @@ -10,7 +10,7 @@ # CHECK-NEXT: minos 10.14.1 # CHECK-NEXT: ntools 1 # CHECK-NEXT: tool ld -# CHECK-NEXT: version {{[0-9\.]+}} +# CHECK-NEXT: version [[LLD_VERSION]] # CHECK-NEXT: Load command [[#]] .text diff --git a/lld/test/lit.cfg.py b/lld/test/lit.cfg.py --- a/lld/test/lit.cfg.py +++ b/lld/test/lit.cfg.py @@ -83,6 +83,7 @@ # Set a fake constant version so that we get consistent output. config.environment['LLD_VERSION'] = 'LLD 1.0' config.environment['LLD_IN_TEST'] = '1' +config.substitutions.append(("%llvm_version", config.llvm_version)) # Indirectly check if the mt.exe Microsoft utility exists by searching for # cvtres, which always accompanies it. Alternatively, check if we can use diff --git a/lld/test/lit.site.cfg.py.in b/lld/test/lit.site.cfg.py.in --- a/lld/test/lit.site.cfg.py.in +++ b/lld/test/lit.site.cfg.py.in @@ -16,6 +16,7 @@ config.python_executable = "@Python3_EXECUTABLE@" config.have_zlib = @LLVM_ENABLE_ZLIB@ config.sizeof_void_p = @CMAKE_SIZEOF_VOID_P@ +config.llvm_version = "@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" # Support substitution of the tools and libs dirs with user parameters. This is # used when we can't determine the tool dir at configuration time.