// Due to ln -sf:
// REQUIRES: shell
// RUN: mkdir -p %t.real
// RUN: cd %t.real
// RUN: ln -sf %clang test-clang
// RUN: cd ..
// If %.fake already is a symlink to %t.real when `ln -sf %t.real %t.fake`
// runs, then that would symlink %t.real to itself, forming a cycle.
// The `-n` flag prevents this.
// RUN: ln -sfn %t.real %t.fake
// RUN: cd %t.fake
// RUN: ./test-clang -v -S %s 2>&1 | FileCheck --check-prefix=CANONICAL %s
// RUN: ./test-clang -v -S %s -no-canonical-prefixes 2>&1 | FileCheck --check-prefix=NON-CANONICAL %s
//
// FIXME: This should really be '.real'.
// CANONICAL: InstalledDir: {{.*}}.fake
// CANONICAL: {{[/|\\]*}}clang{{.*}}" -cc1
//
// NON-CANONICAL: InstalledDir: .{{$}}
// NON-CANONICAL: test-clang" -cc1

// Due to ln -sf:
// REQUIRES: shell
// RUN: rm -rf %t.real
// RUN: mkdir -p %t.real
// RUN: cd %t.real
// RUN: ln -sf %clang test-clang
// RUN: cd ..
// Important to remove %t.fake: If it already is a symlink to %t.real when
// `ln -sf %t.real %t.fake` runs, then that would symlink %t.real to itself,
// forming a cycle.
// RUN: rm -rf %t.fake
// RUN: ln -sf %t.real %t.fake
// RUN: cd %t.fake
// RUN: ./test-clang -v -S %s 2>&1 | FileCheck --check-prefix=CANONICAL %s
// RUN: ./test-clang -v -S %s -no-canonical-prefixes 2>&1 | FileCheck --check-prefix=NON-CANONICAL %s
//
// FIXME: This should really be '.real'.
// CANONICAL: InstalledDir: {{.*}}.fake
// CANONICAL: {{[/|\\]*}}clang{{.*}}" -cc1
//
// NON-CANONICAL: InstalledDir: .{{$}}
// NON-CANONICAL: test-clang" -cc1

--- 
+++ 
@@ -1,15 +1,13 @@
 // Due to ln -sf:
 // REQUIRES: shell
-// RUN: rm -rf %t.real
 // RUN: mkdir -p %t.real
 // RUN: cd %t.real
 // RUN: ln -sf %clang test-clang
 // RUN: cd ..
-// Important to remove %t.fake: If it already is a symlink to %t.real when
-// `ln -sf %t.real %t.fake` runs, then that would symlink %t.real to itself,
-// forming a cycle.
-// RUN: rm -rf %t.fake
-// RUN: ln -sf %t.real %t.fake
+// If %.fake already is a symlink to %t.real when `ln -sf %t.real %t.fake`
+// runs, then that would symlink %t.real to itself, forming a cycle.
+// The `-n` flag prevents this.
+// RUN: ln -sfn %t.real %t.fake
 // RUN: cd %t.fake
 // RUN: ./test-clang -v -S %s 2>&1 | FileCheck --check-prefix=CANONICAL %s
 // RUN: ./test-clang -v -S %s -no-canonical-prefixes 2>&1 | FileCheck --check-prefix=NON-CANONICAL %s
Use `ln -n` to prevent forming a symlink cycle, instead of rm'ing the source

This is a better fix for the problem fixed in r334972.

Also remove the rm'ing of the symlink destination that was there to
clean up the bots -- it's over a year later, bots should be happy now.

Differential Revision: https://reviews.llvm.org/D64301

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@365414 91177308-0d34-0410-b5e6-96231b3b80d8
