Skip to content

Commit c042aff

Browse files
committed
[NFC] Disallow unused prefixes under llvm/test
This patch sets the default for llvm tests, with the exception of tests under Reduce, because quite a few of them use 'FileCheck' as parameter to a tool, and including a flag as that parameter would complicate matters. The rest of the patch undo-es the lit.local.cfg changes we progressively introduced as temporary measure to avoid regressions under various directories. Differential Revision: https://reviews.llvm.org/D95111
1 parent a11bf9a commit c042aff

File tree

22 files changed

+53
-94
lines changed

22 files changed

+53
-94
lines changed

llvm/test/Analysis/lit.local.cfg

Lines changed: 0 additions & 9 deletions
This file was deleted.

llvm/test/CodeGen/lit.local.cfg

Lines changed: 0 additions & 7 deletions
This file was deleted.

llvm/test/FileCheck/lit.local.cfg

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,12 @@ config.test_format = lit.formats.ShTest(execute_external=False)
5454
# that test results throughout all test suites are affected.
5555
config.substitutions.append(('%ProtectFileCheckOutput',
5656
'env -u FILECHECK_OPTS'))
57+
58+
# FIXME: remove this once the default is flipped.
59+
from lit.llvm.subst import ToolSubst
60+
61+
fc = ToolSubst('FileCheck', unresolved='fatal')
62+
# the parent introduced the opposite rule, so we replace it if we see it.
63+
if len(config.substitutions) > 0 and config.substitutions[0] == (fc.regex, 'FileCheck --allow-unused-prefixes=false'):
64+
del config.substitutions[0]
65+

llvm/test/Instrumentation/AddressSanitizer/global_metadata_array.ll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
; RUN: opt < %s -asan -asan-module -enable-new-pm=0 -asan-globals-live-support=0 -mtriple=x86_64-unknown-linux-gnu -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s
2-
; RUN: opt < %s -passes='asan-pipeline' -asan-globals-live-support=0 -mtriple=x86_64-unknown-linux-gnu -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s
3-
; RUN: opt < %s -asan -asan-module -enable-new-pm=0 -asan-globals-live-support=0 -mtriple=x86_64-apple-macosx10.11.0 -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s
4-
; RUN: opt < %s -passes='asan-pipeline' -asan-globals-live-support=0 -mtriple=x86_64-apple-macosx10.11.0 -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s
5-
; RUN: opt < %s -asan -asan-module -enable-new-pm=0 -asan-globals-live-support=0 -mtriple=x86_64-pc-windows-msvc19.0.24215 -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s
6-
; RUN: opt < %s -passes='asan-pipeline' -asan-globals-live-support=0 -mtriple=x86_64-pc-windows-msvc19.0.24215 -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s
1+
; RUN: opt < %s -asan -asan-module -enable-new-pm=0 -asan-globals-live-support=0 -mtriple=x86_64-unknown-linux-gnu -S | FileCheck --check-prefix=CHECK %s
2+
; RUN: opt < %s -passes='asan-pipeline' -asan-globals-live-support=0 -mtriple=x86_64-unknown-linux-gnu -S | FileCheck --check-prefix=CHECK %s
3+
; RUN: opt < %s -asan -asan-module -enable-new-pm=0 -asan-globals-live-support=0 -mtriple=x86_64-apple-macosx10.11.0 -S | FileCheck --check-prefix=CHECK %s
4+
; RUN: opt < %s -passes='asan-pipeline' -asan-globals-live-support=0 -mtriple=x86_64-apple-macosx10.11.0 -S | FileCheck --check-prefix=CHECK %s
5+
; RUN: opt < %s -asan -asan-module -enable-new-pm=0 -asan-globals-live-support=0 -mtriple=x86_64-pc-windows-msvc19.0.24215 -S | FileCheck --check-prefix=CHECK %s
6+
; RUN: opt < %s -passes='asan-pipeline' -asan-globals-live-support=0 -mtriple=x86_64-pc-windows-msvc19.0.24215 -S | FileCheck --check-prefix=CHECK %s
77
; RUN: opt < %s -asan -asan-module -enable-new-pm=0 -asan-globals-live-support=0 -asan-mapping-scale=5 -mtriple=x86_64-unknown-linux-gnu -S | FileCheck --check-prefixes=CHECK,CHECK-S5 %s
88
; RUN: opt < %s -passes='asan-pipeline' -asan-globals-live-support=0 -asan-mapping-scale=5 -mtriple=x86_64-unknown-linux-gnu -S | FileCheck --check-prefixes=CHECK,CHECK-S5 %s
99

llvm/test/Instrumentation/HWAddressSanitizer/basic.ll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
; Test basic address sanitizer instrumentation.
22
;
3-
; RUN: opt < %s -hwasan -hwasan-recover=0 -hwasan-with-ifunc=1 -hwasan-with-tls=0 -S | FileCheck %s --check-prefixes=CHECK,ABORT,ABORT-DYNAMIC-SHADOW
3+
; RUN: opt < %s -hwasan -hwasan-recover=0 -hwasan-with-ifunc=1 -hwasan-with-tls=0 -S | FileCheck %s --check-prefixes=CHECK,ABORT
44
; RUN: opt < %s -hwasan -hwasan-recover=1 -hwasan-with-ifunc=1 -hwasan-with-tls=0 -S | FileCheck %s --check-prefixes=CHECK,RECOVER,RECOVER-DYNAMIC-SHADOW
5-
; RUN: opt < %s -hwasan -hwasan-recover=0 -hwasan-mapping-offset=0 -S | FileCheck %s --check-prefixes=CHECK,ABORT,ABORT-ZERO-BASED-SHADOW
5+
; RUN: opt < %s -hwasan -hwasan-recover=0 -hwasan-mapping-offset=0 -S | FileCheck %s --check-prefixes=CHECK,ABORT
66
; RUN: opt < %s -hwasan -hwasan-recover=1 -hwasan-mapping-offset=0 -S | FileCheck %s --check-prefixes=CHECK,RECOVER,RECOVER-ZERO-BASED-SHADOW
77

88
; Ensure than hwasan runs with the new PM pass
9-
; RUN: opt < %s -passes=hwasan -hwasan-recover=0 -hwasan-with-ifunc=1 -hwasan-with-tls=0 -S | FileCheck %s --check-prefixes=CHECK,ABORT,ABORT-DYNAMIC-SHADOW
9+
; RUN: opt < %s -passes=hwasan -hwasan-recover=0 -hwasan-with-ifunc=1 -hwasan-with-tls=0 -S | FileCheck %s --check-prefixes=CHECK,ABORT
1010
; RUN: opt < %s -passes=hwasan -hwasan-recover=1 -hwasan-with-ifunc=1 -hwasan-with-tls=0 -S | FileCheck %s --check-prefixes=CHECK,RECOVER,RECOVER-DYNAMIC-SHADOW
11-
; RUN: opt < %s -passes=hwasan -hwasan-recover=0 -hwasan-mapping-offset=0 -S | FileCheck %s --check-prefixes=CHECK,ABORT,ABORT-ZERO-BASED-SHADOW
11+
; RUN: opt < %s -passes=hwasan -hwasan-recover=0 -hwasan-mapping-offset=0 -S | FileCheck %s --check-prefixes=CHECK,ABORT
1212
; RUN: opt < %s -passes=hwasan -hwasan-recover=1 -hwasan-mapping-offset=0 -S | FileCheck %s --check-prefixes=CHECK,RECOVER,RECOVER-ZERO-BASED-SHADOW
1313

1414
; CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @hwasan.module_ctor, i8* bitcast (void ()* @hwasan.module_ctor to i8*) }]

llvm/test/Instrumentation/HWAddressSanitizer/prologue.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
; RUN: opt -hwasan -S -hwasan-with-ifunc=0 -hwasan-with-tls=0 < %s | \
1010
; RUN: FileCheck %s --check-prefixes=CHECK,CHECK-GLOBAL,CHECK-NOHISTORY
1111
; RUN: opt -hwasan -S -hwasan-with-ifunc=1 -hwasan-with-tls=0 < %s | \
12-
; RUN: FileCheck %s --check-prefixes=CHECK,CHECk-NOGLOBAL,CHECK-IFUNC,CHECK-NOHISTORY
12+
; RUN: FileCheck %s --check-prefixes=CHECK,CHECK-IFUNC,CHECK-NOHISTORY
1313

1414
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
1515
target triple = "aarch64--linux-android22"

llvm/test/Instrumentation/MemorySanitizer/array_types.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
44
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S \
55
; RUN: -passes=msan 2>&1 | FileCheck -check-prefix=CHECK \
6-
; RUN: -check-prefix=CHECK-ORIGINS %s --allow-empty
7-
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
6+
; RUN: %s --allow-empty
7+
; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK %s
88

99
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
1010
target triple = "x86_64-unknown-linux-gnu"

llvm/test/Instrumentation/MemorySanitizer/check-array.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: opt < %s -msan-eager-checks -msan-check-access-address=0 -msan-track-origins=1 -S -passes='module(msan-module),function(msan)' 2>&1 | \
2-
; RUN: FileCheck -allow-deprecated-dag-overlap -check-prefixes=CHECK,CHECK-ORIGINS %s
2+
; RUN: FileCheck -allow-deprecated-dag-overlap --check-prefix=CHECK %s
33

44
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
55
target triple = "x86_64-unknown-linux-gnu"

llvm/test/Instrumentation/MemorySanitizer/check-struct.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S -passes='module(msan-module),function(msan)' 2>&1 | \
2-
; RUN: FileCheck -allow-deprecated-dag-overlap -check-prefixes=CHECK,CHECK-ORIGINS %s
2+
; RUN: FileCheck -allow-deprecated-dag-overlap --check-prefix=CHECK %s
33

44
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
55
target triple = "x86_64-unknown-linux-gnu"

llvm/test/Instrumentation/MemorySanitizer/freeze.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: opt < %s -msan-check-access-address=0 -S -passes=msan 2>&1 | FileCheck %s
2-
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S -passes=msan 2>&1 | FileCheck %s -check-prefixes=CHECK,CHECK-ORIGIN
2+
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=2 -S -passes=msan 2>&1 | FileCheck %s
33
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
44
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
55
target triple = "x86_64-unknown-linux-gnu"

llvm/test/Instrumentation/MemorySanitizer/msan_asm_conservative.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
; Test for handling of asm constraints in MSan instrumentation.
22
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 \
33
; RUN: -msan-handle-asm-conservative=0 -S -passes=msan 2>&1 | FileCheck \
4-
; RUN: "-check-prefixes=CHECK,CHECK-NONCONS" %s
5-
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=0 -S | FileCheck -check-prefixes=CHECK,CHECK-NONCONS %s
4+
; RUN: "-check-prefix=CHECK" %s
5+
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=0 -S | FileCheck -check-prefixes=CHECK %s
66
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 \
77
; RUN: -msan-handle-asm-conservative=1 -S -passes=msan 2>&1 | FileCheck \
88
; RUN: "-check-prefixes=CHECK,CHECK-CONS" %s

llvm/test/Instrumentation/MemorySanitizer/msan_eager.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
22
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -msan-eager-checks -S -passes='module(msan-module),function(msan)' 2>&1 | \
3-
; RUN: FileCheck -allow-deprecated-dag-overlap -check-prefixes=CHECK,CHECK-ORIGINS %s
3+
; RUN: FileCheck -allow-deprecated-dag-overlap --check-prefix=CHECK %s
44

55
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
66
target triple = "x86_64-unknown-linux-gnu"

llvm/test/Instrumentation/MemorySanitizer/msan_x86_bts_asm.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
; Test for the conservative assembly handling mode used by KMSAN.
22
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 \
33
; RUN: -msan-handle-asm-conservative=0 -S -passes=msan 2>&1 | FileCheck \
4-
; RUN: "-check-prefixes=CHECK,CHECK-NONCONS" %s
5-
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=0 -S | FileCheck -check-prefixes=CHECK,CHECK-NONCONS %s
4+
; RUN: "-check-prefix=CHECK" %s
5+
; RUN: opt < %s -msan -msan-kernel=1 -msan-check-access-address=0 -msan-handle-asm-conservative=0 -S | FileCheck -check-prefixes=CHECK %s
66
; RUN: opt < %s -msan-kernel=1 -msan-check-access-address=0 \
77
; RUN: -msan-handle-asm-conservative=1 -S -passes=msan 2>&1 | FileCheck \
88
; RUN: "-check-prefixes=CHECK,CHECK-CONS" %s

llvm/test/Instrumentation/MemorySanitizer/reduce.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
; RUN: opt < %s -msan-check-access-address=0 -msan-track-origins=1 -S -passes='module(msan-module),function(msan)' 2>&1 | \
3-
; RUN: FileCheck -allow-deprecated-dag-overlap -check-prefixes=CHECK,CHECK-ORIGINS %s
3+
; RUN: FileCheck -allow-deprecated-dag-overlap --check-prefix=CHECK %s
44

55
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
66
target triple = "x86_64-unknown-linux-gnu"

llvm/test/MC/AArch64/lit.local.cfg

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
from lit.llvm.subst import ToolSubst
2-
31
if 'AArch64' not in config.root.targets:
42
config.unsupported = True
5-
6-
fc = ToolSubst('FileCheck', unresolved='fatal')
7-
# Insert this first. Then, we'll first update the blank FileCheck command; then,
8-
# the default substitution of FileCheck will replace it to its full path.
9-
config.substitutions.insert(0, (fc.regex,
10-
'FileCheck --allow-unused-prefixes=false'))

llvm/test/MC/AMDGPU/lit.local.cfg

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
from lit.llvm.subst import ToolSubst
2-
31
if not 'AMDGPU' in config.root.targets:
42
config.unsupported = True
5-
6-
fc = ToolSubst('FileCheck', unresolved='fatal')
7-
# Insert this first. Then, we'll first update the blank FileCheck command; then,
8-
# the default substitution of FileCheck will replace it to its full path.
9-
config.substitutions.insert(0, (fc.regex,
10-
'FileCheck --allow-unused-prefixes=false'))

llvm/test/MC/ARM/lit.local.cfg

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
from lit.llvm.subst import ToolSubst
2-
31
if not 'ARM' in config.root.targets:
42
config.unsupported = True
5-
6-
fc = ToolSubst('FileCheck', unresolved='fatal')
7-
# Insert this first. Then, we'll first update the blank FileCheck command; then,
8-
# the default substitution of FileCheck will replace it to its full path.
9-
config.substitutions.insert(0, (fc.regex,
10-
'FileCheck --allow-unused-prefixes=false'))

llvm/test/MC/RISCV/lit.local.cfg

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
from lit.llvm.subst import ToolSubst
2-
31
if not 'RISCV' in config.root.targets:
42
config.unsupported = True
5-
6-
fc = ToolSubst('FileCheck', unresolved='fatal')
7-
# Insert this first. Then, we'll first update the blank FileCheck command; then,
8-
# the default substitution of FileCheck will replace it to its full path.
9-
config.substitutions.insert(0, (fc.regex,
10-
'FileCheck --allow-unused-prefixes=false'))

llvm/test/Other/lit.local.cfg

Lines changed: 0 additions & 12 deletions
This file was deleted.

llvm/test/Reduce/lit.local.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- Python -*- vim: set ft=python ts=4 sw=4 expandtab tw=79:
2+
# FIXME: remove this file when we flip the default for --allow-unused-prefixes.
3+
from lit.llvm.subst import ToolSubst
4+
5+
fc = ToolSubst('FileCheck', unresolved='fatal')
6+
# the parent introduced the opposite rule, so we replace it if we see it.
7+
if len(config.substitutions) > 0 and config.substitutions[0] == (fc.regex, 'FileCheck --allow-unused-prefixes=false'):
8+
del config.substitutions[0]

llvm/test/Transforms/lit.local.cfg

Lines changed: 0 additions & 8 deletions
This file was deleted.

llvm/test/lit.cfg.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,20 @@ def get_asan_rtlib():
8282
return ''
8383
return found_dylibs[0]
8484

85-
# Define this first. Afterwards, use_default_substitutions will add the rule for
86-
# expanding FileCheck to the full path.
87-
config.substitutions.append(('%FileCheckWithUnusedPrefixes%',
88-
'FileCheck --allow-unused-prefixes=true'))
85+
86+
####################################################
87+
# FIXME: remove this when we flip the default value for --allow-unused-prefixes
88+
# to false.
89+
fc = ToolSubst('FileCheck', unresolved='fatal')
90+
# Insert this first. Then, we'll first update the blank FileCheck command; then,
91+
# the default substitution of FileCheck will replace it to its full path.
92+
config.substitutions.insert(0, (fc.regex,
93+
'FileCheck --allow-unused-prefixes=false'))
94+
# When addressing this fixme, replace %FileCheckRaw% with just FileCheck.
95+
config.substitutions.append(('%FileCheckRaw%', 'FileCheck'))
96+
# Also remove the lit.local.cfg under llvm/test/Reduce
97+
# and the pertinent FIXME in llvm/test/FileCheck
98+
####################################################
8999

90100
llvm_config.use_default_substitutions()
91101

0 commit comments

Comments
 (0)