Skip to content

Commit

Permalink
Merge #272: cmake: Report skipped tests properly
Browse files Browse the repository at this point in the history
4d77971 fixup! cmake: Create test suite for `ctest` (Hennadii Stepanov)
16ac373 fixup! cmake: Build `test_bitcoin` executable (Hennadii Stepanov)

Pull request description:

  CMake allows to report about skipped tests properly instead of passing dummy test cases. For instance, on Windows:
  ```
  > ctest --build-config Release -R compilerbug
  Test project C:/Users/hebasto/source/repos/bitcoin/build
      Start 26: compilerbug_tests
  1/1 Test #26: compilerbug_tests ................***Skipped   0.02 sec

  100% tests passed, 0 tests failed out of 1

  Total Test time (real) =   0.04 sec

  The following tests did not run:
           26 - compilerbug_tests (Skipped)
  ```

  We have 3 such cases:
  - `src/test/compilerbug_tests.cpp`
  - `src/test/raii_event_tests.cpp`
  - `src/test/system_tests.cpp`

  This PR handles the first two cases.

  Once bitcoin#30454 is merged, the following lines can be deleted: https://github.com/hebasto/bitcoin/blob/9b4aa929b0e84e64472402e594ebb13648bac878/src/test/system_tests.cpp#L19-L25

Top commit has no ACKs.

Tree-SHA512: e4be4fd2469163fa4b3a36afb90f6186204f0151f668490305b6a7e632a6922cc4982233a6fc4bf2b1f7049658b42916a20e766197969aedd28f2eb097c4674d
  • Loading branch information
hebasto committed Jul 22, 2024
2 parents 9e4fd09 + 4d77971 commit ad99612
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
3 changes: 3 additions & 0 deletions cmake/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ if(TARGET test_bitcoin)
add_test(NAME ${test_suite_name}
COMMAND test_bitcoin --run_test=${test_suite_name} --catch_system_error=no
)
set_property(TEST ${test_suite_name} PROPERTY
SKIP_REGULAR_EXPRESSION "no test cases matching filter" "Skipping"
)
endif()
endfunction()

Expand Down
7 changes: 0 additions & 7 deletions src/test/compilerbug_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

BOOST_AUTO_TEST_SUITE(compilerbug_tests)

// At least one test case is required to avoid the "Test setup error: no test
// cases matching filter or all test cases were disabled" errror.
BOOST_AUTO_TEST_CASE(dummy)
{
BOOST_CHECK(true);
}

#if defined(__GNUC__)
// This block will also be built under clang, which is fine (as it supports noinline)
void __attribute__ ((noinline)) set_one(unsigned char* ptr)
Expand Down

0 comments on commit ad99612

Please sign in to comment.