Files
2026-04-30 21:00:32 +02:00
..
2025-12-10 09:29:42 +01:00
2026-04-04 22:35:27 +02:00
2026-04-30 21:00:32 +02:00
2026-04-30 21:00:32 +02:00
2025-12-06 19:42:09 +01:00
2024-06-17 18:36:05 +02:00
2021-09-24 21:45:15 +02:00
2024-03-21 19:08:57 +01:00
2024-03-10 20:57:59 +01:00
2024-06-17 18:36:05 +02:00
2018-01-27 21:44:46 +01:00
2023-04-01 11:20:53 +02:00
2023-03-29 10:09:44 +02:00
2023-03-31 20:20:51 +02:00
2023-04-02 10:54:04 +02:00
2023-04-02 10:54:04 +02:00
2023-03-29 10:14:48 +02:00
2023-04-02 11:02:32 +02:00
2026-04-04 22:35:27 +02:00
2025-12-02 10:14:28 +01:00

primecount testing

Run the commands below from the primecount root directory.

cmake . -DBUILD_TESTS=ON
cmake --build . --parallel
ctest

To enable the optional architecture-specific assembly codegen tests use:

cmake . -DBUILD_CODEGEN_TESTS=ON

Please note that these assembly codegen tests should not be enabled when packaging primecount for Linux distros. The purpose of these assembly codegen tests is to debug performance issues, not corretness issues. These tests are run as part of primecount's GitHub Actions CI.

Test in debug mode

When hacking on primecount's source code, it is best to run its test suite in debug mode i.e. -DCMAKE_BUILD_TYPE=Debug because this enables extensive (but slow) runtime assertions. In case an assertion is triggered, the file name and line number where the error occurred will be printed to the screen. This helps to quickly identify newly introduced bugs.

# Run commands from primecount root directory
cmake . -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-O1 -Wall -Wextra -pedantic" -DCMAKE_C_FLAGS="-O1 -Wall -Wextra -pedantic"
cmake --build . --parallel
ctest --output-on-failure

Test using GCC/Clang sanitizers

Running primecount's test suite with sanitizers enabled is also very useful as this helps find undefined behavior bugs and data races.

# Run commands from primecount root directory
cmake . -DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS="-g -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer -Wall -Wextra -pedantic" -DCMAKE_C_FLAGS="-g -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fno-omit-frame-pointer -Wall -Wextra -pedantic"
cmake --build . --parallel
ctest --output-on-failure