Page MenuHomePhabricator

[CMAKE] Allow test_bitcoin unit tests to run in parallel
AbandonedPublic

Authored by Fabien on Feb 4 2019, 11:32.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Summary

Add a new JCTEST variable to cmake that allow for running the tests in
parallel using multiple jobs. The variable is cached by cmake, so
running ninja multiple times will use the same variable value. Default
is to run a single job.

Even if this is not strictly a dependency, running the test plan is more
efficient if done on top of D2496.

Test Plan
mkdir buildcmake && cd buildcmake

Build and run tests on 1 job:

cmake -GNinja .. && ninja -j1 check

Build on 4 jobs and run tests on 1 job:

cmake -GNinja .. && ninja -j4 check

Build on 4 jobs and run tests on 2 jobs:

cmake -DJCTEST=2 -GNinja .. && ninja -j4 check

Build on 6 jobs and run tests on 2 jobs:

ninja -j6 check

Diff Detail

Repository
rABC Bitcoin ABC
Branch
cmake_tests_parallel
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 4864
Build 7791: Bitcoin ABC Teamcity Staging
Build 7790: arc lint + arc unit

Event Timeline

Fabien created this revision.Feb 4 2019, 11:32
Herald added a reviewer: Restricted Project. · View Herald TranscriptFeb 4 2019, 11:32
Herald added a subscriber: schancel. · View Herald Transcript
deadalnix requested changes to this revision.Feb 4 2019, 11:56

None of this is doing what the test plan says it does. Have you really tested this ?

This revision now requires changes to proceed.Feb 4 2019, 11:56
Fabien edited the test plan for this revision. (Show Details)Feb 4 2019, 12:11
Fabien edited the test plan for this revision. (Show Details)Feb 4 2019, 12:18
Fabien edited the test plan for this revision. (Show Details)
Fabien requested review of this revision.Feb 4 2019, 12:22

Run cmake from build directory in test plan
@deadalnix I suppose this is what you meant ? Or is there something else ? Of course I tested all of this

deadalnix added a comment.EditedFeb 4 2019, 12:34

ninja will by default create as many jobs as it thinks your machine can take.

If you run ninja check-all , you'll notice that various tests are not waiting on each others.

None of this matches what's described in the test plan.

deadalnix requested changes to this revision.Feb 4 2019, 12:56
This revision now requires changes to proceed.Feb 4 2019, 12:56
Fabien edited the test plan for this revision. (Show Details)Feb 4 2019, 13:31
Fabien abandoned this revision.Feb 4 2019, 13:47

Newer cmake version would run test suites in parallel.
Running tests within suites in parallel could overcharge the cpu