Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: git/git
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 83f1add914c6b4682de1e944ec0d1ac043d53d78
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 951105664dd4de73a8c949b0fb875e895d149ece
Choose a head ref
  • 9 commits
  • 11 files changed
  • 4 contributors

Commits on Feb 3, 2024

  1. Merge branch 'jk/unit-tests-buildfix' into js/unit-test-suite-runner

    * jk/unit-tests-buildfix:
      t/Makefile: say the default target upfront
      t/Makefile: get UNIT_TESTS list from C sources
      Makefile: remove UNIT_TEST_BIN directory with "make clean"
      Makefile: use mkdir_p_parent_template for UNIT_TEST_BIN
    gitster committed Feb 3, 2024
    Configuration menu
    Copy the full SHA
    483b759 View commit details
    Browse the repository at this point in the history

Commits on May 6, 2024

  1. t0080: turn t-basic unit test into a helper

    While t/unit-tests/t-basic.c uses the unit-test framework added in
    e137fe3 (unit tests: add TAP unit test framework, 2023-11-09), it is
    not a true unit test in that it intentionally fails in order to exercise
    various codepaths in the unit-test framework. Thus, we intentionally
    exclude it when running unit tests through the various t/Makefile
    targets. Instead, it is executed by t0080-unit-test-output.sh, which
    verifies its output follows the TAP format expected for the various
    pass, skip, or fail cases.
    
    As such, it makes more sense for t-basic to be a helper item for
    t0080-unit-test-output.sh, so let's move it to
    t/helper/test-example-tap.c and adjust Makefiles as necessary.
    
    Signed-off-by: Josh Steadmon <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    steadmon authored and gitster committed May 6, 2024
    Configuration menu
    Copy the full SHA
    80bb227 View commit details
    Browse the repository at this point in the history
  2. test-tool run-command testsuite: get shell from env

    When running tests through `test-tool run-command testsuite`, we
    currently hardcode `sh` as the command interpreter. As discussed in [1],
    this is incorrect, and we should be using the shell set in
    TEST_SHELL_PATH instead.
    
    Add a shell_path field in struct testsuite so that we can pass this to
    the task runner callback. If this is non-null, we'll use it as the
    argv[0] of the subprocess. Otherwise, we'll just execute the test
    program directly. We will use this feature in a later commit to enable
    running binary executable unit tests.
    
    However, for now when setting up the struct testsuite in testsuite(),
    use the value of TEST_SHELL_PATH if it's set, otherwise keep the
    original behavior by defaulting to `sh`.
    
    [1] https://lore.kernel.org/git/[email protected]/
    
    Signed-off-by: Josh Steadmon <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    steadmon authored and gitster committed May 6, 2024
    Configuration menu
    Copy the full SHA
    22f0df7 View commit details
    Browse the repository at this point in the history
  3. test-tool run-command testsuite: remove hardcoded filter

    `test-tool run-command testsuite` currently assumes that it will only be
    running the shell test suite, and therefore filters out anything that
    does not match a hardcoded pattern of "t[0-9][0-9][0-9][0-9]-*.sh".
    
    Later in this series, we'll adapt `test-tool run-command testsuite` to
    also support unit tests, which do not follow the same naming conventions
    as the shell tests, so this hardcoded pattern is inconvenient.
    
    Since `testsuite` also allows specifying patterns on the command-line,
    let's just remove this pattern. As noted in [1], there are no longer any
    uses of `testsuite` in our codebase, it should be OK to break backwards
    compatibility in this case. We also add a new filter to avoid trying to
    execute "." and "..", so that users who wish to execute every test in a
    directory can do so without specifying a pattern.
    
    [1] https://lore.kernel.org/git/[email protected]/
    
    Signed-off-by: Josh Steadmon <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    steadmon authored and gitster committed May 6, 2024
    Configuration menu
    Copy the full SHA
    d28c5a5 View commit details
    Browse the repository at this point in the history
  4. test-tool run-command testsuite: support unit tests

    Teach the testsuite runner in `test-tool run-command testsuite` how to
    run unit tests: if TEST_SHELL_PATH is not set, run the programs directly
    from CWD, rather than defaulting to "sh" as an interpreter.
    
    With this change, you can now use test-tool to run the unit tests:
    $ make
    $ cd t/unit-tests/bin
    $ ../../helper/test-tool run-command testsuite
    
    This should be helpful on Windows to allow running tests without
    requiring Perl (for `prove`), as discussed in [1] and [2].
    
    This again breaks backwards compatibility, as it is now required to set
    TEST_SHELL_PATH properly for executing shell scripts, but again, as
    noted in [2], there are no longer any such invocations in our codebase.
    
    [1] https://lore.kernel.org/git/[email protected]/
    [2] https://lore.kernel.org/git/[email protected]/
    
    Signed-off-by: Josh Steadmon <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    steadmon authored and gitster committed May 6, 2024
    Configuration menu
    Copy the full SHA
    a2b55e2 View commit details
    Browse the repository at this point in the history
  5. unit tests: add rule for running with test-tool

    In the previous commit, we added support in test-tool for running
    collections of unit tests. Now, add rules in t/Makefile for running in
    this way.
    
    This new rule can be executed from the top-level Makefile via
    `make DEFAULT_UNIT_TEST_TARGET=unit-tests-test-tool unit-tests`, or by
    setting DEFAULT_UNIT_TEST_TARGET in config.mak.
    
    Signed-off-by: Josh Steadmon <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    steadmon authored and gitster committed May 6, 2024
    Configuration menu
    Copy the full SHA
    5bbc8c9 View commit details
    Browse the repository at this point in the history
  6. t/Makefile: run unit tests alongside shell tests

    Add a wrapper script to allow `prove` to run both shell tests and unit
    tests from a single invocation. This avoids issues around running prove
    twice in CI, as discussed in [1].
    
    Additionally, this moves the unit tests into the main dev workflow, so
    that errors can be spotted more quickly. Accordingly, we remove the
    separate unit tests step for Linux CI. (We leave the Windows CI
    unit-test step as-is, because the sharding scheme there involves
    selecting specific test files rather than running `make test`.)
    
    [1] https://lore.kernel.org/git/[email protected]/
    
    Signed-off-by: Jeff King <[email protected]>
    Signed-off-by: Josh Steadmon <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    peff authored and gitster committed May 6, 2024
    Configuration menu
    Copy the full SHA
    cc75e4a View commit details
    Browse the repository at this point in the history
  7. ci: use test-tool as unit test runner on Windows

    Although the previous commit changed t/Makefile to run unit tests
    alongside shell tests, the Windows CI still needs a separate unit-tests
    step due to how the test sharding works.
    
    We want to avoid using `prove` as a test running on Windows due to
    performance issues [1], so use the new test-tool runner instead.
    
    [1] https://lore.kernel.org/git/[email protected]/
    
    Signed-off-by: Josh Steadmon <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    steadmon authored and gitster committed May 6, 2024
    Configuration menu
    Copy the full SHA
    b121eed View commit details
    Browse the repository at this point in the history
  8. cmake: let test-tool run the unit tests, too

    The `test-tool` recently learned to run the unit tests. To this end, it
    needs to link with `test-lib.c`, which was done in the `Makefile`, and
    this patch does it in the CMake definition, too.
    
    This is a companion of 44400f5 (t0080: turn t-basic unit test into
    a helper, 2024-02-02).
    
    Signed-off-by: Johannes Schindelin <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    dscho authored and gitster committed May 6, 2024
    Configuration menu
    Copy the full SHA
    9511056 View commit details
    Browse the repository at this point in the history
Loading