From 42a66fb727284d8a5ed28f56d5545864fa8dceb5 Mon Sep 17 00:00:00 2001 From: Rafael Auler Date: Mon, 11 Jul 2022 17:58:32 -0700 Subject: [PATCH] [BOLT] Restrict execution of tests that fail on Windows Turn off execution of tests that use UNIX-specific features. Reviewed By: Amir Differential Revision: https://reviews.llvm.org/D126933 --- bolt/test/AArch64/asm-func-debug.test | 2 +- bolt/test/R_ABS.pic.lld.cpp | 4 ++++ bolt/test/X86/double-jump.test | 4 ++++ bolt/test/X86/jmp-optimization.test | 4 ++++ bolt/test/X86/jump-table-icp.test | 4 ++++ bolt/test/X86/shrinkwrapping.test | 4 ++++ bolt/test/bad-exe.test | 5 +++++ bolt/test/bolt-info.test | 5 +++++ bolt/test/invalid-profile.test | 4 ++++ bolt/test/no-relocs.test | 4 ++++ bolt/test/pie.test | 4 ++++ bolt/test/re-optimize.test | 4 ++++ bolt/test/shared-object.test | 5 +++++ 13 files changed, 52 insertions(+), 1 deletion(-) diff --git a/bolt/test/AArch64/asm-func-debug.test b/bolt/test/AArch64/asm-func-debug.test index 37499ec..c585aa9 100644 --- a/bolt/test/AArch64/asm-func-debug.test +++ b/bolt/test/AArch64/asm-func-debug.test @@ -14,7 +14,7 @@ CHECK-NEXT: DW_AT_low_pc (0x0000000000000000) CHECK-NEXT: DW_AT_ranges CHECK-NEXT: [0x0000000000[[#%x,ADDR:]], CHECK-SAME: 0x0000000000[[#ADDR+4]])) -CHECK-NEXT: DW_AT_name ("{{.*}}/asm_foo.s") +CHECK-NEXT: DW_AT_name ("{{.*}}asm_foo.s") # Check .debug_aranges was updated for asm module CHECK: .debug_aranges contents: diff --git a/bolt/test/R_ABS.pic.lld.cpp b/bolt/test/R_ABS.pic.lld.cpp index e07c9d1..b139620 100644 --- a/bolt/test/R_ABS.pic.lld.cpp +++ b/bolt/test/R_ABS.pic.lld.cpp @@ -2,6 +2,10 @@ * Check that we don't assert on a duplicate static relocation added by lld * against _Z6myfuncv. The same address has a dynamic relocation against it. * + * This test uses the clang driver + lld and will only succeed on Linux systems + * with libc available. + * REQUIRES: system-linux + * * RUN: %clang %cflags -fPIC -shared %s -o %t.so -Wl,-q -fuse-ld=lld * RUN: llvm-bolt %t.so -o %t.so.bolt --relocs */ diff --git a/bolt/test/X86/double-jump.test b/bolt/test/X86/double-jump.test index fa2271b..237ca4c 100644 --- a/bolt/test/X86/double-jump.test +++ b/bolt/test/X86/double-jump.test @@ -1,5 +1,9 @@ # Test the double jump removqal peephole. +# This test has commands that rely on shell capabilities that won't execute +# correctly on Windows e.g. subshell execution +REQUIRES: shell + RUN: %clang %cflags %p/Inputs/double_jump.cpp -o %t.exe RUN: (llvm-bolt %t.exe --peepholes=double-jumps \ RUN: --eliminate-unreachable -o %t 2>&1 \ diff --git a/bolt/test/X86/jmp-optimization.test b/bolt/test/X86/jmp-optimization.test index 0953b7a..92f4b9a 100644 --- a/bolt/test/X86/jmp-optimization.test +++ b/bolt/test/X86/jmp-optimization.test @@ -1,5 +1,9 @@ # Tests the optimization of functions that just do a tail call in the beginning. +# This test has commands that rely on shell capabilities that won't execute +# correctly on Windows e.g. unsupported parameter expansion +REQUIRES: shell + RUN: %clang %cflags -O2 %S/Inputs/jmp_opt{,2,3}.cpp -o %t RUN: llvm-bolt -inline-small-functions %t -o %t.bolt RUN: llvm-objdump -d %t.bolt --print-imm-hex | FileCheck %s diff --git a/bolt/test/X86/jump-table-icp.test b/bolt/test/X86/jump-table-icp.test index 7ed77d3..708f127 100644 --- a/bolt/test/X86/jump-table-icp.test +++ b/bolt/test/X86/jump-table-icp.test @@ -4,6 +4,10 @@ RUN: link_fdata %p/Inputs/jump_table_icp.s %t.o %t.fdata --nmtool llvm-nm RUN: llvm-strip --strip-unneeded %t.o RUN: %clang %cflags -no-pie %t.o -o %t.exe -Wl,-q +# This test has commands that rely on shell capabilities that won't execute +# correctly on Windows e.g. subshell execution +REQUIRES: shell + RUN: (llvm-bolt %t.exe --data %t.fdata -o %t --relocs \ RUN: --reorder-blocks=cache --split-functions --split-all-cold \ RUN: --use-gnu-stack --dyno-stats --indirect-call-promotion=jump-tables \ diff --git a/bolt/test/X86/shrinkwrapping.test b/bolt/test/X86/shrinkwrapping.test index 594a87e..1767db2 100644 --- a/bolt/test/X86/shrinkwrapping.test +++ b/bolt/test/X86/shrinkwrapping.test @@ -2,6 +2,10 @@ # shrink-wrapping when optimizing a function without # frame pointers. +# This test has commands that rely on shell capabilities that won't execute +# correctly on Windows e.g. subshell execution to capture command output. +REQUIRES: shell + RUN: %clangxx %cxxflags -no-pie %S/Inputs/exc4sw.S -o %t.exe -Wl,-q RUN: llvm-bolt %t.exe -o %t --relocs --frame-opt=all \ RUN: --data=%p/Inputs/exc4sw.fdata --reorder-blocks=cache 2>&1 | \ diff --git a/bolt/test/bad-exe.test b/bolt/test/bad-exe.test index 8b2ffe2..6c1d8cc 100644 --- a/bolt/test/bad-exe.test +++ b/bolt/test/bad-exe.test @@ -1,5 +1,10 @@ # Check that llvm-bolt rejects input that is not a valid ELF executable # bzip2.debuginfo is the result of running "objcopy --only-keep-debug". + +# This test uses the clang driver without target flags and will only succeed +# on Linux systems where the host triple matches the target. +REQUIRES: system-linux + RUN: %clang %cflags %S/Inputs/icf-jump-tables.c -g -o %t RUN: llvm-objcopy --only-keep-debug %t %t.debuginfo RUN: not llvm-bolt %t.debuginfo -o /dev/null 2>&1 | FileCheck %s diff --git a/bolt/test/bolt-info.test b/bolt/test/bolt-info.test index 862c255..c329c55 100644 --- a/bolt/test/bolt-info.test +++ b/bolt/test/bolt-info.test @@ -1,4 +1,9 @@ # Check that the .bolt_info section is generated properly. + +# This test uses the clang driver without target flags and will only succeed +# on Linux systems where the host triple matches the target. +REQUIRES: system-linux + RUN: %clang %cflags %S/Inputs/icf-jump-tables.c -o %t RUN: llvm-bolt %t -o %t.bolt && \ RUN: llvm-objdump -s -j .note.bolt_info %t.bolt | grep -v "file format" | \ diff --git a/bolt/test/invalid-profile.test b/bolt/test/invalid-profile.test index dfb4fb0..1725a08 100644 --- a/bolt/test/invalid-profile.test +++ b/bolt/test/invalid-profile.test @@ -1,5 +1,9 @@ # Check that llvm-bolt detects bad profile data and aborts +# This test uses the clang driver without target flags and will only succeed +# on Linux systems where the host triple matches the target. +REQUIRES: system-linux + RUN: %clang %S/Inputs/icf-jump-tables.c -o %t RUN: not llvm-bolt %t -o %t.bolt --data %t 2>&1 | FileCheck %s diff --git a/bolt/test/no-relocs.test b/bolt/test/no-relocs.test index 97168cb..9e22705 100644 --- a/bolt/test/no-relocs.test +++ b/bolt/test/no-relocs.test @@ -1,5 +1,9 @@ # Verifies that input without relocations is rejected in relocs mode. +# This test uses the clang driver without target flags and will only succeed +# on Linux systems where the host triple matches the target. +REQUIRES: system-linux + RUN: %clang %cflags %S/Inputs/icf-jump-tables.c -o %t RUN: not llvm-bolt %t -o /dev/null --relocs 2>&1 | FileCheck %s diff --git a/bolt/test/pie.test b/bolt/test/pie.test index 611b98c..e8aaa91 100644 --- a/bolt/test/pie.test +++ b/bolt/test/pie.test @@ -1,5 +1,9 @@ # Check that we do not reject position-independent executables (PIEs). +# This test uses the clang driver without target flags and will only succeed +# on Linux systems where the host triple matches the target. +REQUIRES: system-linux + RUN: %clang %cflags -fPIC -pie %p/Inputs/jump_table_icp.cpp -o %t RUN: llvm-bolt %t -o /dev/null 2>&1 | FileCheck %s diff --git a/bolt/test/re-optimize.test b/bolt/test/re-optimize.test index 8bcac0c..38f3cf9 100644 --- a/bolt/test/re-optimize.test +++ b/bolt/test/re-optimize.test @@ -1,5 +1,9 @@ # Check that we detect re-optimization attempt. +# This test uses the clang driver without target flags and will only succeed +# on Linux systems where the host triple matches the target. +REQUIRES: system-linux + RUN: %clang %cflags %S/Inputs/icf-jump-tables.c -o %t.exe RUN: llvm-bolt %t.exe -o %t 2>&1 > /dev/null RUN: not llvm-bolt %t -o %t.bolt 2>&1 | FileCheck %s diff --git a/bolt/test/shared-object.test b/bolt/test/shared-object.test index a255357..361f4ea 100644 --- a/bolt/test/shared-object.test +++ b/bolt/test/shared-object.test @@ -1,4 +1,9 @@ # Test that llvm-bolt processes *.so without a failure + +# This test uses the clang driver without target flags and will only succeed +# on Linux systems where the host triple matches the target. +REQUIRES: system-linux + RUN: %clang %cflags %S/Inputs/icf-jump-tables.c -o %t.so -shared -fPIC -Wl,--build-id RUN: llvm-bolt %t.so -o %t | FileCheck %s -- 2.7.4