Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Testsuite

dscho edited this page Nov 13, 2014 · 5 revisions

Table of Contents

Gits Testsuite

From the msysGit Development environment the testsuite can be run by

 cd /git
 make test

However since the testsuite takes some time on Windows we have a helper script where the output is easier to read. To use it you first need to compile git

 cd /git
 make

and then

 /share/msysGit/run-tests.sh [-j<n>]

which by default will run the tests in parallel. The amount of parallel jobs can be configured by the -j option.

A few tips to debug test failures

Use verbose and immediate option

You can run the individual tests with the -v and -i switch. This will give you verbose output of the scripts and make the test stop immediately after the test failure. E.g.

 cd t && ./t0000-basic.sh -i -v

The -i option will make the test stop as soon as an individual test failed, and the -v will show the output of the individual commands performed in the test.

It is often also helpful to see the exact invocations of the launched commands:

 sh -x t0000-basic.sh -i -v

Bash's -x option echoes the command-line of the commands just before they are called.

You can ask Git itself to echo the command-line with which it was called, by setting the environment variable GIT_TRACE=1. Note that this only echoes the command-line when Git was called, but that it also echoes the command-line when Git calls itself, e.g. when git merge calls git merge-recursive. Therefore, it can make sense to use both GIT_TRACE and -x:

 GIT_TRACE=1 sh -x t0000-basic.sh -i -v

Finally, as the output can become really unwieldy, it makes sense to redirect the output, either into the pager (if you know how to drive less e.g. to search for a specific regular expression) or into a file:

 GIT_TRACE=1 sh -x t0000-basic.sh -i -v 2>&1 | less

or

 GIT_TRACE=1 sh -x t0000-basic.sh -i -v 2>&1 | tee output.txt

Have a look at the README

In the t/ subdirectory of git is a README with much more descriptions of tools.

Writing all test data on a ramdisk/drive

Since the testsuite performs a lot of file I/O it can be a speedup to setup a virtual ramdisk.

Create a ramdisk. E.g. use this tool: http://www.ltr-data.se/opencode.html/#ImDisk

Tell the testsuite to use the new drive:

 /share/msysGit/run-tests.sh GIT_TEST_OPTS="--root=/<Driveletter>/"

For example if you have setup V: as ramdisk

 /share/msysGit/run-tests.sh GIT_TEST_OPTS="--root=/v/"
Clone this wiki locally