clang: Make tests using symlinks more consistent.

Instead of checking if each symlink exists before removing it,
remove the whole temp dir housing the symlinks before recreating it.
This is a bit shorter, conceptually simpler (in that the first
and consecutive test runs have more similar behavior), it's what we're
already doing in almost all places where we do it, and it works if the
symlink exists but is a dead link (e.g. when it points into the build
dir but the build dir is renamed).

No intended behavior change.
This commit is contained in:
Nico Weber 2020-04-05 12:54:27 -04:00
parent a58c8a7866
commit ccabe93298
5 changed files with 8 additions and 16 deletions

View File

@ -16,8 +16,8 @@
//--- Invocation qqq-clang-g++ tries to find config file qqq-clang-g++.cfg first.
//
// RUN: rm -rf %T/testdmode
// RUN: mkdir -p %T/testdmode
// RUN: [ ! -s %T/testdmode/qqq-clang-g++ ] || rm %T/testdmode/qqq-clang-g++
// RUN: ln -s %clang %T/testdmode/qqq-clang-g++
// RUN: echo "-Wundefined-func-template" > %T/testdmode/qqq-clang-g++.cfg
// RUN: echo "-Werror" > %T/testdmode/qqq.cfg
@ -53,8 +53,8 @@
//--- Config files are searched for in binary directory as well.
//
// RUN: rm -rf %T/testbin
// RUN: mkdir -p %T/testbin
// RUN: [ ! -s %T/testbin/clang ] || rm %T/testbin/clang
// RUN: ln -s %clang %T/testbin/clang
// RUN: echo "-Werror" > %T/testbin/aaa.cfg
// RUN: %T/testbin/clang --config-system-dir= --config-user-dir= --config aaa.cfg -c -no-canonical-prefixes %s -### 2>&1 | FileCheck %s -check-prefix CHECK-BIN
@ -68,8 +68,8 @@
//--- When reloading config file, x86_64-clang-g++ tries to find config i386-clang-g++.cfg first.
//
// RUN: rm -rf %T/testreload
// RUN: mkdir -p %T/testreload
// RUN: [ ! -s %T/testreload/x86_64-clang-g++ ] || rm %T/testreload/x86_64-clang-g++
// RUN: ln -s %clang %T/testreload/x86_64-clang-g++
// RUN: echo "-Wundefined-func-template" > %T/testreload/i386-clang-g++.cfg
// RUN: echo "-Werror" > %T/testreload/i386.cfg

View File

@ -1,19 +1,15 @@
// REQUIRES: shell
// UNSUPPORTED: system-windows
// RUN: rm -rf %T/testroot-gcc/bin
// RUN: mkdir -p %T/testroot-gcc/bin
// RUN: [ ! -s %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc ] || rm %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc
// RUN: [ ! -s %T/testroot-gcc/bin/x86_64-w64-mingw32-clang ] || rm %T/testroot-gcc/bin/x86_64-w64-mingw32-clang
// RUN: [ ! -s %T/testroot-gcc/x86_64-w64-mingw32 ] || rm %T/testroot-gcc/x86_64-w64-mingw32
// RUN: [ ! -s %T/testroot-gcc/lib ] || rm %T/testroot-gcc/lib
// RUN: ln -s %clang %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc
// RUN: ln -s %clang %T/testroot-gcc/bin/x86_64-w64-mingw32-clang
// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32 %T/testroot-gcc/x86_64-w64-mingw32
// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/lib %T/testroot-gcc/lib
// RUN: rm -rf %T/testroot-clang/bin
// RUN: mkdir -p %T/testroot-clang/bin
// RUN: [ ! -s %T/testroot-clang/bin/x86_64-w64-mingw32-clang ] || rm %T/testroot-clang/bin/x86_64-w64-mingw32-clang
// RUN: [ ! -s %T/testroot-clang/x86_64-w64-mingw32 ] || rm %T/testroot-clang/x86_64-w64-mingw32
// RUN: ln -s %clang %T/testroot-clang/bin/x86_64-w64-mingw32-clang
// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32 %T/testroot-clang/x86_64-w64-mingw32

View File

@ -12,10 +12,8 @@
// runtime if and only if they exist.
//
// REQUIRES: platform-linker
// RUN: rm -rf %T/testroot-riscv32-baremetal-nogcc/bin
// RUN: mkdir -p %T/testroot-riscv32-baremetal-nogcc/bin
// RUN: [ ! -s %T/testroot-riscv32-baremetal-nogcc/bin/clang ] || rm %T/testroot-riscv32-baremetal-nogcc/bin/clang
// RUN: [ ! -s %T/testroot-riscv32-baremetal-nogcc/bin/riscv32-unknown-elf-ld ] || rm %T/testroot-riscv32-baremetal-nogcc/bin/riscv32-unknown-elf-ld
// RUN: [ ! -s %T/testroot-riscv32-baremetal-nogcc/riscv32-unknown-elf ] || rm %T/testroot-riscv32-baremetal-nogcc/riscv32-unknown-elf
// RUN: ln -s %clang %T/testroot-riscv32-baremetal-nogcc/bin/clang
// 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

View File

@ -12,10 +12,8 @@
// runtime if and only if they exist.
//
// REQUIRES: platform-linker
// RUN: rm -rf %T/testroot-riscv64-baremetal-nogcc/bin
// RUN: mkdir -p %T/testroot-riscv64-baremetal-nogcc/bin
// RUN: [ ! -s %T/testroot-riscv64-baremetal-nogcc/bin/clang ] || rm %T/testroot-riscv64-baremetal-nogcc/bin/clang
// RUN: [ ! -s %T/testroot-riscv64-baremetal-nogcc/bin/riscv64-unknown-elf-ld ] || rm %T/testroot-riscv64-baremetal-nogcc/bin/riscv64-unknown-elf-ld
// RUN: [ ! -s %T/testroot-riscv64-baremetal-nogcc/riscv64-unknown-elf ] || rm %T/testroot-riscv64-baremetal-nogcc/riscv64-unknown-elf
// RUN: ln -s %clang %T/testroot-riscv64-baremetal-nogcc/bin/clang
// 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

View File

@ -1,8 +1,8 @@
// REQUIRES: shell
// REQUIRES: x86-registered-target
// RUN: rm -rf %T/testbin
// RUN: mkdir -p %T/testbin
// RUN: [ ! -s %T/testbin/i386-clang ] || rm %T/testbin/i386-clang
// RUN: ln -s %clang %T/testbin/i386-clang
// Check if invocation of "foo-clang" adds option "-target foo".