test: Add makefile target for running unit tests #29377

pull TheCharlatan wants to merge 1 commits into bitcoin:master from TheCharlatan:unit_test_target changing 2 files +5 −2
  1. TheCharlatan commented at 7:19 PM on February 3, 2024: contributor

    make check runs a bunch of other subtree tests that exercise code that is hardly ever changed and have a comparatively long runtime. There seems to be no target for running just the unit tests, so add one.

    Alternatively the secp256k1 tests could be removed from the check-local target, reducing its runtime. This was rejected before though in #20264.

  2. test: Add makefile target for running unit tests
    make check runs a bunch of other subtree tests that exercise code that
    is hardly ever changed and have a comparatively long runtime. There
    seems to be no target for running just the unit tests, so add one.
    5ca9b24da1
  3. DrahtBot commented at 7:19 PM on February 3, 2024: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK delta1, edilmedeiros, ryanofsky, achow101

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. DrahtBot added the label Tests on Feb 3, 2024
  5. delta1 commented at 5:50 PM on February 4, 2024: none

    utACK 5ca9b24da18e842e7a093dc44f6b222af73e92cf

  6. edilmedeiros commented at 3:45 PM on February 5, 2024: contributor

    Tested ACK 5ca9b24da18e842e7a093dc44f6b222af73e92cf

    make -C src check-unit does execute the same unit tests as make check.

    I tried to include as many things as possible:

    Options used to compile and link:
      external signer = yes
      multiprocess    = no
      with libs       = yes
      with wallet     = yes
        with sqlite   = yes
        with bdb      = yes
      with gui / qt   = yes
        with qr       = yes
      with zmq        = yes
      with test       = yes
      with fuzz binary = yes
      with bench      = yes
      with upnp       = yes
      with natpmp     = no
      use asm         = yes
      USDT tracing    = no
      sanitizers      =
      debug enabled   = no
      gprof enabled   = no
      werror          = no
    
  7. edilmedeiros approved
  8. ryanofsky approved
  9. ryanofsky commented at 12:35 AM on February 7, 2024: contributor

    Tested ACK 5ca9b24da18e842e7a093dc44f6b222af73e92cf.

    This is very convenient but the check-unit target does not seem to depend on the test_bitcoin executable, so it can run with a stale test binary.

    I also noticed if I try to build and run the unit tests with make -j12 -C src test/test_bitcoin check-unit it will try to run the tests at the same time as building the test binary instead of waiting for the binary to be built.

    I also wonder if this new check-unit test option is redundant with the existing bitcoin_test_check target. It's not clear what the purpose of that target it supposed to be if not to run unit tests, it would be useful to have comments in the makefile saying what these targets are intended to be used for, and maybe deleting one or making one an alias for the other (since check-unit is easier to type).

  10. achow101 commented at 11:01 PM on February 8, 2024: member

    ACK 5ca9b24da18e842e7a093dc44f6b222af73e92cf

    I also wonder if this new check-unit test option is redundant with the existing bitcoin_test_check target.

    bitcoin_test_check just fails for me, so they are at least different in this aspect. It looks like this target is used by the check target in src/test/Makefile.

  11. achow101 merged this on Feb 8, 2024
  12. achow101 closed this on Feb 8, 2024

  13. jonatack commented at 8:59 PM on February 22, 2024: member

    Post-merge ACK. This certainly is handy, and I've switched my workflow to use it.

  14. PastaPastaPasta referenced this in commit 506f8881d2 on Oct 24, 2024
  15. PastaPastaPasta referenced this in commit f0968807bc on Oct 24, 2024
  16. PastaPastaPasta referenced this in commit aaccc9ea51 on Oct 24, 2024
  17. bitcoin locked this on Feb 21, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-15 15:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me