[PATCH] D86026: Update lld test suite to include a substitution for the current LLVM version and make the test parametric

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 15 14:41:45 PDT 2020


mehdi_amini created this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
mehdi_amini requested review of this revision.

This makes the test introduced in 537f5483fe4e <https://reviews.llvm.org/rG537f5483fe4e09c39ffd7ac837c00b50dd13d676> more robust with respect
to the actual version number. The previous regex restricted the version
to start with a leading `1` which was overly restrictive.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86026

Files:
  lld/test/MachO/lc-build-version.s
  lld/test/lit.cfg.py
  lld/test/lit.site.cfg.py.in


Index: lld/test/lit.site.cfg.py.in
===================================================================
--- lld/test/lit.site.cfg.py.in
+++ 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 at .@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.
Index: lld/test/lit.cfg.py
===================================================================
--- lld/test/lit.cfg.py
+++ 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
Index: lld/test/MachO/lc-build-version.s
===================================================================
--- lld/test/MachO/lc-build-version.s
+++ 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86026.285862.patch
Type: text/x-patch
Size: 1866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200815/4ec4928a/attachment.bin>


More information about the llvm-commits mailing list