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

[PATCH/RFC 1/1] t0027: Some tests are not expensive

From
tboegi@web.de <tboegi@web.de>
Date
Apr 29, 2017, 15:34 UTC
Message-ID
<20170429153454.16879-1-tboegi@web.de>
In-Reply-To
<11da00e8-a62c-bf07-d97e-ab755647082b@web.de>
From: Torsten Bögershausen <tboegi@web.de>

The purpose of t0027 is to test all CRLF related conversions at "git checkout" and "git add".

Running t0027 under Git for Windows takes 3-4 minutes, so the whole script had been marked as "EXPENSIVE".

The source code for "Git for Windows" overrides this since 2014: "t0027 is marked expensive, but really, for MinGW we want to run these tests always."

Recent "stress" tests show that t0025 if flaky, reported by Lars Schneider, larsxschneider@gmail.com

All tests from t0025 are covered in t0027 as well, so that t0025 can be retired later.

Split the tests in t0027 into 2 groups: expensive and not expensive. Expensive are all tests which check the CRLF conversion warnings and all tests which activate the Git internal "ident" filter.

All other test are now run under all platforms, which allows to remove the flaky t0025 in the next commit.

The execution time for the non-expansive part is 6..8 seconds under Linux, and 32 seconds under Mac Os X.

Running the "expensive" version roughly doubles the time.

And in case you ask, things are not going significantly faster using a SSD instead of a spinning disk.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
PS: The removal of t0025 is not included (yet)
---
 t/t0027-auto-crlf.sh | 100 ++++++++++++++++++++++++++++++---------------------
 1 file changed, 59 insertions(+), 41 deletions(-)
diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh
index 90db54c..2c5aff6 100755
--- a/t/t0027-auto-crlf.sh
+++ b/t/t0027-auto-crlf.sh
@@ -4,10 +4,12 @@ test_description='CRLF conversion all combinations'
 
 . ./test-lib.sh
 
-if ! test_have_prereq EXPENSIVE
+if ! test_have_prereq EXPENSIVE && ! test_have_prereq MINGW
 then
-	skip_all="EXPENSIVE not set"
-	test_done
+	say "# EXPENSIVE or MINGW not set, skipping ident and warning tests"
+else
+	EXPENSIVE0027=t
+	export EXPENSIVE0027
 fi
 
 compare_files () {
@@ -95,11 +97,14 @@ commit_check_warn () {
 		git -c core.autocrlf=$crlf add $fname 2>"${pfx}_$f.err"
 	done &&
 	git commit -m "core.autocrlf $crlf" &&
-	check_warning "$lfname" ${pfx}_LF.err &&
-	check_warning "$crlfname" ${pfx}_CRLF.err &&
-	check_warning "$lfmixcrlf" ${pfx}_CRLF_mix_LF.err &&
-	check_warning "$lfmixcr" ${pfx}_LF_mix_CR.err &&
-	check_warning "$crlfnul" ${pfx}_CRLF_nul.err
+	if test "$EXPENSIVE0027" = t
+	then
+		check_warning "$lfname" ${pfx}_LF.err &&
+		check_warning "$crlfname" ${pfx}_CRLF.err &&
+		check_warning "$lfmixcrlf" ${pfx}_CRLF_mix_LF.err &&
+		check_warning "$lfmixcr" ${pfx}_LF_mix_CR.err &&
+		check_warning "$crlfnul" ${pfx}_CRLF_nul.err
+	fi
 }
 
 commit_chk_wrnNNO () {
@@ -122,24 +127,27 @@ commit_chk_wrnNNO () {
 		git -c core.autocrlf=$crlf add $fname 2>"${pfx}_$f.err"
 	done
 
-	test_expect_success "commit NNO files crlf=$crlf attr=$attr LF" '
-		check_warning "$lfwarn" ${pfx}_LF.err
-	'
-	test_expect_success "commit NNO files attr=$attr aeol=$aeol crlf=$crlf CRLF" '
-		check_warning "$crlfwarn" ${pfx}_CRLF.err
-	'
-
-	test_expect_success "commit NNO files attr=$attr aeol=$aeol crlf=$crlf CRLF_mix_LF" '
-		check_warning "$lfmixcrlf" ${pfx}_CRLF_mix_LF.err
-	'
-
-	test_expect_success "commit NNO files attr=$attr aeol=$aeol crlf=$crlf LF_mix_cr" '
-		check_warning "$lfmixcr" ${pfx}_LF_mix_CR.err
-	'
-
-	test_expect_success "commit NNO files attr=$attr aeol=$aeol crlf=$crlf CRLF_nul" '
-		check_warning "$crlfnul" ${pfx}_CRLF_nul.err
-	'
+	if test "$EXPENSIVE0027" = t
+	then
+		test_expect_success "commit NNO files crlf=$crlf attr=$attr LF" '
+			check_warning "$lfwarn" ${pfx}_LF.err
+		'
+		test_expect_success "commit NNO files attr=$attr aeol=$aeol crlf=$crlf CRLF" '
+			check_warning "$crlfwarn" ${pfx}_CRLF.err
+		'
+
+		test_expect_success "commit NNO files attr=$attr aeol=$aeol crlf=$crlf CRLF_mix_LF" '
+			check_warning "$lfmixcrlf" ${pfx}_CRLF_mix_LF.err
+		'
+
+		test_expect_success "commit NNO files attr=$attr aeol=$aeol crlf=$crlf LF_mix_cr" '
+			check_warning "$lfmixcr" ${pfx}_LF_mix_CR.err
+		'
+
+		test_expect_success "commit NNO files attr=$attr aeol=$aeol crlf=$crlf CRLF_nul" '
+			check_warning "$crlfnul" ${pfx}_CRLF_nul.err
+		'
+	fi
 }
 
 stats_ascii () {
@@ -250,21 +258,24 @@ checkout_files () {
 		fi
 	done
 
-	test_expect_success "ls-files --eol attr=$attr $ident aeol=$aeol core.autocrlf=$crlf core.eol=$ceol" '
-		test_when_finished "rm expect actual" &&
-		sort <<-EOF >expect &&
-		i/crlf w/$(stats_ascii $crlfname) attr/$(attr_ascii $attr $aeol) crlf_false_attr__CRLF.txt
-		i/mixed w/$(stats_ascii $lfmixcrlf) attr/$(attr_ascii $attr $aeol) crlf_false_attr__CRLF_mix_LF.txt
-		i/lf w/$(stats_ascii $lfname) attr/$(attr_ascii $attr $aeol) crlf_false_attr__LF.txt
-		i/-text w/$(stats_ascii $lfmixcr) attr/$(attr_ascii $attr $aeol) crlf_false_attr__LF_mix_CR.txt
-		i/-text w/$(stats_ascii $crlfnul) attr/$(attr_ascii $attr $aeol) crlf_false_attr__CRLF_nul.txt
-		i/-text w/$(stats_ascii $crlfnul) attr/$(attr_ascii $attr $aeol) crlf_false_attr__LF_nul.txt
-		EOF
-		git ls-files --eol crlf_false_attr__* |
-		sed -e "s/	/ /g" -e "s/  */ /g" |
-		sort >actual &&
-		test_cmp expect actual
-	'
+	if test "$EXPENSIVE0027" = t
+	then
+		test_expect_success "ls-files --eol attr=$attr $ident aeol=$aeol core.autocrlf=$crlf core.eol=$ceol" '
+			test_when_finished "rm expect actual" &&
+			sort <<-EOF >expect &&
+			i/crlf w/$(stats_ascii $crlfname) attr/$(attr_ascii $attr $aeol) crlf_false_attr__CRLF.txt
+			i/mixed w/$(stats_ascii $lfmixcrlf) attr/$(attr_ascii $attr $aeol) crlf_false_attr__CRLF_mix_LF.txt
+			i/lf w/$(stats_ascii $lfname) attr/$(attr_ascii $attr $aeol) crlf_false_attr__LF.txt
+			i/-text w/$(stats_ascii $lfmixcr) attr/$(attr_ascii $attr $aeol) crlf_false_attr__LF_mix_CR.txt
+			i/-text w/$(stats_ascii $crlfnul) attr/$(attr_ascii $attr $aeol) crlf_false_attr__CRLF_nul.txt
+			i/-text w/$(stats_ascii $crlfnul) attr/$(attr_ascii $attr $aeol) crlf_false_attr__LF_nul.txt
+			EOF
+			git ls-files --eol crlf_false_attr__* |
+			sed -e "s/	/ /g" -e "s/  */ /g" |
+			sort >actual &&
+			test_cmp expect actual
+		'
+		fi
 	test_expect_success "checkout attr=$attr $ident aeol=$aeol core.autocrlf=$crlf core.eol=$ceol file=LF" "
 		compare_ws_file $pfx $lfname    crlf_false_attr__LF.txt
 	"
@@ -494,6 +505,13 @@ export CRLF_MIX_LF_CR MIX NL
 # Same handling with and without ident
 for id in "" ident
 do
+	if ! test "$EXPENSIVE0027" = t
+	then
+		if test "$id" = ident
+		then
+			continue
+		fi
+	fi
 	for ceol in lf crlf native
 	do
 		for crlf in true false input
-- 
2.10.0
Previous: Lars SchneiderNext: Junio C Hamano
Message 6 of 16 in “Re: t0025 flaky on OSX”
  1. Torsten BögershausenApr 24, 2017
  2. Torsten BögershausenApr 24, 2017
  3. Lars SchneiderApr 25, 2017
  4. Torsten BögershausenApr 26, 2017
  5. Lars SchneiderApr 26, 2017
  6. 1/1 t0027: Some tests are not expensivetboegi@web.de, Apr 29, 2017
  7. Junio C HamanoMay 1, 2017
  8. Torsten BögershausenMay 1, 2017
  9. 1/1 t0027: tests are not expensive; remove t0025tboegi@web.de, May 2, 2017
  10. Johannes SchindelinMay 2, 2017
  11. Junio C HamanoMay 9, 2017
  12. Torsten BögershausenMay 9, 2017
  13. 1/1 t0027: tests are not expensive; remove t0025tboegi@web.de, May 10, 2017
  14. Johannes SchindelinMay 10, 2017
  15. Torstem BögershausenMay 10, 2017
  16. Junio C HamanoMay 11, 2017

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.