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

[PATCH v2 09/16] t3427: condense the unnecessarily repetitive test cases into three

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Jul 31, 2019, 15:18 UTC
Message-ID
<46ef0053650d9bcc7c3218cfbf0cb729307c03f8.1564586316.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.294.v2.git.gitgitgadget@gmail.com>
From: Johannes Schindelin <johannes.schindelin@gmx.de>

Previously, this test script performed essentially three rebases and verified breakages by testing the post-rebase commits' messages.

To do so, the rebases were performed multiple times, though, once per commit message to test. This wastes electricity (and CO2) and time.

Let's condense the test cases to the essential number: the number of different rebases to validate.

On Windows, where the scripted nature of the `--preserve-merges` backend hurts performance rather badly, this reduces the overall runtime in this developer's setup from ~1m to ~28s while still performing the exact same testing as before.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 t/t3427-rebase-subtree.sh | 61 +++++++--------------------------------
 1 file changed, 11 insertions(+), 50 deletions(-)
diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh
index 64ba95f3e0..b21925d279 100755
--- a/t/t3427-rebase-subtree.sh
+++ b/t/t3427-rebase-subtree.sh
@@ -64,70 +64,31 @@ test_expect_success 'setup' '
 '
 
 # FAILURE: Does not preserve master4.
-test_expect_failure REBASE_P \
-	'Rebase -Xsubtree --preserve-merges --onto commit 4' '
+test_expect_failure REBASE_P 'Rebase -Xsubtree --preserve-merges --onto commit' '
 	reset_rebase &&
-	git checkout -b rebase-preserve-merges-4 to-rebase &&
-	git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master &&
-	verbose test "$(commit_message HEAD~)" = "files_subtree/master4"
-'
-
-# FAILURE: Does not preserve master5.
-test_expect_failure REBASE_P \
-	'Rebase -Xsubtree --preserve-merges --onto commit 5' '
-	reset_rebase &&
-	git checkout -b rebase-preserve-merges-5 to-rebase &&
+	git checkout -b rebase-preserve-merges to-rebase &&
 	git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master &&
+	verbose test "$(commit_message HEAD~)" = "files_subtree/master4" &&
 	verbose test "$(commit_message HEAD)" = "files_subtree/master5"
 '
 
 # FAILURE: Does not preserve master4.
-test_expect_failure REBASE_P \
-	'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 4' '
+test_expect_failure REBASE_P 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit' '
 	reset_rebase &&
-	git checkout -b rebase-keep-empty-4 to-rebase &&
-	git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
-	verbose test "$(commit_message HEAD~2)" = "files_subtree/master4"
-'
-
-# FAILURE: Does not preserve master5.
-test_expect_failure REBASE_P \
-	'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 5' '
-	reset_rebase &&
-	git checkout -b rebase-keep-empty-5 to-rebase &&
-	git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
-	verbose test "$(commit_message HEAD~)" = "files_subtree/master5"
-'
-
-# FAILURE: Does not preserve Empty.
-test_expect_failure REBASE_P \
-	'Rebase -Xsubtree --keep-empty --preserve-merges --onto empty commit' '
-	reset_rebase &&
-	git checkout -b rebase-keep-empty-empty to-rebase &&
+	git checkout -b rebase-keep-empty to-rebase &&
 	git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master &&
+	verbose test "$(commit_message HEAD~2)" = "files_subtree/master4" &&
+	verbose test "$(commit_message HEAD~)" = "files_subtree/master5" &&
 	verbose test "$(commit_message HEAD)" = "Empty commit"
 '
 
 # FAILURE: fatal: Could not parse object
-test_expect_failure 'Rebase -Xsubtree --onto commit 4' '
-	reset_rebase &&
-	git checkout -b rebase-onto-4 to-rebase &&
-	git rebase -Xsubtree=files_subtree --onto files-master master &&
-	verbose test "$(commit_message HEAD~2)" = "files_subtree/master4"
-'
-
-# FAILURE: fatal: Could not parse object
-test_expect_failure 'Rebase -Xsubtree --onto commit 5' '
-	reset_rebase &&
-	git checkout -b rebase-onto-5 to-rebase &&
-	git rebase -Xsubtree=files_subtree --onto files-master master &&
-	verbose test "$(commit_message HEAD~)" = "files_subtree/master5"
-'
-# FAILURE: fatal: Could not parse object
-test_expect_failure 'Rebase -Xsubtree --onto empty commit' '
+test_expect_failure 'Rebase -Xsubtree --onto commit' '
 	reset_rebase &&
-	git checkout -b rebase-onto-empty to-rebase &&
+	git checkout -b rebase-onto to-rebase &&
 	git rebase -Xsubtree=files_subtree --onto files-master master &&
+	verbose test "$(commit_message HEAD~2)" = "files_subtree/master4" &&
+	verbose test "$(commit_message HEAD~)" = "files_subtree/master5" &&
 	verbose test "$(commit_message HEAD)" = "Empty commit"
 '
 
-- 
gitgitgadget
Previous: Johannes Schindelin via GitGitGadgetNext: Johannes Schindelin via GitGitGadget
Message 32 of 39 in “rebase -r: support merge strategies other than recursive”
  1. 00/12 rebase -r: support merge strategies other than recursiveJohannes Schindelin via GitGitGadget, Jul 25, 2019
  2. 02/12 t3427: simplify the `setup` test case significantlyJohannes Schindelin via GitGitGadget, Jul 25, 2019
  3. 01/12 t3427: add a clarifying commentJohannes Schindelin via GitGitGadget, Jul 25, 2019
  4. 04/12 t3427: condense the unnecessarily repetitive test cases into threeJohannes Schindelin via GitGitGadget, Jul 25, 2019
  5. 05/12 t3427: fix erroneous assumptionJohannes Schindelin via GitGitGadget, Jul 25, 2019
  6. 07/12 t3427: fix another incorrect assumptionJohannes Schindelin via GitGitGadget, Jul 25, 2019
  7. 03/12 t3427: move the `filter-branch` invocation into the `setup` caseJohannes Schindelin via GitGitGadget, Jul 25, 2019
  8. 09/12 rebase -r: support merge strategies other than `recursive`Johannes Schindelin via GitGitGadget, Jul 25, 2019
  9. 10/12 t/lib-rebase: prepare for testing `git rebase --rebase-merges`Johannes Schindelin via GitGitGadget, Jul 25, 2019
  10. brian m. carlsonJul 26, 2019
  11. Johannes SchindelinJul 26, 2019
  12. brian m. carlsonJul 26, 2019
  13. Johannes SchindelinJul 31, 2019
  14. 12/12 rebase -r: do not (re-)generate root commits with `--root` *and* `--onto`Johannes Schindelin via GitGitGadget, Jul 25, 2019
  15. 08/12 t3427: mark two test cases as requiring support for `git rebase -p`Johannes Schindelin via GitGitGadget, Jul 25, 2019
  16. 11/12 t3418: test `rebase -r` with merge strategiesJohannes Schindelin via GitGitGadget, Jul 25, 2019
  17. 06/12 t3427: accommodate for the `rebase --merge` backend having been replacedJohannes Schindelin via GitGitGadget, Jul 25, 2019
  18. Junio C HamanoJul 25, 2019
  19. brian m. carlsonJul 26, 2019
  20. 00/16 rebase -r: support merge strategies other than recursiveJohannes Schindelin via GitGitGadget, Jul 31, 2019
  21. 02/16 t3400: stop referring to the scripted rebaseJohannes Schindelin via GitGitGadget, Jul 31, 2019
  22. 03/16 .gitignore: there is no longer a built-in `git-rebase--interactive`Johannes Schindelin via GitGitGadget, Jul 31, 2019
  23. 06/16 t3427: add a clarifying commentJohannes Schindelin via GitGitGadget, Jul 31, 2019
  24. 04/16 sequencer: the `am` and `rebase--interactive` scripts are goneJohannes Schindelin via GitGitGadget, Jul 31, 2019
  25. 05/16 rebase: fold git-rebase--common into the -p backendJohannes Schindelin via GitGitGadget, Jul 31, 2019
  26. 08/16 t3427: move the `filter-branch` invocation into the `setup` caseJohannes Schindelin via GitGitGadget, Jul 31, 2019
  27. 01/16 Drop unused git-rebase--am.shJohannes Schindelin via GitGitGadget, Jul 31, 2019
  28. 16/16 rebase -r: do not (re-)generate root commits with `--root` *and* `--onto`Johannes Schindelin via GitGitGadget, Jul 31, 2019
  29. 14/16 t/lib-rebase: prepare for testing `git rebase --rebase-merges`Johannes Schindelin via GitGitGadget, Jul 31, 2019
  30. 15/16 t3418: test `rebase -r` with merge strategiesJohannes Schindelin via GitGitGadget, Jul 31, 2019
  31. 13/16 rebase -r: support merge strategies other than `recursive`Johannes Schindelin via GitGitGadget, Jul 31, 2019
  32. 09/16 t3427: condense the unnecessarily repetitive test cases into threeJohannes Schindelin via GitGitGadget, Jul 31, 2019
  33. 12/16 t3427: fix another incorrect assumptionJohannes Schindelin via GitGitGadget, Jul 31, 2019
  34. 10/16 t3427: fix erroneous assumptionJohannes Schindelin via GitGitGadget, Jul 31, 2019
  35. 11/16 t3427: accommodate for the `rebase --merge` backend having been replacedJohannes Schindelin via GitGitGadget, Jul 31, 2019
  36. 07/16 t3427: simplify the `setup` test case significantlyJohannes Schindelin via GitGitGadget, Jul 31, 2019
  37. 17/16 t3427: accelerate this test by using fast-export and fast-importElijah Newren, Sep 4, 2019
  38. Johannes SchindelinSep 9, 2019
  39. Junio C HamanoSep 9, 2019

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.