r334972 - Don't let test/Driver/no-canonical-prefixes.c form a symlink cycle the second time it runs.

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 18 11:50:35 PDT 2018


Author: nico
Date: Mon Jun 18 11:50:35 2018
New Revision: 334972

URL: http://llvm.org/viewvc/llvm-project?rev=334972&view=rev
Log:
Don't let test/Driver/no-canonical-prefixes.c form a symlink cycle the second time it runs.

The test makes %t.fake a symlink to %t.real by running `ln -sf %t.real
%t.fake`. If %t.fake already is a symlink to %t.real when this runs (e.g. if
the test has run before), then this effectively becomes `ln -sf %t.real %t.real`,
symlinking the directory to itself. At least on my mac, this leads to the
directory containing itself.

As fix, just remove %t.fake before creating the symlink. To clean up build dirs
on bots, also remove %t.real for a while.

https://reviews.llvm.org/D48224

Modified:
    cfe/trunk/test/Driver/no-canonical-prefixes.c

Modified: cfe/trunk/test/Driver/no-canonical-prefixes.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/no-canonical-prefixes.c?rev=334972&r1=334971&r2=334972&view=diff
==============================================================================
--- cfe/trunk/test/Driver/no-canonical-prefixes.c (original)
+++ cfe/trunk/test/Driver/no-canonical-prefixes.c Mon Jun 18 11:50:35 2018
@@ -1,9 +1,14 @@
 // 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




More information about the cfe-commits mailing list