]> git.ipfire.org Git - thirdparty/git.git/commit
cmake: support for testing git with ctest
authorSibi Siddharthan <sibisiddharthan.github@gmail.com>
Fri, 26 Jun 2020 16:11:34 +0000 (16:11 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 26 Jun 2020 17:08:46 +0000 (10:08 -0700)
commitc4b2f41b5f5bd4905cb3b36183957150d73d9e59
treeb473b4bde69fe867074d6c0219cd0c655729a5b1
parentf1f5dff9e7c0ea528ea422922bbe128e24aa83a8
cmake: support for testing git with ctest

This patch provides an alternate way to test git using ctest.
CTest ships with CMake, so there is no additional dependency being
introduced.

To perform the tests with ctest do this after building:
ctest -j[number of jobs]

NOTE: -j is optional, the default number of jobs is 1

Each of the jobs does this:
cd t/ && sh t[something].sh

The reason for using CTest is that it logs the output of the tests
in a neat way, which can be helpful during diagnosis of failures.

After the tests have run ctest generates three log files located in
`build-directory`/Testing/Temporary/

These log files are:

CTestCostData.txt:
This file contains the time taken to complete each test.

LastTestsFailed.log:
This log file contains the names of the tests that have failed in the
run.

LastTest.log:
This log file contains the log of all the tests that have run.
A snippet of the file is given below.

10/901 Testing: D:/my/git-master/t/t0009-prio-queue.sh
10/901 Test: D:/my/git-master/t/t0009-prio-queue.sh
Command: "sh.exe" "D:/my/git-master/t/t0009-prio-queue.sh"
Directory: D:/my/git-master/t
"D:/my/git-master/t/t0009-prio-queue.sh"
Output:
----------------------------------------------------------
ok 1 - basic ordering
ok 2 - mixed put and get
ok 3 - notice empty queue
ok 4 - stack order
passed all 4 test(s)
1..4
<end of output>
Test time =   1.11 sec

NOTE: Testing only works when building in source for now.

Signed-off-by: Sibi Siddharthan <sibisiddharthan.github@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/buildsystems/CMakeLists.txt