Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion llvm/utils/lit/lit/TestRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,9 @@ def on_rm_error(func, path, exc_info):
if force and not os.path.exists(path):
continue
try:
if os.path.isdir(path):
if os.path.islink(path):
os.remove(path)
elif os.path.isdir(path):
if not recursive:
stderr.write("Error: %s is a directory\n" % path)
exitCode = 1
Expand Down
7 changes: 7 additions & 0 deletions llvm/utils/lit/tests/Inputs/shtest-shell-symlinks/lit.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import lit.formats

config.name = "shtest-shell"
config.suffixes = [".txt"]
config.test_format = lit.formats.ShTest()
config.test_source_root = None
config.test_exec_root = None
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Check that we can delete a symlink to a folder without -r
#
# RUN: mkdir %t.dir
# RUN: ln -s %t.dir %t.symlink
# RUN: rm %t.symlink
9 changes: 9 additions & 0 deletions llvm/utils/lit/tests/shtest-shell-symlinks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Check that the internal shell builtins correctly handle cases involving
# symlinks.

# REQUIRES: symlinks
# RUN: echo test
# RUN: %{lit} -v %{inputs}/shtest-shell-symlinks | FileCheck %s

# CHECK: -- Testing: 1 test{{.*}}
# CHECK: PASS: shtest-shell :: rm-symlink-dir.txt
Loading