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

[PATCH 4/7] t3302: do not chdir around in the primary test process

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 9, 2014, 23:22 UTC
Message-ID
<1402356175-7249-5-git-send-email-gitster@pobox.com>
In-Reply-To
<1402356175-7249-1-git-send-email-gitster@pobox.com>

These days^Wyears we strive to do stuff in subdirectories inside subshells to avoid mistakes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t3302-notes-index-expensive.sh | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/t/t3302-notes-index-expensive.sh b/t/t3302-notes-index-expensive.sh
index aa9dbd7..7712cf3 100755
--- a/t/t3302-notes-index-expensive.sh
+++ b/t/t3302-notes-index-expensive.sh
@@ -106,18 +106,27 @@ do_tests () {
 	pr=$1
 	count=$2
 
-	test_expect_success $pr 'setup / mkdir' '
-		mkdir $count &&
-		cd $count
+	test_expect_success $pr "setup $count" '
+		mkdir "$count" &&
+		(
+			cd "$count" &&
+			create_repo "$count"
+		)
 	'
 
-	test_expect_success $pr "setup $count" "create_repo $count"
-
-	test_expect_success $pr 'notes work' "test_notes $count"
-
-	test_expect_success USR_BIN_TIME,$pr 'notes timing with /usr/bin/time' "time_notes 100"
+	test_expect_success $pr 'notes work' '
+		(
+			cd "$count" &&
+			test_notes "$count"
+		)
+	'
 
-	test_expect_success $pr 'teardown / cd ..' 'cd ..'
+	test_expect_success USR_BIN_TIME,$pr 'notes timing with /usr/bin/time' '
+		(
+			cd "$count" &&
+			time_notes 100
+		)
+	'
 }
 
 do_tests NOT_EXPENSIVE 10
-- 
2.0.0-435-g307a092
Previous: Junio C HamanoNext: Junio C Hamano
Message 6 of 9 in “A few minor test-prereq updates”
  1. 0/7 A few minor test-prereq updatesJunio C Hamano, Jun 9, 2014
  2. 1/7 test: turn EXPENSIVE into a lazy prerequisiteJunio C Hamano, Jun 9, 2014
  3. 2/7 test: turn USR_BIN_TIME into a lazy prerequisiteJunio C Hamano, Jun 9, 2014
  4. Jeff KingJun 13, 2014
  5. 3/7 t3302: coding style updatesJunio C Hamano, Jun 9, 2014
  6. 4/7 t3302: do not chdir around in the primary test processJunio C Hamano, Jun 9, 2014
  7. 5/7 t3302: drop unnecessary NOT_EXPENSIVE pseudo-prerequisiteJunio C Hamano, Jun 9, 2014
  8. 6/7 t3419: drop unnecessary NOT_EXPENSIVE pseudo-prerequisiteJunio C Hamano, Jun 9, 2014
  9. 7/7 tests: drop GIT_*_TIMING_TESTS environment variable supportJunio C Hamano, Jun 9, 2014

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.