[clang] 841ff7c - [Driver][test] Clean up some xray tests

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 24 10:05:38 PDT 2023


Author: Fangrui Song
Date: 2023-07-24T10:05:34-07:00
New Revision: 841ff7c6ca4c6fa9ff3ac6ba93e177462b7d668e

URL: https://github.com/llvm/llvm-project/commit/841ff7c6ca4c6fa9ff3ac6ba93e177462b7d668e
DIFF: https://github.com/llvm/llvm-project/commit/841ff7c6ca4c6fa9ff3ac6ba93e177462b7d668e.diff

LOG: [Driver][test] Clean up some xray tests

Add explicit --target= so that the tests run on all targets, not some
that support XRay, similar to commit e1051414a16e970c2e36c2ab7dfe2b17353c4751.
For option testing, we often use a placeholder architecture (e.g., x86_64).

Fix https://github.com/llvm/llvm-project/issues/64028

Added: 
    

Modified: 
    clang/test/Driver/XRay/xray-ignore-loops-flags.cpp
    clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
    clang/test/Driver/XRay/xray-mode-flags.cpp
    clang/test/Driver/XRay/xray-nolinkdeps.cpp

Removed: 
    clang/test/Driver/XRay/xray-shared-noxray.cpp


################################################################################
diff  --git a/clang/test/Driver/XRay/xray-ignore-loops-flags.cpp b/clang/test/Driver/XRay/xray-ignore-loops-flags.cpp
index 2c6ddb8b529764..3dcd802af8c2cc 100644
--- a/clang/test/Driver/XRay/xray-ignore-loops-flags.cpp
+++ b/clang/test/Driver/XRay/xray-ignore-loops-flags.cpp
@@ -2,8 +2,5 @@
 // options include the -fxray-ignore-loops flag we provide in the
 // invocation.
 //
-// RUN: %clang -fxray-instrument -fxray-ignore-loops -target x86_64-linux- -### \
-// RUN:   -x c++ -emit-llvm -c -o - %s 2>&1 | FileCheck %s
+// RUN: %clang -### -c --target=x86_64 -fxray-ignore-loops %s 2>&1 | FileCheck %s
 // CHECK:  -fxray-ignore-loops
-//
-// REQUIRES: x86_64 || x86_64h

diff  --git a/clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp b/clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
index 4d311cc7d86c1a..0139277c1e3e56 100644
--- a/clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
+++ b/clang/test/Driver/XRay/xray-instrumentation-bundles-flags.cpp
@@ -2,9 +2,5 @@
 // options include the -fxray-instrumentation-bundle= flag we provide in the
 // invocation.
 //
-// RUN: %clang -fxray-instrument -fxray-instrumentation-bundle=function -### \
-// RUN:   -c -o - %s 2>&1 | FileCheck %s
-// CHECK:  -fxray-instrumentation-bundle=function
-//
-// REQUIRES: linux || freebsd
-// REQUIRES: amd64 || x86_64 || x86_64h || arm || aarch64 || arm64
+// RUN: %clang -### -c --target=aarch64 -fxray-instrument -fxray-instrumentation-bundle=function %s 2>&1 | FileCheck %s
+// CHECK:  "-fxray-instrumentation-bundle=function"

diff  --git a/clang/test/Driver/XRay/xray-mode-flags.cpp b/clang/test/Driver/XRay/xray-mode-flags.cpp
index e95053a4c684aa..cfcf42f30e6271 100644
--- a/clang/test/Driver/XRay/xray-mode-flags.cpp
+++ b/clang/test/Driver/XRay/xray-mode-flags.cpp
@@ -1,49 +1,31 @@
-// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=xray-fdr %s -### \
-// RUN:     2>&1 | FileCheck --check-prefix FDR %s
-// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=xray-basic %s \
-// RUN:     -### 2>&1 | FileCheck --check-prefix BASIC %s
-// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=all -### %s \
-// RUN:     2>&1 | FileCheck --check-prefixes FDR,BASIC %s
-// RUN: %clang -v -o /dev/null -fxray-instrument \
-// RUN:     -fxray-modes=xray-fdr,xray-basic -### %s 2>&1 | \
-// RUN:     FileCheck --check-prefixes FDR,BASIC %s
-// RUN: %clang -v -o /dev/null -fxray-instrument \
-// RUN:     -fxray-modes=xray-fdr -fxray-modes=xray-basic -### %s 2>&1 | \
-// RUN:     FileCheck --check-prefixes FDR,BASIC %s
-// RUN: %clang -v -o /dev/null -fxray-instrument -### %s \
-// RUN:     2>&1 | FileCheck --check-prefixes FDR,BASIC %s
-// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=none -### %s \
-// RUN:     2>&1 | FileCheck --check-prefixes NONE %s
+// RUN: %clang -### --target=x86_64-linux-gnu -fxray-instrument -fxray-modes=xray-fdr %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=FDR %s
+// RUN: %clang -### --target=aarch64-linux-gnu -fxray-instrument -fxray-modes=xray-basic %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=BASIC %s
+// RUN: %clang -### --target=aarch64-linux-gnu -fxray-instrument %s 2>&1 \
+// RUN:   | FileCheck --check-prefixes=FDR,BASIC %s
+// RUN: %clang -### --target=x86_64-linux-gnu -fxray-instrument -fxray-modes=all %s 2>&1 \
+// RUN:   | FileCheck --check-prefixes=FDR,BASIC %s
+// RUN: %clang -### --target=x86_64-linux-gnu -fxray-instrument -fxray-modes=xray-fdr,xray-basic %s 2>&1 \
+// RUN:   | FileCheck --check-prefixes=FDR,BASIC %s
+// RUN: %clang -### --target=x86_64-linux-gnu -fxray-instrument -fxray-modes=xray-fdr -fxray-modes=xray-basic %s 2>&1 \
+// RUN:   | FileCheck --check-prefixes=FDR,BASIC %s
+// RUN: %clang -### --target=x86_64-linux-gnu -fxray-instrument -fxray-modes=none %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=NONE %s
 //
 // We also should support overriding the modes in an additive manner.
-//
-// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=none,xray-fdr \
-// RUN:     -### %s \
-// RUN:     2>&1 | FileCheck --check-prefixes FDR %s
-// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=xray-fdr,none \
-// RUN:     -### %s \
-// RUN:     2>&1 | FileCheck --check-prefixes NONE %s
-// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=none,all \
-// RUN:     -### %s \
-// RUN:     2>&1 | FileCheck --check-prefixes FDR,BASIC %s
-//
+
+// RUN: %clang -### --target=x86_64-linux-gnu -fxray-instrument -fxray-modes=none,xray-fdr %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=FDR %s
+// RUN: %clang -### --target=x86_64-linux-gnu -fxray-instrument -fxray-modes=all,none %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=NONE %s
+
 // We also should support having the individual modes be concatenated.
-//
-// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=none \
-// RUN:     -fxray-modes=xray-fdr \
-// RUN:     -### %s \
-// RUN:     2>&1 | FileCheck --check-prefixes FDR %s
-//
-// Order also matters.
-//
-// RUN: %clang -v -o /dev/null -fxray-instrument -fxray-modes=xray-fdr \
-// RUN:     -fxray-modes=none \
-// RUN:     -### %s \
-// RUN:     2>&1 | FileCheck --check-prefixes NONE %s
+
+// RUN: %clang -### --target=x86_64-linux-gnu -fxray-instrument -fxray-modes=none -fxray-modes=xray-fdr %s 2>&1 \
+// RUN:   | FileCheck --check-prefix=FDR %s
 
 // BASIC: libclang_rt.xray-basic
 // FDR: libclang_rt.xray-fdr
 // NONE-NOT: libclang_rt.xray-basic
 // NONE-NOT: libclang_rt.xray-fdr
-// REQUIRES: linux || freebsd
-// REQUIRES: amd64 || x86_64 || x86_64h || arm || aarch64 || arm64

diff  --git a/clang/test/Driver/XRay/xray-nolinkdeps.cpp b/clang/test/Driver/XRay/xray-nolinkdeps.cpp
index 0c42c1af4f9264..3e6aab61673bd1 100644
--- a/clang/test/Driver/XRay/xray-nolinkdeps.cpp
+++ b/clang/test/Driver/XRay/xray-nolinkdeps.cpp
@@ -2,5 +2,7 @@
 // RUN:     2>&1 | FileCheck --check-prefix DISABLE %s
 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -fxray-instrument %s \
 // RUN:     2>&1 | FileCheck --check-prefix ENABLE %s
+// RUN: %clang -### --target=x86_64-unknown-linux-gnu -shared -fxray-instrument %s \
+// RUN:     2>&1 | FileCheck --check-prefix DISABLE %s
 // ENABLE:      "--whole-archive" "{{.*}}clang_rt.xray{{.*}}"--no-whole-archive"
 // DISABLE-NOT: clang_rt.xray

diff  --git a/clang/test/Driver/XRay/xray-shared-noxray.cpp b/clang/test/Driver/XRay/xray-shared-noxray.cpp
deleted file mode 100644
index c279f93f3f3d84..00000000000000
--- a/clang/test/Driver/XRay/xray-shared-noxray.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-// RUN: %clangxx -shared -o /dev/null -v -fxray-instrument %s -###
-// RUN: %clangxx -shared -o /dev/null -v -fxray-instrument %s -### 2>&1 | \
-// RUN:     FileCheck %s --check-prefix=SHARED
-// RUN: %clangxx -static -o /dev/null -v -fxray-instrument %s -### -DMAIN
-// RUN: %clangxx -static -o /dev/null -v -fxray-instrument %s -### 2>&1 -DMAIN \
-// RUN:     | FileCheck %s --check-prefix=STATIC
-//
-// SHARED-NOT: {{clang_rt\.xray-}}
-// STATIC: {{clang_rt\.xray-}}
-//
-// REQUIRES: linux, enable_shared
-int foo() { return 42; }
-
-#ifdef MAIN
-int main() { return foo(); }
-#endif


        


More information about the cfe-commits mailing list