1 The mechanism that powers this testsuite is directly imported from the
2 Core GIT Tests, in directory t/ of the git repository. Files are base
8 This directory holds many test scripts for core GIT tools. The
9 first part of this short document describes how to run the tests
10 and read their output.
12 When fixing the tools or adding enhancements, you are strongly
13 encouraged to add tests in this directory to cover what you are
14 trying to fix or enhance. The later part of this short document
15 describes how your test scripts should be organized.
21 The easiest way to run tests is to say "make". This runs all
24 *** t0000-basic.sh ***
25 ok 1 - .git/objects should be empty after git init in an empty repo.
26 ok 2 - .git/objects should have 3 subdirectories.
27 ok 3 - success is reported like this
29 ok 43 - very long name in the index handled sanely
30 # fixed 1 known breakage(s)
31 # still have 1 known breakage(s)
32 # passed all remaining 42 test(s)
36 ok 2 - plain with GIT_WORK_TREE
39 Since the tests all output TAP (see http://testanything.org) they can
40 be run with any TAP harness. Here's an example of parallel testing
41 powered by a recent version of prove(1):
43 $ prove --timer --jobs 15 ./t[0-9]*.sh
44 [19:17:33] ./t0005-signals.sh ................................... ok 36 ms
45 [19:17:33] ./t0022-crlf-rename.sh ............................... ok 69 ms
46 [19:17:33] ./t0024-crlf-archive.sh .............................. ok 154 ms
47 [19:17:33] ./t0004-unwritable.sh ................................ ok 289 ms
48 [19:17:33] ./t0002-gitfile.sh ................................... ok 480 ms
49 ===( 102;0 25/? 6/? 5/? 16/? 1/? 4/? 2/? 1/? 3/? 1... )===
51 prove and other harnesses come with a lot of useful options. The
52 --state option in particular is very useful:
54 # Repeat until no more failures
55 $ prove -j 15 --state=failed,save ./t[0-9]*.sh
57 You can give DEFAULT_TEST_TARGET=prove on the make command (or define it
58 in config.mak) to cause "make test" to run tests under prove.
59 GIT_PROVE_OPTS can be used to pass additional options, e.g.
61 $ make DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS='--timer --jobs 16' test
63 You can also run each test individually from command line, like this:
65 $ sh ./t3010-ls-files-killed-modified.sh
66 ok 1 - git update-index --add to add various paths.
67 ok 2 - git ls-files -k to show killed files.
68 ok 3 - validate git ls-files -k output.
69 ok 4 - git ls-files -m to show modified files.
70 ok 5 - validate git ls-files -m output.
71 # passed all 5 test(s)
74 You can pass --verbose (or -v), --debug (or -d), and --immediate
75 (or -i) command line argument to the test, or by setting GIT_TEST_OPTS
76 appropriately before running "make".
80 This makes the test more verbose. Specifically, the
81 command being run and their output if any are also
84 --verbose-only=<pattern>::
85 Like --verbose, but the effect is limited to tests with
86 numbers matching <pattern>. The number matched against is
87 simply the running count of the test within the file.
90 Turn on shell tracing (i.e., `set -x`) during the tests
91 themselves. Implies `--verbose`.
92 Ignored in test scripts that set the variable 'test_untraceable'
93 to a non-empty value, unless it's run with a Bash version
94 supporting BASH_XTRACEFD, i.e. v4.1 or later.
98 This may help the person who is developing a new test.
99 It causes the command defined with test_debug to run.
100 The "trash" directory (used to store all temporary data
101 during testing) is not deleted even if there are no
102 failed tests so that you can inspect its contents after
107 This causes the test to immediately exit upon the first
108 failed test. Cleanup commands requested with
109 test_when_finished are not executed if the test failed,
110 in order to keep the state for inspection by the tester
115 This causes additional long-running tests to be run (where
116 available), for more exhaustive testing.
119 --run=<test-selector>::
120 Run only the subset of tests indicated by
121 <test-selector>. See section "Skipping Tests" below for
122 <test-selector> syntax.
125 In addition to printing the test output to the terminal,
126 write it to files named 't/test-results/$TEST_NAME.out'.
127 As the names depend on the tests' file names, it is safe to
128 run the tests with this option in parallel.
132 Write verbose output to the same logfile as `--tee`, but do
133 _not_ write it to stdout. Unlike `--tee --verbose`, this option
134 is safe to use when stdout is being consumed by a TAP parser
135 like `prove`. Implies `--tee` and `--verbose`.
138 Create "trash" directories used to store all temporary data during
139 testing under <directory>, instead of the t/ directory.
140 Using this option with a RAM-based filesystem (such as tmpfs)
141 can massively speed up the test suite.
144 Override the number of parallel jobs. Implies `--stress`.
147 When combined with --stress run the test script repeatedly
148 this many times in each of the parallel jobs or until one of
149 them fails, whichever comes first. Implies `--stress`.
151 You can also set the STG_TEST_INSTALLED environment variable to
152 the bindir of an existing git installation to test that installation.
153 You still need to have built this git sandbox, from which various
154 test-* support programs, templates, and perl libraries are used.
155 If your installed git is incomplete, it will silently test parts of
156 your built version instead.
162 In some environments, certain tests have no way of succeeding
163 due to platform limitation, such as lack of 'unzip' program, or
164 filesystem that do not allow arbitrary sequence of non-NUL bytes
167 You should be able to say something like
169 $ STG_SKIP_TESTS=t9200.8 sh ./t9200-git-cvsexport-commit.sh
173 $ STG_SKIP_TESTS='t[0-4]??? t91?? t9200.8' make
175 to omit such tests. The value of the environment variable is a
176 SP separated list of patterns that tells which tests to skip,
177 and either can match the "t[0-9]{4}" part to skip the whole
178 test, or t[0-9]{4} followed by ".$number" to say which
179 particular test to skip.
181 For an individual test suite --run could be used to specify that
182 only some tests should be run or that some tests should be
185 The argument for --run is a list of individual test numbers or
186 ranges with an optional negation prefix that define what tests in
187 a test suite to include in the run. A range is two numbers
188 separated with a dash and matches a range of tests with both ends
189 been included. You may omit the first or the second number to
190 mean "from the first test" or "up to the very last test"
193 Optional prefix of '!' means that the test or a range of tests
194 should be excluded from the run.
196 If --run starts with an unprefixed number or range the initial
197 set of tests to run is empty. If the first item starts with '!'
198 all the tests are added to the initial set. After initial set is
199 determined every test number or range is added or excluded from
200 the set one by one, from left to right.
202 Individual numbers or ranges could be separated either by a space
205 For example, to run only tests up to a specific test (21), one
208 $ sh ./t9200-git-cvsexport-commit.sh --run='1-21'
212 $ sh ./t9200-git-cvsexport-commit.sh --run='-21'
214 Common case is to run several setup tests (1, 2, 3) and then a
215 specific test (21) that relies on that setup:
217 $ sh ./t9200-git-cvsexport-commit.sh --run='1 2 3 21'
221 $ sh ./t9200-git-cvsexport-commit.sh --run=1,2,3,21
225 $ sh ./t9200-git-cvsexport-commit.sh --run='-3 21'
227 As noted above, the test set is built by going through the items
228 from left to right, so this:
230 $ sh ./t9200-git-cvsexport-commit.sh --run='1-4 !3'
232 will run tests 1, 2, and 4. Items that come later have higher
233 precedence. It means that this:
235 $ sh ./t9200-git-cvsexport-commit.sh --run='!3 1-4'
237 would just run tests from 1 to 4, including 3.
239 You may use negation with ranges. The following will run all
240 test in the test suite except from 7 up to 11:
242 $ sh ./t9200-git-cvsexport-commit.sh --run='!7-11'
244 Some tests in a test suite rely on the previous tests performing
245 certain actions, specifically some tests are designated as
246 "setup" test, so you cannot _arbitrarily_ disable one test and
247 expect the rest to function correctly.
249 --run is mostly useful when you want to focus on a specific test
250 and know what setup is needed for it. Or when you want to run
251 everything up to a certain test.
254 Running tests with special setups
255 ---------------------------------
257 The whole test suite could be run to test some special features
258 that cannot be easily covered by a few specific test cases. These
259 could be enabled by running the test suite with correct STG_TEST_
262 PYTHON=<python executable> use alternative python executable to
263 run stg in tests. By default `python3` is used. Alternatives such
264 as `python3.7`may be specified. The build must have been previously
265 performed using this PYTHON variable. Some example uses:
267 $ make PYTHON=python3.7 test
268 $ make PYTHON=python3.6
270 $ make PYTHON=python3.6 prove
271 $ PYTHON=python3.7 ./t3300-edit.sh
273 STG_TEST_LANG=<encoding> use an encoding other than the default C
274 encoding. Affects LANG and LC_ALL environment variables.
276 GIT_TEST_INDEX_VERSION=<n> exercises the index read/write code path
277 for the index version specified. Can be set to any valid version
278 (currently 2, 3, or 4).
283 The test files are named as:
285 tNNNN-commandname-details.sh
287 where N is a decimal digit.
289 First digit tells the family:
291 0 - the absolute basics and global stuff
292 1 - the basic commands concerning database
293 2 - the basic commands concerning the working tree
294 3 - the other basic commands (e.g. ls-files)
295 4 - the diff commands
296 5 - the pull and exporting commands
297 6 - the revision tree commands (even e.g. merge-base)
298 7 - the porcelainish commands concerning the working tree
299 8 - the porcelainish commands concerning forensics
302 Second digit tells the particular command we are testing.
304 Third digit (optionally) tells the particular switch or group of switches
307 If you create files under t/ directory (i.e. here) that is not
308 the top-level test script, never name the file to match the above
309 pattern. The Makefile here considers all such files as the
310 top-level test script and tries to run all of them. Care is
311 especially needed if you are creating a common test library
312 file, similar to test-lib.sh, because such a library file may
313 not be suitable for standalone execution.
319 The test script is written as a shell script. It should start
320 with the standard "#!/bin/sh", and an
321 assignment to variable 'test_description', like this:
325 test_description='xxx test (option --frotz)
327 This test registers the following structure in the cache
328 and tries to run git-ls-files with option --frotz.'
334 After assigning test_description, the test script should source
335 test-lib.sh like this:
339 This test harness library does the following things:
341 - If the script is invoked with command line argument --help
342 (or -h), it shows the test_description and exits.
344 - Creates an empty test directory with an empty .git/objects database
345 and chdir(2) into it. This directory is 't/trash
346 directory.$test_name_without_dotsh', with t/ subject to change by
347 the --root option documented above, and a '.stress-<N>' suffix
348 appended by the --stress option.
350 - Defines standard test helper functions for your scripts to
351 use. These functions are designed to make all scripts behave
352 consistently when command line arguments --verbose (or -v),
353 --debug (or -d), and --immediate (or -i) is given.
358 Here are a few examples of things you probably should and shouldn't do
363 - Put all code inside test_expect_success and other assertions.
365 Even code that isn't a test per se, but merely some setup code
366 should be inside a test assertion.
368 - Chain your test assertions
370 Write test code like this:
382 That way all of the commands in your tests will succeed or fail. If
383 you must ignore the return value of something, consider using a
384 helper function (e.g. use sane_unset instead of unset, in order
385 to avoid unportable return value for unsetting a variable that was
386 already unset), or prepending the command with test_might_fail or
389 - Check the test coverage for your tests. See the "Test coverage"
392 Don't blindly follow test coverage metrics; if a new function you added
393 doesn't have any coverage, then you're probably doing something wrong,
394 but having 100% coverage doesn't necessarily mean that you tested
397 Tests that are likely to smoke out future regressions are better
398 than tests that just inflate the coverage metrics.
400 - When a test checks for an absolute path that a git command generated,
401 construct the expected value using $(pwd) rather than $PWD,
402 $TEST_DIRECTORY, or $TRASH_DIRECTORY. It makes a difference on
403 Windows, where the shell (MSYS bash) mangles absolute path names.
404 For details, see the commit message of 4114156ae9.
406 - Remember that inside the <script> part, the standard output and
407 standard error streams are discarded, and the test harness only
408 reports "ok" or "not ok" to the end user running the tests. Under
409 --verbose, they are shown to help debug the tests.
411 And here are the "don'ts:"
413 - Don't exit() within a <script> part.
415 The harness will catch this as a programming error of the test.
416 Use test_done instead if you need to stop the tests early (see
417 "Skipping tests" below).
419 - Don't use '! git cmd' when you want to make sure the git command
420 exits with failure in a controlled way by calling "die()". Instead,
421 use 'test_must_fail git cmd'. This will signal a failure if git
422 dies in an unexpected way (e.g. segfault).
424 On the other hand, don't use test_must_fail for running regular
425 platform commands; just use '! cmd'. We are not in the business
426 of verifying that the world given to us sanely works.
428 - Don't feed the output of a git command to a pipe, as in:
430 git -C repo ls-files |
431 xargs -n 1 basename |
434 which will discard git's exit code and may mask a crash. In the
435 above example, all exit codes are ignored except grep's.
437 Instead, write the output of that command to a temporary
438 file with ">" or assign it to a variable with "x=$(git ...)" rather
441 - Don't use command substitution in a way that discards git's exit
442 code. When assigning to a variable, the exit code is not discarded,
445 x=$(git cat-file -p $sha) &&
448 is OK because a crash in "git cat-file" will cause the "&&" chain
451 test "refs/heads/foo" = "$(git symbolic-ref HEAD)"
453 is not OK and a crash in git could go undetected.
455 - Don't use perl without spelling it as "$PERL_PATH". This is to help
456 our friends on Windows where the platform Perl often adds CR before
457 the end of line, and they bundle Git with a version of Perl that
458 does not do so, whose path is specified with $PERL_PATH. Note that we
459 provide a "perl" function which uses $PERL_PATH under the hood, so
460 you do not need to worry when simply running perl in the test scripts
461 (but you do, for example, on a shebang line or in a sub script
462 created via "write_script").
464 - Don't use sh without spelling it as "$SHELL_PATH", when the script
465 can be misinterpreted by broken platform shell (e.g. Solaris).
467 - Don't chdir around in tests. It is not sufficient to chdir to
468 somewhere and then chdir back to the original location later in
469 the test, as any intermediate step can fail and abort the test,
470 causing the next test to start in an unexpected directory. Do so
471 inside a subshell if necessary.
473 - Don't save and verify the standard error of compound commands, i.e.
474 group commands, subshells, and shell functions (except test helper
475 functions like 'test_must_fail') like this:
477 ( cd dir && git cmd ) 2>error &&
478 test_cmp expect error
480 When running the test with '-x' tracing, then the trace of commands
481 executed in the compound command will be included in standard error
482 as well, quite possibly throwing off the subsequent checks examining
483 the output. Instead, save only the relevant git command's standard
486 ( cd dir && git cmd 2>../error ) &&
487 test_cmp expect error
489 - Don't break the TAP output
491 The raw output from your test may be interpreted by a TAP harness. TAP
492 harnesses will ignore everything they don't know about, but don't step
493 on their toes in these areas:
495 - Don't print lines like "$x..$y" where $x and $y are integers.
497 - Don't print lines that begin with "ok" or "not ok".
499 TAP harnesses expect a line that begins with either "ok" and "not
500 ok" to signal a test passed or failed (and our harness already
501 produces such lines), so your script shouldn't emit such lines to
504 You can glean some further possible issues from the TAP grammar
505 (see https://metacpan.org/pod/TAP::Parser::Grammar#TAP-GRAMMAR)
506 but the best indication is to just run the tests with prove(1),
507 it'll complain if anything is amiss.
513 If you need to skip tests you should do so by using the three-arg form
514 of the test_* functions (see the "Test harness library" section
517 test_expect_success PERL 'I need Perl' '
518 perl -e "hlagh() if unf_unf()"
521 The advantage of skipping tests like this is that platforms that don't
522 have the PERL and other optional dependencies get an indication of how
523 many tests they're missing.
525 If the test code is too hairy for that (i.e. does a lot of setup work
526 outside test assertions) you can also skip all remaining tests by
527 setting skip_all and immediately call test_done:
529 if ! test_have_prereq PERL
531 skip_all='skipping perl interface tests, perl not available'
535 The string you give to skip_all will be used as an explanation for why
536 the test was skipped.
541 Your script will be a sequence of tests, using helper functions
542 from the test harness library. At the end of the script, call
549 There are a handful helper functions defined in the test harness
550 library for your script to use.
552 - test_expect_success [<prereq>] <message> <script>
554 Usually takes two strings as parameters, and evaluates the
555 <script>. If it yields success, test is considered
556 successful. <message> should state what it is testing.
560 test_expect_success \
561 'git-write-tree should be able to write an empty tree.' \
562 'tree=$(git-write-tree)'
564 If you supply three parameters the first will be taken to be a
565 prerequisite; see the test_set_prereq and test_have_prereq
568 test_expect_success TTY 'git --paginate rev-list uses a pager' \
571 You can also supply a comma-separated list of prerequisites, in the
572 rare case where your test depends on more than one:
574 test_expect_success PERL,PYTHON 'yo dawg' \
575 ' test $(perl -E 'print eval "1 +" . qx[python -c "print 2"]') == "4" '
577 - test_expect_failure [<prereq>] <message> <script>
579 This is NOT the opposite of test_expect_success, but is used
580 to mark a test that demonstrates a known breakage. Unlike
581 the usual test_expect_success tests, which say "ok" on
582 success and "FAIL" on failure, this will say "FIXED" on
583 success and "still broken" on failure. Failures from these
584 tests won't cause -i (immediate) to stop.
586 Like test_expect_success this function can optionally use a three
587 argument invocation with a prerequisite as the first argument.
589 - test_debug <script>
591 This takes a single argument, <script>, and evaluates it only
592 when the test script is started with --debug command line
593 argument. This is primarily meant for use during the
594 development of a new test script.
596 - debug <git-command>
598 Run a git command inside a debugger. This is primarily meant for
599 use when debugging a failing test script.
603 Your test script must have test_done at the end. Its purpose
604 is to summarize successes and failures in the test script and
605 exit with an appropriate error code.
609 Make commit and tag names consistent by setting the author and
610 committer times to defined state. Subsequent calls will
611 advance the times by a fixed amount.
613 - test_commit <message> [<filename> [<contents>]]
615 Creates a commit with the given message, committing the given
616 file with the given contents (default for both is to reuse the
617 message string), and adds a tag (again reusing the message
618 string as name). Calls test_tick to make the SHA-1s
621 - test_merge <message> <commit-or-tag>
623 Merges the given rev using the given message. Like test_commit,
624 creates a tag and calls test_tick before committing.
626 - test_set_prereq <prereq>
628 Set a test prerequisite to be used later with test_have_prereq. The
629 test-lib will set some prerequisites for you, see the
630 "Prerequisites" section below for a full list of these.
632 Others you can set yourself and use later with either
633 test_have_prereq directly, or the three argument invocation of
634 test_expect_success and test_expect_failure.
636 - test_have_prereq <prereq>
638 Check if we have a prerequisite previously set with test_set_prereq.
639 The most common way to use this explicitly (as opposed to the
640 implicit use when an argument is passed to test_expect_*) is to skip
641 all the tests at the start of the test script if we don't have some
642 essential prerequisite:
644 if ! test_have_prereq PERL
646 skip_all='skipping perl interface tests, perl not available'
650 - test_external [<prereq>] <message> <external> <script>
652 Execute a <script> with an <external> interpreter (like perl). This
653 was added for tests like t9700-perl-git.sh which do most of their
654 work in an external test script.
657 'GitwebCache::*FileCache*' \
658 perl "$TEST_DIRECTORY"/t9503/test_cache_interface.pl
660 If the test is outputting its own TAP you should set the
661 test_external_has_tap variable somewhere before calling the first
662 test_external* function. See t9700-perl-git.sh for an example.
664 # The external test will outputs its own plan
665 test_external_has_tap=1
667 - test_external_without_stderr [<prereq>] <message> <external> <script>
669 Like test_external but fail if there's any output on stderr,
670 instead of checking the exit code.
672 test_external_without_stderr \
674 perl "$TEST_DIRECTORY"/t9700/test.pl
676 - test_expect_code <exit-code> <command>
678 Run a command and ensure that it exits with the given exit code.
681 test_expect_success 'Merge with d/f conflicts' '
682 test_expect_code 1 git merge "merge msg" B master
685 - test_must_fail [<options>] <git-command>
687 Run a git command and ensure it fails in a controlled way. Use
688 this instead of "! <git-command>". When git-command dies due to a
689 segfault, test_must_fail diagnoses it as an error; "! <git-command>"
690 treats it as just another expected failure, which would let such a
693 Accepts the following options:
695 ok=<signal-name>[,<...>]:
696 Don't treat an exit caused by the given signal as error.
697 Multiple signals can be specified as a comma separated list.
698 Currently recognized signal names are: sigpipe, success.
699 (Don't use 'success', use 'test_might_fail' instead.)
701 - test_might_fail [<options>] <git-command>
703 Similar to test_must_fail, but tolerate success, too. Use this
704 instead of "<git-command> || :" to catch failures due to segv.
706 Accepts the same options as test_must_fail.
708 - test_cmp <expected> <actual>
710 Check whether the content of the <actual> file matches the
711 <expected> file. This behaves like "cmp" but produces more
712 helpful output when the test is run with "-v" option.
714 - test_cmp_rev <expected> <actual>
716 Check whether the <expected> rev points to the same commit as the
719 - test_line_count (= | -lt | -ge | ...) <length> <file>
721 Check whether a file has the length it is expected to.
723 - test_path_is_file <path> [<diagnosis>]
724 test_path_is_dir <path> [<diagnosis>]
725 test_path_is_missing <path> [<diagnosis>]
727 Check if the named path is a file, if the named path is a
728 directory, or if the named path does not exist, respectively,
729 and fail otherwise, showing the <diagnosis> text.
731 - test_when_finished <script>
733 Prepend <script> to a list of commands to run to clean up
734 at the end of the current test. If some clean-up command
735 fails, the test will not pass.
739 test_expect_success 'branch pointing to non-commit' '
740 git rev-parse HEAD^{tree} >.git/refs/heads/invalid &&
741 test_when_finished "git update-ref -d refs/heads/invalid" &&
745 - test_atexit <script>
747 Prepend <script> to a list of commands to run unconditionally to
748 clean up before the test script exits, e.g. to stop a daemon:
750 test_expect_success 'test git daemon' '
753 test_atexit 'kill $daemon_pid' &&
757 The commands will be executed before the trash directory is removed,
758 i.e. the atexit commands will still be able to access any pidfiles or
761 Note that these commands will be run even when a test script run
762 with '--immediate' fails. Be careful with your atexit commands to
763 minimize any changes to the failed state.
765 - test_write_lines <lines>
767 Write <lines> on standard output, one line per argument.
768 Useful to prepare multi-line files in a compact form.
772 test_write_lines a b c d e f g >foo
774 Is a more compact equivalent of:
788 This command is useful for writing and debugging tests and must be
789 removed before submitting. It halts the execution of the test and
790 spawns a shell in the trash directory. Exit the shell to continue
793 test_expect_success 'test' '
794 git do-something >actual &&
796 test_cmp expected actual
799 - test_ln_s_add <path1> <path2>
801 This function helps systems whose filesystem does not support symbolic
802 links. Use it to add a symbolic link entry to the index when it is not
803 important that the file system entry is a symbolic link, i.e., instead
809 Sometimes it is possible to split a test in a part that does not need
810 the symbolic link in the file system and a part that does; then only
811 the latter part need be protected by a SYMLINKS prerequisite (see below).
815 This function loads facts and useful object IDs related to the hash
816 algorithm(s) in use from the files in t/oid-info.
820 This function reads per-hash algorithm information from standard
821 input (usually a heredoc) in the format described in
822 t/oid-info/README. This is useful for test-specific values, such as
823 object IDs, which must vary based on the hash algorithm.
825 Certain fixed values, such as hash sizes and common placeholder
826 object IDs, can be loaded with test_oid_init (described above).
830 This function looks up a value for the hash algorithm in use, based
831 on the key given. The value must have been loaded using
832 test_oid_init or test_oid_cache. Providing an unknown key is an
837 This is often seen in modern UNIX but some platforms lack it, so
838 the test harness overrides the platform implementation with a
839 more limited one. Use this only when feeding a handful lines of
840 output to the downstream---unlike the real version, it generates
843 - test_bool_env <env-variable-name> <default-value>
845 Given the name of an environment variable with a bool value,
846 normalize its value to a 0 (true) or 1 (false or empty string)
847 return code. Return with code corresponding to the given default
848 value if the variable is unset.
849 Abort the test script if either the value of the variable or the
850 default are not valid bool values.
856 These are the prerequisites that the test library predefines with
859 See the prereq argument to the test_* functions in the "Test harness
860 library" section above and the "test_have_prereq" function for how to
861 use these, and "test_set_prereq" for how to define your own.
865 The `quilt` binary is avaialable on this system.
867 Tips for Writing Tests
868 ----------------------
870 As with any programming projects, existing programs are the best
871 source of the information. However, do _not_ emulate
872 t0000-basic.sh when writing your tests. The test is special in
873 that it tries to validate the very core of GIT. For example, it
874 knows that there will be 256 subdirectories under .git/objects/,
875 and it knows that the object ID of an empty tree is a certain
876 40-byte string. This is deliberately done so in t0000-basic.sh
877 because the things the very basic core test tries to achieve is
878 to serve as a basis for people who are changing the GIT internal
879 drastically. For these people, after making certain changes,
880 not seeing failures from the basic test _is_ a failure. And
881 such drastic changes to the core GIT that even changes these
882 otherwise supposedly stable object IDs should be accompanied by
883 an update to t0000-basic.sh.
885 However, other tests that simply rely on basic parts of the core
886 GIT working properly should not have that level of intimate
887 knowledge of the core GIT internals. If all the test scripts
888 hardcoded the object IDs like t0000-basic.sh does, that defeats
889 the purpose of t0000-basic.sh, which is to isolate that level of
890 validation in one place. Your test also ends up needing
891 updating when such a change to the internal happens, so do _not_
892 do it and leave the low level of validation to t0000-basic.sh.
897 You can use the coverage tests to find code paths that are not being
898 used or properly exercised yet.
900 To do that, run the coverage target at the top-level (not in the t/
905 That will run the test suite with each stg invocation capturing
906 coverage information. Coverage information from each stg invocation
907 is combined into a .coverage file which is used to generate
910 A detailed HTML coverage report is generated in the "htmlcov"
911 directory, which you can then copy to a webserver, or inspect locally