Hash :
ab042161
Author :
Date :
2022-01-18T08:12:18
tree: move git_oid into tree entry A tree entry previously pointed directly into the object id within the tree object itself; this is useful to avoid any unnecessary memory copy (and an unnecessary use of 40 bytes per tree entry) but difficult if we change the underlying `git_oid` object to not simply be a raw object id but have additional structure. This commit moves the `git_oid` directly into the tree entry; this simplifies the tree entry creation from user data. We now copy the `git_oid` into place when parsing.
Git HTTP | https://git.kmx.io/thodg/libgit2.git |
---|---|
Git SSH | git@git.kmx.io:thodg/libgit2.git |
Public access ? | public |
Description | |
Users |
![]() |
Tags |
|
These are the unit and integration tests for the libgit2 projects.
benchmarks
These are benchmark tests that excercise the CLI. clar
headertest
libgit2
resources
util
libgit2 uses the clar test framework, a C testing framework.
The best resources for learning clar are clar itself and the existing tests within libgit2. In general:
If you place a .c
file into a test directory, it is eligible to contain
test cases.
The function name for your test is important; test function names begin
with test_
, followed by the folder path (underscore separated), two
underscores as a delimiter, then the test name. For example, a file
merge/analysis.c
may contain a test uptodate
:
void test_merge_analysis__uptodate(void)
{
...
}
You can run an individual test by passing -s
to the test runner. Tests
are referred to by their function names; for example, the function
test_merge_analysis__uptodate
is referred to as merge::analysis::uptodate
.
To run only that function you can use the -s
option on the test runner:
libgit2_tests -smerge::analysis::uptodate
These are automatically run as part of CI, but if you want to check locally:
Uses valgrind
:
$ cmake -DBUILD_TESTS=ON -DVALGRIND=ON ..
$ cmake --build .
$ valgrind --leak-check=full --show-reachable=yes --num-callers=50 --suppressions=../libgit2_tests.supp \
./libgit2_tests
Uses leaks
, which requires XCode installed:
$ MallocStackLogging=1 MallocScribble=1 MallocLogFile=/dev/null CLAR_AT_EXIT="leaks -quiet \$PPID" \
./libgit2_tests
Build with the WIN32_LEAKCHECK
option:
$ cmake -DBUILD_TESTS=ON -DWIN32_LEAKCHECK=ON ..
$ cmake --build .
$ ./libgit2_tests