[PATCH] D125084: [test, x86] Fix spurious x86-target-features.c failure

Thomas Preud'homme via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 6 01:53:50 PDT 2022


thopre created this revision.
thopre added reviewers: sconstab, craig.topper, andrew.w.kaylor, zbrid, chandlerc.
Herald added subscribers: StephenFan, pengfei.
Herald added a project: All.
thopre requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

x86-target-features.c can spuriously fail when checking for absence of
the string "lvi" in the compiler output due to the temporary path used
for the output file. For example:
"-o" "/tmp/lit-tmp-981j7lvi/x86-target-features-670b86.o"
will make the test fail. This commit checks specifically for lvi as a
target feature, in a similar way to the positive CHECK directive just
above.

Test Plan: fails when using -mlvi-hardening and pass otherwise


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125084

Files:
  clang/test/Driver/x86-target-features.c


Index: clang/test/Driver/x86-target-features.c
===================================================================
--- clang/test/Driver/x86-target-features.c
+++ clang/test/Driver/x86-target-features.c
@@ -170,7 +170,7 @@
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=LVIHARDENING %s
 // RUN: %clang -target i386-linux-gnu -mno-lvi-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-LVIHARDENING %s
 // LVIHARDENING: "-target-feature" "+lvi-load-hardening" "-target-feature" "+lvi-cfi"
-// NO-LVIHARDENING-NOT: lvi
+// NO-LVIHARDENING-NOT: "-target-feature" "+lvi
 
 // RUN: %clang -target i386-linux-gnu -mlvi-hardening -mspeculative-load-hardening %s -### -o %t.o 2>&1 | FileCheck -check-prefix=LVIHARDENING-SLH %s
 // LVIHARDENING-SLH: error: invalid argument 'mspeculative-load-hardening' not allowed with 'mlvi-hardening'


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125084.427563.patch
Type: text/x-patch
Size: 893 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220506/435a0e7c/attachment.bin>


More information about the cfe-commits mailing list