summaryrefslogtreecommitdiff
path: root/test.sh
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-04-22 10:48:52 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-04-22 10:48:52 -0700
commit47fbf56ec1d01b359138664ec7e7634c1013b37d (patch)
treef8e01ef0974ed3ff6dcbeae41361892a7554c797 /test.sh
parenteb969cfa7e610a74586bcee318db9f473358c7a0 (diff)
parente0ef9caac8fdea7c1d39e403f24e7a6d85479371 (diff)
downloadrust-installer-47fbf56ec1d01b359138664ec7e7634c1013b37d.tar.gz
Merge pull request #32 from brson/next
Don't break when CDPATH is set. Fixes #31
Diffstat (limited to 'test.sh')
-rwxr-xr-xtest.sh28
1 files changed, 26 insertions, 2 deletions
diff --git a/test.sh b/test.sh
index 4cab6f6..f51aec1 100755
--- a/test.sh
+++ b/test.sh
@@ -8,7 +8,15 @@ else
ECHO='echo'
fi
-S="$(cd $(dirname $0) && pwd)"
+# Prints the absolute path of a directory to stdout
+abs_path() {
+ local path="$1"
+ # Unset CDPATH because it causes havok: it makes the destination unpredictable
+ # and triggers 'cd' to print the path to stdout.
+ (unset CDPATH && cd "$path" && pwd)
+}
+
+S="$(abs_path $(dirname $0))"
TEST_DIR="$S/test"
TMP_DIR="$S/tmp"
@@ -1343,7 +1351,23 @@ help() {
}
runtest help
-# TODO: mandir/libdir/bindir, etc.
+# https://github.com/rust-lang/rust-installer/issues/31
+CDPATH_does_not_destroy_things() {
+ try sh "$S/gen-installer.sh" \
+ --image-dir="$TEST_DIR/image1" \
+ --work-dir="$WORK_DIR" \
+ --output-dir="$OUT_DIR"
+ cd "$WORK_DIR" || exit 1
+ export CDPATH="../$(basename $WORK_DIR)/foo"
+ try sh "package/install.sh" --prefix="$PREFIX_DIR"
+ cd "$S" || exit 1
+ cd "$PREFIX_DIR" || exit 1
+ export CDPATH="../$(basename $PREFIX_DIR)"
+ try sh "lib/packagelib/uninstall.sh"
+ cd "$S" || exit 1
+ unset CDPATH
+}
+runtest CDPATH_does_not_destroy_things
echo
echo "TOTAL SUCCESS!"