From 788f359cda72b012c091580f3f20a391fd12cf06 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 25 Jan 2020 12:59:18 -0800 Subject: [PATCH] Make the cd check more robust on macOS macOS `mktemp -d` likes to return symlinks. Guard against that possibility. That allows the test to succeed when run directly, instead of through the build target. --- tests/checks/cd.fish | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/checks/cd.fish b/tests/checks/cd.fish index 3232e11f1..07d3d0a92 100644 --- a/tests/checks/cd.fish +++ b/tests/checks/cd.fish @@ -23,10 +23,9 @@ rm -rf $tmp cd $oldpwd # Create a test directory to store our stuff. -set -l base /tmp/cdcomp_test -rm -Rf $base -mkdir -p $base -set real (mktemp -d) +# macOS likes to return symlinks from (mktemp -d), make sure it does not. +set -l base (realpath (mktemp -d)) +set real (realpath (mktemp -d)) set link $base/link ln -s $real $link cd $link @@ -83,7 +82,7 @@ ln -s $base/realhome $base/linkhome cd $base/linkhome set -l real_getcwd (pwd -P) env HOME=$base/linkhome $fish -c 'echo PWD is $PWD' -#CHECK: PWD is /tmp/cdcomp_test/linkhome +#CHECK: PWD is {{.*}}/linkhome # Do not inherit a virtual PWD that fails to resolve to getcwd (#5647)