commit 31802ca8533d2641e1446791b5f24ec1adb29ad0
parent 68bafea40e2d99aaadae4e60e8d66af863446792
Author: Kyle Milz <kyle@0x30.net>
Date: Mon, 29 Aug 2016 18:32:20 -0600
t: save and restore PATH in inst_path
Diffstat:
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/t/inst_path.sh b/t/inst_path.sh
@@ -7,9 +7,8 @@
. test/utils.sh
plan 3
-diff=`which diff`
-alias sed=`which sed`
-alias expr=`which expr`
+# Save the PATH to restore later.
+OLDPATH="${PATH}"
cat <<EOF > citrun.log.good
citrun-inst 0.0 () ''
@@ -21,6 +20,9 @@ PATH=''
'' not in PATH.
EOF
+# Hang onto an absolute reference to 'expr' for libtap.sh
+alias expr=`which expr`
+
unset PATH
ok_program "run citrun-inst as cc with no PATH" 1 "" \
$CITRUN_TOOLS/cc -c nomatter.c
@@ -29,9 +31,8 @@ export PATH=""
ok_program "run citrun-inst as cc with empty PATH" 1 "" \
$CITRUN_TOOLS/cc -c nomatter.c 2> /dev/null
-sed -e "s,^.*: ,," \
- -e "s,'.*',''," \
- -e "s,(.*),()," \
- < citrun.log > citrun.log.proc
+# Restore the path so the commands below work.
+PATH="${OLDPATH}"
-ok "citrun.log diff" $diff -u citrun.log.good citrun.log.proc
+strip_log citrun.log
+ok "citrun.log diff" diff -u citrun.log.good citrun.log.stripped