• Show log

    Commit

  • Hash : 0d12b8dd
    Author : Patrick Steinhardt
    Date : 2019-07-19T09:43:34

    tests: repo: refactor setup of templates and repos
    
    All tests in repo::template have a common pattern of first setting up
    templates, then settung up the repository that makes use of those
    templates via several init options. Refactor this pattern into two
    functions `setup_templates` and `setup_repo` that handle most of that
    logic to make it easier to spot what a test actually wants to check.
    
    Furthermore, this also refactors how we clean up after the tests.
    Previously, it was a combination of manually calling
    `cl_fixture_cleanup` and `cl_set_cleanup`, which really is kind of hard
    to read. This commit refactors this to instead provide the cleaning
    parameters in the setup functions. All cleanups are then performed in
    the suite's cleanup function.
    

  • README.md

  • Writing Clar tests for libgit2

    For information on the Clar testing framework and a detailed introduction please visit:

    https://github.com/vmg/clar

    • Write your modules and tests. Use good, meaningful names.

    • Make sure you actually build the tests by setting:

        cmake -DBUILD_CLAR=ON build/
    • Test:

        ./build/libgit2_clar
    • Make sure everything is fine.

    • Send your pull request. That’s it.

    Memory leak checks

    These are automatically run as part of CI, but if you want to check locally:

    Linux

    Uses valgrind:

    $ cmake -DBUILD_CLAR=ON -DVALGRIND=ON ..
    $ cmake --build .
    $ valgrind --leak-check=full --show-reachable=yes --num-callers=50 --suppressions=../libgit2_clar.supp \
      ./libgit2_clar

    macOS

    Uses leaks, which requires XCode installed:

    $ MallocStackLogging=1 MallocScribble=1 MallocLogFile=/dev/null CLAR_AT_EXIT="leaks -quiet \$PPID" \
      ./libgit2_clar