[PATCH 4/4] Make test-lib warn if the directory changes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Sverre Rabbelier <srabbelier@xxxxxxxxx>

If a script moves out of it's directory, but thereafter
does not move back, the test results would not get written
to the proper file, as such, remember where we start at
and then later on, write to that place.
Also, if it is noticed that the directory was changed,
issue a warning.

Signed-off-by: Sverre Rabbelier <srabbelier@xxxxxxxxx>
---
 t/test-lib.sh |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 4585fde..d9f2f4e 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -5,6 +5,7 @@
 
 # Keep the original TERM for say_color
 ORIGINAL_TERM=$TERM
+ORIGINAL_PATH=$PWD
 
 # For repeatability, reset the environment to known value.
 LANG=C
@@ -355,7 +356,12 @@ test_create_repo () {
 
 test_done () {
 	trap - exit
-	test_results_path="../test-results"
+	test_results_path="$ORIGINAL_PATH/test-results"
+
+  if test "$ORIGINAL_PATH" != "$PWD"
+  then
+    say_color error "Script changed directory from '$ORIGINAL_PATH' to '$PWD'!"
+  fi
 
 	echo "total $test_count" >> $test_results_path
 	echo "success $test_success" >> $test_results_path
-- 
1.5.6.rc2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux