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

Re: [PATCH] t9301-fast-export: move unset of config variable into its own test function

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 22, 2008, 08:18 UTC
Message-ID
<7vbpzlbgyl.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<ZdQ6b4vecqtrZ-7Mze6M9UBwrI9qQRUu-BoApXUv0v2zM76stzXd3w@cipher.nrlssc.navy.mil>
Brandon Casey <casey@nrlssc.navy.mil> writes:
Show 6 quoted lines
> On platforms with a broken iconv it may be necessary to skip the fourth
> test in this script. Test four sets the i18n.commitencoding config variable.
> If test four is skipped, then a later unset of the i18n.commitencoding
> config variable will return a non-zero exit status and cause a test to fail.
> So move the 'config --unset' into its own test function which allows it to
> be skipped independently.

I do not know if this is worth it, and I am reasonably sure this is not an optimal solution for this particular case.

Many existing pieces in the test scripts, I even suspect majority of them, do depend on earlier piece in the sequence to succeed and try to build on top of the state they have left. In the ideal world, especially when the software is young and flaky, perhaps that should not be the case and having test pieces that are as independent as each other would be easier to fix many tests that do not pass, but these days we expect all tests to pass, so running tests has become like reading the error output from compilers --- very often, the first error is the only one that counts.

Even though test-lib.sh does support skipping individual test pieces by adding t9301.12 to GIT_TEST_SKIP, it is not very useful in practice with the current set of tests, it would involve huge effort to make it reliably usable, and individual test pieces in the end result from such an effort will have to perform their own set-up from scratch, which would mean the test will take even longer to run, to catch occasional breakages.

For this particular case, what we are interested in testing is not that "config --unset" exits with 0 status. We are however interested in making sure that i18n.commitencoding is not set when the body of #12 runs.

So I think a more appropriate change would be something like this for this particular case.

 t/t9301-fast-export.sh |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git c/t/t9301-fast-export.sh i/t/t9301-fast-export.sh
index 3cb9f80..2ce2aff 100755
--- c/t/t9301-fast-export.sh
+++ i/t/t9301-fast-export.sh
@@ -190,7 +190,9 @@ export GIT_COMMITTER_NAME='C O Mitter'
 
 test_expect_success 'setup copies' '
 
-	git config --unset i18n.commitencoding &&
+	git config --unset i18n.commitencoding
+
+	test -z $(git config i18n.commitencoding) &&
 	git checkout -b copy rein &&
 	git mv file file3 &&
 	git commit -m move1 &&
Previous: Brandon CaseyNext: Junio C Hamano
Message 22 of 28 in “[FYI] How I compile on IRIX 6.5 with the MIPSpro compiler and ksh”
  1. Brandon CaseyAug 18, 2008
  2. Makefile: add section for SGI IRIXBrandon Casey, Aug 18, 2008
  3. git-compat-util.h: adjust for SGI IRIX 6.5Brandon Casey, Aug 18, 2008
  4. unpack-trees.c: work around run-time array initialization flaw on IRIX 6.5Brandon Casey, Aug 18, 2008
  5. templates/Makefile: work around SGI install which assumes / if ROOT not definedBrandon Casey, Aug 18, 2008
  6. Junio C HamanoAug 18, 2008
  7. Brandon CaseyAug 19, 2008
  8. templates/Makefile: install is unnecessary, just use mkdir -pBrandon Casey, Aug 22, 2008
  9. test-lib.sh: work around ksh's trap shortcomingsBrandon Casey, Aug 18, 2008
  10. Junio C HamanoAug 18, 2008
  11. Brandon CaseyAug 19, 2008
  12. Junio C HamanoAug 19, 2008
  13. Brandon CaseyAug 19, 2008
  14. Brandon CaseyAug 19, 2008
  15. Brandon CaseyAug 20, 2008
  16. Mike RalphsonAug 20, 2008
  17. t1002-read-tree-m-u-2way.sh: use 'git diff -U0' rather than 'diff -U0'Brandon Casey, Aug 18, 2008
  18. t9301-fast-export.sh: don't unset config variable while we're skipping test 4Brandon Casey, Aug 18, 2008
  19. Junio C HamanoAug 19, 2008
  20. Brandon CaseyAug 19, 2008
  21. t9301-fast-export: move unset of config variable into its own test functionBrandon Casey, Aug 22, 2008
  22. Junio C HamanoAug 22, 2008
  23. Junio C HamanoAug 22, 2008
  24. Johannes SixtAug 22, 2008
  25. Junio C HamanoAug 22, 2008
  26. Brandon CaseyAug 18, 2008
  27. Boyd Lynn GerberAug 19, 2008
  28. Brandon CaseyAug 19, 2008

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.