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

[PATCH 1/4] t0000: keep clean-up tests together

From
Jeff King <peff@peff.net>
Date
Nov 20, 2020, 00:17 UTC
Message-ID
<20201120001723.GA307112@coredump.intra.peff.net>
In-Reply-To
<20201120001458.GA274082@coredump.intra.peff.net>

We check that test_when_finished cleans up after a test, and that it runs even after a failure. Those two were originally adjacent, but got split apart by the new test added in 477dcaddb6 (tests: do not let lazy prereqs inside `test_expect_*` turn off tracing, 2020-03-26), and then further by more lazy-prereq tests. Let's move them back together.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/t0000-basic.sh | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index f4ba2e8c85..d49b5dd4ac 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -829,17 +829,6 @@ then
 	exit 1
 fi
 
-clean=no
-test_expect_success 'tests clean up after themselves' '
-	test_when_finished clean=yes
-'
-
-if test -z "$GIT_TEST_FAIL_PREREQS_INTERNAL" -a $clean != yes
-then
-	say "bug in test framework: basic cleanup command does not work reliably"
-	exit 1
-fi
-
 test_lazy_prereq NESTED_INNER '
 	>inner &&
 	rm -f outer
@@ -874,6 +863,17 @@ test_expect_success 'lazy prereqs do not turn off tracing' "
 	grep 'echo trace' lazy-prereq-and-tracing/err
 "
 
+clean=no
+test_expect_success 'tests clean up after themselves' '
+	test_when_finished clean=yes
+'
+
+if test -z "$GIT_TEST_FAIL_PREREQS_INTERNAL" -a $clean != yes
+then
+	say "bug in test framework: basic cleanup command does not work reliably"
+	exit 1
+fi
+
 test_expect_success 'tests clean up even on failures' "
 	run_sub_test_lib_test_err \
 		failing-cleanup 'Failing tests with cleanup commands' <<-\\EOF &&
-- 
2.29.2.730.g3e418f96ba
Previous: Jeff KingNext: Jeff King
Message 8 of 13 in “tests: make sure nested lazy prereqs work reliably”
  1. 1/2 tests: make sure nested lazy prereqs work reliablySZEDER Gábor, Nov 18, 2020
  2. 2/2 tests: fix description of 'test_set_prereq'SZEDER Gábor, Nov 18, 2020
  3. Junio C HamanoNov 18, 2020
  4. Jeff KingNov 19, 2020
  5. Jeff KingNov 19, 2020
  6. Junio C HamanoNov 19, 2020
  7. Jeff KingNov 20, 2020
  8. 1/4 t0000: keep clean-up tests togetherJeff King, Nov 20, 2020
  9. 2/4 t0000: run prereq tests inside sub-testJeff King, Nov 20, 2020
  10. 3/4 t0000: run cleaning test inside sub-testJeff King, Nov 20, 2020
  11. 4/4 t0000: consistently use single quotes for outer testsJeff King, Nov 20, 2020
  12. Junio C HamanoNov 20, 2020
  13. Junio C HamanoNov 20, 2020

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.