[clang] [CLANG][NFC] Modify test cases to suit assigned default sysroot path (PR #77075)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 10 19:24:17 PDT 2024
https://github.com/Yunzezhu94 updated https://github.com/llvm/llvm-project/pull/77075
>From e04fa94a98b71e729885b0544add053127180f7d Mon Sep 17 00:00:00 2001
From: Yunze Zhu <yunzezhu at linux.alibaba.com>
Date: Fri, 5 Jan 2024 17:11:26 +0800
Subject: [PATCH] [CLANG][NFC] Modify test cases to suit assigned default
sysroot path
When using cmake with option -DDEFAULT_SYSROOT, a default sysroot path is assigned.
However, some test cases use a relative path to indicate sysroot path,
but the path goes wrong with default sysroot path assigned.
This patch modified test cases to make them use correct sysroot path.
---
clang/test/Driver/baremetal.cpp | 10 +++++-----
clang/test/Driver/csky-toolchain.c | 4 ++--
clang/test/Driver/freebsd-include-paths.c | 4 ++--
clang/test/Driver/haiku.c | 2 +-
clang/test/Driver/hexagon-toolchain-linux.c | 2 ++
clang/test/Driver/riscv32-toolchain-extra.c | 1 +
clang/test/Driver/riscv64-toolchain-extra.c | 1 +
clang/test/Driver/solaris-ld.c | 2 +-
8 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/clang/test/Driver/baremetal.cpp b/clang/test/Driver/baremetal.cpp
index c04f4506a0994..03d0fbcc76fd1 100644
--- a/clang/test/Driver/baremetal.cpp
+++ b/clang/test/Driver/baremetal.cpp
@@ -157,7 +157,7 @@
// RUN: %clang -### %s --target=aarch64_be-none-elf -mlittle-endian --sysroot=%S/Inputs/baremetal_arm 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-AARCH64LE %s
-// RUN: %clang -no-canonical-prefixes %s -### --target=aarch64-none-elf 2>&1 \
+// RUN: %clang -no-canonical-prefixes %s -### --sysroot="" --target=aarch64-none-elf 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-AARCH64-NO-HOST-INC %s
// Verify that the bare metal driver does not include any host system paths:
// CHECK-AARCH64-NO-HOST-INC: InstalledDir: [[INSTALLEDDIR:.+]]
@@ -385,7 +385,7 @@
// CHECK-RV32IMAFC-SAME: "-L[[SYSROOT:[^"]+]]{{[/\\]+}}rv32imafc{{[/\\]+}}ilp32f{{[/\\]+}}lib"
// CHECK-RV32IMAFC-SAME: "-L[[RESOURCE_DIR:[^"]+]]{{[/\\]+}}lib{{[/\\]+}}baremetal{{[/\\]+}}rv32imafc{{[/\\]+}}ilp32f"
-// RUN: %clang -no-canonical-prefixes %s -### --target=powerpc-unknown-eabi 2>&1 \
+// RUN: %clang -no-canonical-prefixes %s -### --sysroot="" --target=powerpc-unknown-eabi 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PPCEABI %s
// CHECK-PPCEABI: InstalledDir: [[INSTALLEDDIR:.+]]
// CHECK-PPCEABI: "-nostdsysteminc"
@@ -398,7 +398,7 @@
// CHECK-PPCEABI-SAME: "-L[[RESOURCE]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
// CHECK-PPCEABI-SAME: "-lc" "-lm" "-lclang_rt.builtins-powerpc" "-o" "a.out"
-// RUN: %clang -no-canonical-prefixes %s -### --target=powerpc64-unknown-eabi 2>&1 \
+// RUN: %clang -no-canonical-prefixes %s -### --sysroot="" --target=powerpc64-unknown-eabi 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PPC64EABI %s
// CHECK-PPC64EABI: InstalledDir: [[INSTALLEDDIR:.+]]
// CHECK-PPC64EABI: "-nostdsysteminc"
@@ -411,7 +411,7 @@
// CHECK-PPC64EABI-SAME: "-L[[RESOURCE]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
// CHECK-PPC64EABI-SAME: "-lc" "-lm" "-lclang_rt.builtins-powerpc64" "-o" "a.out"
-// RUN: %clang -no-canonical-prefixes %s -### --target=powerpcle-unknown-eabi 2>&1 \
+// RUN: %clang -no-canonical-prefixes %s -### --sysroot="" --target=powerpcle-unknown-eabi 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PPCLEEABI %s
// CHECK-PPCLEEABI: InstalledDir: [[INSTALLEDDIR:.+]]
// CHECK-PPCLEEABI: "-nostdsysteminc"
@@ -424,7 +424,7 @@
// CHECK-PPCLEEABI-SAME: "-L[[RESOURCE]]{{[/\\]+}}lib{{[/\\]+}}baremetal"
// CHECK-PPCLEEABI-SAME: "-lc" "-lm" "-lclang_rt.builtins-powerpcle" "-o" "a.out"
-// RUN: %clang -no-canonical-prefixes %s -### --target=powerpc64le-unknown-eabi 2>&1 \
+// RUN: %clang -no-canonical-prefixes %s -### --sysroot="" --target=powerpc64le-unknown-eabi 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PPC64LEEABI %s
// CHECK-PPC64LEEABI: InstalledDir: [[INSTALLEDDIR:.+]]
// CHECK-PPC64LEEABI: "-nostdsysteminc"
diff --git a/clang/test/Driver/csky-toolchain.c b/clang/test/Driver/csky-toolchain.c
index 66485464652ac..557feeeb1d1d3 100644
--- a/clang/test/Driver/csky-toolchain.c
+++ b/clang/test/Driver/csky-toolchain.c
@@ -7,7 +7,7 @@
// In the below tests, --rtlib=platform is used so that the driver ignores
// the configure-time CLANG_DEFAULT_RTLIB option when choosing the runtime lib
-// RUN: %clang -### %s -fuse-ld=ld -no-pie --target=csky-unknown-linux-gnu --rtlib=platform --unwindlib=platform \
+// RUN: %clang -### %s -fuse-ld=ld -no-pie --target=csky-unknown-linux-gnu --rtlib=platform --sysroot="" --unwindlib=platform \
// RUN: --gcc-toolchain=%S/Inputs/multilib_csky_linux_sdk 2>&1 | FileCheck -check-prefix=C-CSKY-LINUX-MULTI %s
// C-CSKY-LINUX-MULTI: "{{.*}}/Inputs/multilib_csky_linux_sdk/lib/gcc/csky-linux-gnuabiv2/6.3.0/../../..{{/|\\\\}}..{{/|\\\\}}csky-linux-gnuabiv2/bin{{/|\\\\}}ld"
@@ -23,7 +23,7 @@
// C-CSKY-LINUX-MULTI: "-L{{.*}}/Inputs/multilib_csky_linux_sdk/lib/gcc/csky-linux-gnuabiv2/6.3.0/../../..{{/|\\\\}}..{{/|\\\\}}csky-linux-gnuabiv2/libc/lib"
// C-CSKY-LINUX-MULTI: "-L{{.*}}/Inputs/multilib_csky_linux_sdk/lib/gcc/csky-linux-gnuabiv2/6.3.0/../../..{{/|\\\\}}..{{/|\\\\}}csky-linux-gnuabiv2/libc/usr/lib"
-// RUN: %clang -### %s -fuse-ld=ld -fno-pic -no-pie --target=csky-unknown-linux-gnu --rtlib=platform --unwindlib=platform -march=ck860v \
+// RUN: %clang -### %s -fuse-ld=ld -fno-pic -no-pie --target=csky-unknown-linux-gnu --rtlib=platform --unwindlib=platform -march=ck860v --sysroot="" \
// RUN: --gcc-toolchain=%S/Inputs/multilib_csky_linux_sdk 2>&1 | FileCheck -check-prefix=C-CSKY-LINUX-CK860V %s
// C-CSKY-LINUX-CK860V: "{{.*}}/Inputs/multilib_csky_linux_sdk/lib/gcc/csky-linux-gnuabiv2/6.3.0/../../..{{/|\\\\}}..{{/|\\\\}}csky-linux-gnuabiv2/bin{{/|\\\\}}ld"
diff --git a/clang/test/Driver/freebsd-include-paths.c b/clang/test/Driver/freebsd-include-paths.c
index 872b2386ce9f1..1717db3640e34 100644
--- a/clang/test/Driver/freebsd-include-paths.c
+++ b/clang/test/Driver/freebsd-include-paths.c
@@ -1,14 +1,14 @@
// UNSUPPORTED: system-windows
// Check that the driver passes include paths to cc1 on FreeBSD.
-// RUN: %clang -### %s --target=x86_64-unknown-freebsd13.1 2>&1 \
+// RUN: %clang -### %s --target=x86_64-unknown-freebsd13.1 --sysroot="" 2>&1 \
// RUN: | FileCheck %s --check-prefix=DRIVER-PASS-INCLUDES
// DRIVER-PASS-INCLUDES: "-cc1" {{.*}}"-resource-dir" "[[RESOURCE:[^"]+]]"
// DRIVER-PASS-INCLUDES-SAME: "-internal-isystem" "[[RESOURCE]]/include"
// DRIVER-PASS-INCLUDES-SAME: {{^}} "-internal-externc-isystem" "/usr/include"
// Check that the driver passes include paths to cc1 on FreeBSD in C++ mode.
-// RUN: %clang -### -xc++ %s --target=x86_64-unknown-freebsd13.1 2>&1 \
+// RUN: %clang -### -xc++ %s --target=x86_64-unknown-freebsd13.1 --sysroot="" 2>&1 \
// RUN: | FileCheck %s --check-prefix=DRIVER-PASS-INCLUDES-CXX
// DRIVER-PASS-INCLUDES-CXX: "-cc1" {{.*}}"-resource-dir" "[[RESOURCE:[^"]+]]"
// DRIVER-PASS-INCLUDES-CXX-SAME: "-internal-isystem" "/usr/include/c++/v1"
diff --git a/clang/test/Driver/haiku.c b/clang/test/Driver/haiku.c
index e907c34b29b99..f7aab7856270d 100644
--- a/clang/test/Driver/haiku.c
+++ b/clang/test/Driver/haiku.c
@@ -1,7 +1,7 @@
// UNSUPPORTED: system-windows
// Check the C header paths
-// RUN: %clang --target=x86_64-unknown-haiku -### %s 2>&1 \
+// RUN: %clang --target=x86_64-unknown-haiku --sysroot="" -### %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-C-HEADER-PATH %s
// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/non-packaged/develop/headers"
// CHECK-C-HEADER-PATH: "-internal-isystem" "/boot/system/develop/headers/os"
diff --git a/clang/test/Driver/hexagon-toolchain-linux.c b/clang/test/Driver/hexagon-toolchain-linux.c
index fe32638417ea4..e4c00cf9c30c9 100644
--- a/clang/test/Driver/hexagon-toolchain-linux.c
+++ b/clang/test/Driver/hexagon-toolchain-linux.c
@@ -96,6 +96,7 @@
// -----------------------------------------------------------------------------
// RUN: %clang -### --target=hexagon-unknown-linux-musl \
// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
+// RUN: --sysroot="" \
// RUN: -resource-dir=%S/Inputs/resource_dir %s 2>&1 | FileCheck -check-prefix=CHECK008 %s
// CHECK008: InstalledDir: [[INSTALLED_DIR:.+]]
// CHECK008: "-resource-dir" "[[RESOURCE:[^"]+]]"
@@ -104,6 +105,7 @@
// RUN: %clang -### --target=hexagon-unknown-linux \
// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
+// RUN: --sysroot="" \
// RUN: -resource-dir=%S/Inputs/resource_dir %s 2>&1 | FileCheck -check-prefix=CHECK009 %s
// CHECK009: InstalledDir: [[INSTALLED_DIR:.+]]
// CHECK009: "-resource-dir" "[[RESOURCE:[^"]+]]"
diff --git a/clang/test/Driver/riscv32-toolchain-extra.c b/clang/test/Driver/riscv32-toolchain-extra.c
index 2d38aa3b545fe..d5b70bf6a0dcf 100644
--- a/clang/test/Driver/riscv32-toolchain-extra.c
+++ b/clang/test/Driver/riscv32-toolchain-extra.c
@@ -17,6 +17,7 @@
// RUN: ln -s %S/Inputs/basic_riscv32_nogcc_tree/bin/riscv32-unknown-elf-ld %t/riscv32-nogcc/bin/riscv32-unknown-elf-ld
// RUN: ln -s %S/Inputs/basic_riscv32_nogcc_tree/riscv32-unknown-elf %t/riscv32-nogcc/riscv32-unknown-elf
// RUN: %t/riscv32-nogcc/bin/clang %s -### -no-canonical-prefixes \
+// RUN: --sysroot="" \
// RUN: --gcc-toolchain=%t/riscv32-nogcc/invalid \
// RUN: --target=riscv32-unknown-elf --rtlib=platform -fuse-ld= 2>&1 \
// RUN: | FileCheck -check-prefix=C-RV32-BAREMETAL-ILP32-NOGCC %s
diff --git a/clang/test/Driver/riscv64-toolchain-extra.c b/clang/test/Driver/riscv64-toolchain-extra.c
index a6ec9b16cc5ca..822c069369a3b 100644
--- a/clang/test/Driver/riscv64-toolchain-extra.c
+++ b/clang/test/Driver/riscv64-toolchain-extra.c
@@ -17,6 +17,7 @@
// RUN: ln -s %S/Inputs/basic_riscv64_nogcc_tree/bin/riscv64-unknown-elf-ld %t/riscv64-nogcc/bin/riscv64-unknown-elf-ld
// RUN: ln -s %S/Inputs/basic_riscv64_nogcc_tree/riscv64-unknown-elf %t/riscv64-nogcc/riscv64-unknown-elf
// RUN: %t/riscv64-nogcc/bin/clang %s -### -no-canonical-prefixes \
+// RUN: --sysroot="" \
// RUN: --gcc-toolchain=%t/riscv64-nogcc/invalid \
// RUN: --target=riscv64-unknown-elf --rtlib=platform -fuse-ld= 2>&1 \
// RUN: | FileCheck -check-prefix=C-RV64-BAREMETAL-LP64-NOGCC %s
diff --git a/clang/test/Driver/solaris-ld.c b/clang/test/Driver/solaris-ld.c
index df4fa7b4c9ebd..e83cad33daf35 100644
--- a/clang/test/Driver/solaris-ld.c
+++ b/clang/test/Driver/solaris-ld.c
@@ -173,7 +173,7 @@
// CHECK-NOPIE-GLD-NOT: "-pie"
// -r suppresses default -l and crt*.o, values-*.o like -nostdlib.
-// RUN: %clang -### %s --target=sparc-sun-solaris2.11 -r 2>&1 \
+// RUN: %clang -### %s --target=sparc-sun-solaris2.11 --sysroot="" -r 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECK-RELOCATABLE
// CHECK-RELOCATABLE: "-L
// CHECK-RELOCATABLE: "-r"
More information about the cfe-commits
mailing list