From: Junio C Hamano Date: Mon, 22 Dec 2014 20:26:38 +0000 (-0800) Subject: Merge branch 'jc/refer-to-t-readme-from-submitting-patches' X-Git-Tag: v2.3.0-rc0~74 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/63296d583ca107b3f590c3a09be9b3670a2c1afb?hp=-c Merge branch 'jc/refer-to-t-readme-from-submitting-patches' * jc/refer-to-t-readme-from-submitting-patches: t/README: justify why "! grep foo" is sufficient SubmittingPatches: refer to t/README for tests --- 63296d583ca107b3f590c3a09be9b3670a2c1afb diff --combined Documentation/SubmittingPatches index fa71b5f0b6,bfcf1d1b1f..e3c942e579 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches @@@ -57,7 -57,8 +57,8 @@@ change, the approach taken by the chang differs substantially from the prior version, are all good things to have. - Make sure that you have tests for the bug you are fixing. + Make sure that you have tests for the bug you are fixing. See + t/README for guidance. When adding a new feature, make sure that you have new tests to show the feature triggers the new behaviour when it should, and to show the @@@ -337,7 -338,7 +338,7 @@@ suggests to the contributors spend their time to improve your patch. Go back to step (2). (4) The list forms consensus that the last round of your patch is - good. Send it to the list and cc the maintainer. + good. Send it to the maintainer and cc the list. (5) A topic branch is created with the patch and is merged to 'next', and cooked further and eventually graduates to 'master'. diff --combined t/README index 9952261299,1d51d0e0be..d5bb0c9aa1 --- a/t/README +++ b/t/README @@@ -71,7 -71,6 +71,7 @@@ You can pass --verbose (or -v), --debu (or -i) command line argument to the test, or by setting GIT_TEST_OPTS appropriately before running "make". +-v:: --verbose:: This makes the test more verbose. Specifically, the command being run and their output if any are also @@@ -82,13 -81,6 +82,13 @@@ numbers matching . The number matched against is simply the running count of the test within the file. +-x:: + Turn on shell tracing (i.e., `set -x`) during the tests + themselves. Implies `--verbose`. Note that this can cause + failures in some tests which redirect and test the + output of shell functions. Use with caution. + +-d:: --debug:: This may help the person who is developing a new test. It causes the command defined with test_debug to run. @@@ -97,7 -89,6 +97,7 @@@ failed tests so that you can inspect its contents after the test finished. +-i:: --immediate:: This causes the test to immediately exit upon the first failed test. Cleanup commands requested with @@@ -105,17 -96,10 +105,17 @@@ in order to keep the state for inspection by the tester to diagnose the bug. +-l:: --long-tests:: This causes additional long-running tests to be run (where available), for more exhaustive testing. +-r:: +--run=:: + Run only the subset of tests indicated by + . See section "Skipping Tests" below for + syntax. + --valgrind=:: Execute all Git binaries under valgrind tool and exit with status 126 on errors (just like regular tests, this will @@@ -203,77 -187,10 +203,77 @@@ and either can match the "t[0-9]{4}" pa test, or t[0-9]{4} followed by ".$number" to say which particular test to skip. -Note that some tests in the existing test suite rely on previous -test item, so you cannot arbitrarily disable one and expect the -remainder of test to check what the test originally was intended -to check. +For an individual test suite --run could be used to specify that +only some tests should be run or that some tests should be +excluded from a run. + +The argument for --run is a list of individual test numbers or +ranges with an optional negation prefix that define what tests in +a test suite to include in the run. A range is two numbers +separated with a dash and matches a range of tests with both ends +been included. You may omit the first or the second number to +mean "from the first test" or "up to the very last test" +respectively. + +Optional prefix of '!' means that the test or a range of tests +should be excluded from the run. + +If --run starts with an unprefixed number or range the initial +set of tests to run is empty. If the first item starts with '!' +all the tests are added to the initial set. After initial set is +determined every test number or range is added or excluded from +the set one by one, from left to right. + +Individual numbers or ranges could be separated either by a space +or a comma. + +For example, to run only tests up to a specific test (21), one +could do this: + + $ sh ./t9200-git-cvsexport-commit.sh --run='1-21' + +or this: + + $ sh ./t9200-git-cvsexport-commit.sh --run='-21' + +Common case is to run several setup tests (1, 2, 3) and then a +specific test (21) that relies on that setup: + + $ sh ./t9200-git-cvsexport-commit.sh --run='1 2 3 21' + +or: + + $ sh ./t9200-git-cvsexport-commit.sh --run=1,2,3,21 + +or: + + $ sh ./t9200-git-cvsexport-commit.sh --run='-3 21' + +As noted above, the test set is built going though items left to +right, so this: + + $ sh ./t9200-git-cvsexport-commit.sh --run='1-4 !3' + +will run tests 1, 2, and 4. Items that comes later have higher +precendence. It means that this: + + $ sh ./t9200-git-cvsexport-commit.sh --run='!3 1-4' + +would just run tests from 1 to 4, including 3. + +You may use negation with ranges. The following will run all +test in the test suite except from 7 up to 11: + + $ sh ./t9200-git-cvsexport-commit.sh --run='!7-11' + +Some tests in a test suite rely on the previous tests performing +certain actions, specifically some tests are designated as +"setup" test, so you cannot _arbitrarily_ disable one test and +expect the rest to function correctly. + +--run is mostly useful when you want to focus on a specific test +and know what setup is needed for it. Or when you want to run +everything up to a certain test. Naming Tests @@@ -418,7 -335,8 +418,8 @@@ Don't dies in an unexpected way (e.g. segfault). On the other hand, don't use test_must_fail for running regular - platform commands; just use '! cmd'. + platform commands; just use '! cmd'. We are not in the business + of verifying that the world given to us sanely works. - use perl without spelling it as "$PERL_PATH". This is to help our friends on Windows where the platform Perl often adds CR before @@@ -679,27 -597,6 +680,27 @@@ library for your script to use ... ' + - test_write_lines + + Write on standard output, one line per argument. + Useful to prepare multi-line files in a compact form. + + Example: + + test_write_lines a b c d e f g >foo + + Is a more compact equivalent of: + cat >foo <<-EOF + a + b + c + d + e + f + g + EOF + + - test_pause This command is useful for writing and debugging tests and must be