]> git.proxmox.com Git - libgit2.git/blob - tests/README.md
Update upstream source from tag 'upstream/1.0.0+dfsg.1'
[libgit2.git] / tests / README.md
1 Writing Clar tests for libgit2
2 ==============================
3
4 For information on the Clar testing framework and a detailed introduction
5 please visit:
6
7 https://github.com/vmg/clar
8
9
10 * Write your modules and tests. Use good, meaningful names.
11
12 * Make sure you actually build the tests by setting:
13
14 cmake -DBUILD_CLAR=ON build/
15
16 * Test:
17
18 ./build/libgit2_clar
19
20 * Make sure everything is fine.
21
22 * Send your pull request. That's it.
23
24
25 Memory leak checks
26 ------------------
27
28 These are automatically run as part of CI, but if you want to check locally:
29
30 #### Linux
31
32 Uses [`valgrind`](http://www.valgrind.org/):
33
34 ```console
35 $ cmake -DBUILD_CLAR=ON -DVALGRIND=ON ..
36 $ cmake --build .
37 $ valgrind --leak-check=full --show-reachable=yes --num-callers=50 --suppressions=../libgit2_clar.supp \
38 ./libgit2_clar
39 ```
40
41 #### macOS
42
43 Uses [`leaks`](https://developer.apple.com/library/archive/documentation/Performance/Conceptual/ManagingMemory/Articles/FindingLeaks.html), which requires XCode installed:
44
45 ```console
46 $ MallocStackLogging=1 MallocScribble=1 MallocLogFile=/dev/null CLAR_AT_EXIT="leaks -quiet \$PPID" \
47 ./libgit2_clar
48 ```