Skip to content

test: Add makefile target for running unit tests #29377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2024

Conversation

TheCharlatan
Copy link
Contributor

@TheCharlatan TheCharlatan commented Feb 3, 2024

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.

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.
@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 3, 2024

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

Code Coverage

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

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.

@DrahtBot DrahtBot added the Tests label Feb 3, 2024
@delta1
Copy link

delta1 commented Feb 4, 2024

utACK 5ca9b24

@edilmedeiros
Copy link
Contributor

edilmedeiros commented Feb 5, 2024

Tested ACK 5ca9b24

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

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested ACK 5ca9b24.

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).

@achow101
Copy link
Member

achow101 commented Feb 8, 2024

ACK 5ca9b24

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.

@achow101 achow101 merged commit 0b3202d into bitcoin:master Feb 8, 2024
@jonatack
Copy link
Member

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

PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 24, 2024
5ca9b24 test: Add makefile target for running unit tests (TheCharlatan)

Pull request description:

  `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 bitcoin#20264.

ACKs for top commit:
  delta1:
    utACK 5ca9b24
  edilmedeiros:
    Tested ACK 5ca9b24
  achow101:
    ACK 5ca9b24
  ryanofsky:
    Tested ACK 5ca9b24.

Tree-SHA512: 470969d44585d7cc33ad038a16e791db9e2be8469f52ddf122c46f20776fad34e6a48f988861a132c42540158fed05f3cf66fcc3bea05708253daaa35af54339
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Oct 24, 2024
5ca9b24 test: Add makefile target for running unit tests (TheCharlatan)

Pull request description:

  `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 bitcoin#20264.

ACKs for top commit:
  delta1:
    utACK 5ca9b24
  edilmedeiros:
    Tested ACK 5ca9b24
  achow101:
    ACK 5ca9b24
  ryanofsky:
    Tested ACK 5ca9b24.

Tree-SHA512: 470969d44585d7cc33ad038a16e791db9e2be8469f52ddf122c46f20776fad34e6a48f988861a132c42540158fed05f3cf66fcc3bea05708253daaa35af54339
PastaPastaPasta added a commit to dashpay/dash that referenced this pull request Oct 24, 2024
b70e091 Merge bitcoin#29667: fuzz: actually test garbage >64b in p2p transport test (fanquake)
6d7aa3d Merge bitcoin#29497: test: simplify test_runner.py (fanquake)
d0e15d5 Merge bitcoin#29606: refactor: Reserve memory for ToLower/ToUpper conversions (Ava Chow)
045fa5f Merge bitcoin#29514: tests: Provide more helpful assert_equal errors (Ava Chow)
bd607f0 Merge bitcoin#29393: i2p: log connection was refused due to arbitrary port (Ava Chow)
c961755 Merge bitcoin#29595: doc: Wrap flags with code in developer-notes.md (fanquake)
8d6e5e7 Merge bitcoin#29583: fuzz: Apply fuzz env (suppressions, etc.) when fetching harness list (fanquake)
4dce690 Merge bitcoin#29576: Update functional test runner to return error code when no tests are found to run (fanquake)
910a7d6 Merge bitcoin#29529: fuzz: restrict fopencookie usage to Linux & FreeBSD (fanquake)
fdac2b3 Merge bitcoin#29493: subtree: update crc32c subtree (fanquake)
a23b342 Merge bitcoin#29475: doc: Fix Broken Links (fanquake)
92bad90 Merge bitcoin#28178: fuzz: Generate with random libFuzzer settings (fanquake)
9b6a05d Merge bitcoin#29443: depends: fix BDB compilation on OpenBSD (fanquake)
9963e6b Merge bitcoin#29413: fuzz: increase length of string used for `NetWhitelist{bind}Permissions::TryParse` (fanquake)
3914745 Merge bitcoin#29425: test: fix intermittent failure in wallet_reorgrestore.py (fanquake)
b719883 Merge bitcoin#29399: test: Fix utxo set hash serialisation signedness (fanquake)
f096880 Merge bitcoin#29377: test: Add makefile target for running unit tests (Ava Chow)
03e0bd3 Merge bitcoin#27319: addrman, refactor: improve stochastic test in `AddSingle` (Ava Chow)

Pull request description:

  ## Issue being fixed or feature implemented
  Batch of trivial backports

  ## What was done?
  See commits

  ## How Has This Been Tested?
  built locally; large combined merge passed tests locally

  ## Breaking Changes
  Should be none

  ## Checklist:
    _Go over all the following points, and put an `x` in all the boxes that apply._
  - [ ] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  UdjinM6:
    utACK b70e091
  knst:
    utACK b70e091

Tree-SHA512: 659a931f812c8a92cf3854abb873d92885219a392d6aa8e49ac4b27fe41e8e163ef9a135050e7c2e1bd33cecd2f7dae215e05a9c29f62e837e0057d3c16746d6
@bitcoin bitcoin locked and limited conversation to collaborators Feb 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants