luismarques created this revision.
luismarques added reviewers: edward-jones, lenary.
Herald added subscribers: cfe-commits, evandro, apazos, sameer.abuasal, pzheng, 
s.egerton, Jim, benna, psnobl, jocewei, PkmX, rkruppe, the_o, brucehoult, 
MartinMosbeck, rogfer01, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, 
sabuasal, simoncook, johnrusso, rbar, asb.
Herald added a project: clang.

D68391 <https://reviews.llvm.org/D68391> added tests that check scenarios where 
no RISC-V GCC toolchain is supposed to be detected. When running the tests on 
RISC-V hosts the system's GCC toolchain will be detected, and the tests will 
fail. This patch adds a `--gcc-toolchain` option pointing to a path where no 
GCC toolchain is present, ensuring that the tests are run under the expected 
conditions, and therefore are able to pass in all test environments.

(I had also explored the option of checking if the found GCC toolchain actually 
matched the exact requested triple, but there seems to be no good way of doing 
that, and the test would still fail if such an exact match happened to be found 
anyway).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75061

Files:
  clang/test/Driver/riscv32-toolchain-extra.c
  clang/test/Driver/riscv64-toolchain-extra.c


Index: clang/test/Driver/riscv64-toolchain-extra.c
===================================================================
--- clang/test/Driver/riscv64-toolchain-extra.c
+++ clang/test/Driver/riscv64-toolchain-extra.c
@@ -19,6 +19,7 @@
 // RUN: ln -s %S/Inputs/basic_riscv64_nogcc_tree/bin/riscv64-unknown-elf-ld 
%T/testroot-riscv64-baremetal-nogcc/bin/riscv64-unknown-elf-ld
 // RUN: ln -s %S/Inputs/basic_riscv64_nogcc_tree/riscv64-unknown-elf 
%T/testroot-riscv64-baremetal-nogcc/riscv64-unknown-elf
 // RUN: %T/testroot-riscv64-baremetal-nogcc/bin/clang %s -### 
-no-canonical-prefixes \
+// RUN:    --gcc-toolchain=%T/testroot-riscv64-baremetal-nogcc/invalid \
 // RUN:    -target riscv64-unknown-elf --rtlib=platform 2>&1 \
 // RUN:    | FileCheck -check-prefix=C-RV64-BAREMETAL-LP64-NOGCC %s
 
Index: clang/test/Driver/riscv32-toolchain-extra.c
===================================================================
--- clang/test/Driver/riscv32-toolchain-extra.c
+++ clang/test/Driver/riscv32-toolchain-extra.c
@@ -19,6 +19,7 @@
 // RUN: ln -s %S/Inputs/basic_riscv32_nogcc_tree/bin/riscv32-unknown-elf-ld 
%T/testroot-riscv32-baremetal-nogcc/bin/riscv32-unknown-elf-ld
 // RUN: ln -s %S/Inputs/basic_riscv32_nogcc_tree/riscv32-unknown-elf 
%T/testroot-riscv32-baremetal-nogcc/riscv32-unknown-elf
 // RUN: %T/testroot-riscv32-baremetal-nogcc/bin/clang %s -### 
-no-canonical-prefixes \
+// RUN:    --gcc-toolchain=%T/testroot-riscv32-baremetal-nogcc/invalid \
 // RUN:    -target riscv32-unknown-elf --rtlib=platform 2>&1 \
 // RUN:    | FileCheck -check-prefix=C-RV32-BAREMETAL-ILP32-NOGCC %s
 


Index: clang/test/Driver/riscv64-toolchain-extra.c
===================================================================
--- clang/test/Driver/riscv64-toolchain-extra.c
+++ clang/test/Driver/riscv64-toolchain-extra.c
@@ -19,6 +19,7 @@
 // RUN: ln -s %S/Inputs/basic_riscv64_nogcc_tree/bin/riscv64-unknown-elf-ld %T/testroot-riscv64-baremetal-nogcc/bin/riscv64-unknown-elf-ld
 // RUN: ln -s %S/Inputs/basic_riscv64_nogcc_tree/riscv64-unknown-elf %T/testroot-riscv64-baremetal-nogcc/riscv64-unknown-elf
 // RUN: %T/testroot-riscv64-baremetal-nogcc/bin/clang %s -### -no-canonical-prefixes \
+// RUN:    --gcc-toolchain=%T/testroot-riscv64-baremetal-nogcc/invalid \
 // RUN:    -target riscv64-unknown-elf --rtlib=platform 2>&1 \
 // RUN:    | FileCheck -check-prefix=C-RV64-BAREMETAL-LP64-NOGCC %s
 
Index: clang/test/Driver/riscv32-toolchain-extra.c
===================================================================
--- clang/test/Driver/riscv32-toolchain-extra.c
+++ clang/test/Driver/riscv32-toolchain-extra.c
@@ -19,6 +19,7 @@
 // RUN: ln -s %S/Inputs/basic_riscv32_nogcc_tree/bin/riscv32-unknown-elf-ld %T/testroot-riscv32-baremetal-nogcc/bin/riscv32-unknown-elf-ld
 // RUN: ln -s %S/Inputs/basic_riscv32_nogcc_tree/riscv32-unknown-elf %T/testroot-riscv32-baremetal-nogcc/riscv32-unknown-elf
 // RUN: %T/testroot-riscv32-baremetal-nogcc/bin/clang %s -### -no-canonical-prefixes \
+// RUN:    --gcc-toolchain=%T/testroot-riscv32-baremetal-nogcc/invalid \
 // RUN:    -target riscv32-unknown-elf --rtlib=platform 2>&1 \
 // RUN:    | FileCheck -check-prefix=C-RV32-BAREMETAL-ILP32-NOGCC %s
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to