git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[GUILT 4/6] Run regression tests in a directory which contains spaces

From
AJAlan Jenkins <alan.christopher.jenkins@googlemail.com>
Date
Sep 28, 2011, 14:15 UTC
Message-ID
<1317219324-10319-4-git-send-email-alan.christopher.jenkins@googlemail.com>
In-Reply-To
<1317219324-10319-1-git-send-email-alan.christopher.jenkins@googlemail.com>
This helped me in finding some of the issues in the previous patch.
Signed-off-by: Alan Jenkins <alan.christopher.jenkins@googlemail.com>
---
 regression/run-tests |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/regression/run-tests b/regression/run-tests
index 4cb3eb4..a10e796 100755
--- a/regression/run-tests
+++ b/regression/run-tests
@@ -9,9 +9,9 @@ source scaffold
 # usage: empty_repo
 function empty_repo
 {
-	rm -rf $REPODIR
-	mkdir $REPODIR
-	cd $REPODIR > /dev/null
+	rm -rf "$REPODIR"
+	mkdir "$REPODIR"
+	cd "$REPODIR" > /dev/null
 	git init 2> /dev/null > /dev/null
 	cd - > /dev/null
 }
@@ -22,8 +22,9 @@ function test_failed
 Test failed!
 
 Test:		$TESTNAME
-Repo dir:	$REPODIR
 Log file:	$LOGFILE
+Repo dir:	"$REPODIR"
+
 DONE
 	exit 1
 }
@@ -42,7 +43,9 @@ function check_test
 # usage: run_test <test number>
 function run_test
 {
-	export REPODIR="/tmp/guilt.reg.$RANDOM"
+	# We make sure we can handle space characters
+	# by including one in REPODIR.
+	export REPODIR="/tmp/guilt reg.$RANDOM"
 	export LOGFILE="/tmp/guilt.log.$RANDOM"
 	export TESTNAME="$1"
 
@@ -51,7 +54,7 @@ function run_test
 	empty_repo
 
 	# run the test
-	cd $REPODIR > /dev/null
+	cd "$REPODIR" > /dev/null
 	"$REG_DIR/t-$1.sh" 2>&1 > "$LOGFILE"
 	ERR=$?
 	cd - > /dev/null
@@ -61,7 +64,7 @@ function run_test
 
 	echo "done."
 
-	rm -rf $REPODIR $LOGFILE
+	rm -rf "$REPODIR" "$LOGFILE"
 }
 
 case "$1" in
-- 
1.7.4.1
Previous: Alan JenkinsNext: Alan Jenkins
Message 4 of 7 in “[GUILT 1/6] Refuse to push corrupt patches”
  1. Alan JenkinsSep 28, 2011
  2. 2/6 guilt-header: fix patch corruptionAlan Jenkins, Sep 28, 2011
  3. 3/6 Handle paths that contain spacesAlan Jenkins, Sep 28, 2011
  4. 4/6 Run regression tests in a directory which contains spacesAlan Jenkins, Sep 28, 2011
  5. 5/6 Allow guilt scripts to be run from a directory which contains spacesAlan Jenkins, Sep 28, 2011
  6. 6/6 Allow the regression tests to be run from a directory with spaces inAlan Jenkins, Sep 28, 2011
  7. Josef 'Jeff' SipekSep 30, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.