Tests: Don't remove a parent of $PWD

Solaris/OpenIndiana/Illumos `rm` checks that and errors out.

In these cases we don't actually need it to be a part of $PWD as
it's just for cleanup, so we `cd` out before.

See #5472
See 1ee57e92447781b5ff79aaa7c55f6468fc84a37d
Fixes #6555
Fixes #6558
This commit is contained in:
Fabian Homborg 2020-01-30 17:34:48 +01:00
parent cc7d9cc2ed
commit 9cbd3d57a0
2 changed files with 3 additions and 1 deletions

View File

@ -19,8 +19,8 @@ begin
cd x
pwd
end
rm -rf $tmp
cd $oldpwd
rm -rf $tmp
# Create a test directory to store our stuff.
# macOS likes to return symlinks from (mktemp -d), make sure it does not.

View File

@ -2,6 +2,7 @@
# Ensure that, if variable expansion results in multiple strings
# and one of them fails a glob, that we don't fail the entire expansion.
set -l oldpwd (pwd)
set dir (mktemp -d)
cd $dir
mkdir a
@ -12,4 +13,5 @@ set dirs ./a ./b
echo $dirs/*.txt
# CHECK: ./b/file.txt
cd $oldpwd
rm -Rf $dir