Open
Description
Hello. While building the Debian package for onetbb (version 2021.13.0) on a system with only one CPU, I noticed that some tests never return. This results in a build log like this when the package is built with sbuild:
[...]
26/136 Test #26: test_enumerable_thread_specific .......... Passed 0.06 sec
Start 27: test_concurrent_queue
27/136 Test #27: test_concurrent_queue .................... Passed 0.24 sec
Start 28: test_resumable_tasks
28/136 Test #28: test_resumable_tasks ..................... Passed 82.19 sec
Start 29: test_mutex
29/136 Test #29: test_mutex ............................... Passed 0.04 sec
Start 30: test_function_node
E: Build killed with signal TERM after 90 minutes of inactivity
--------------------------------------------------------------------------------
If it's really the case that those tests are not meant to be executed on single-CPU systems, it would be worth to execute them conditionally, like this:
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -417,8 +417,10 @@
tbb_add_test(SUBDIR tbb NAME test_concurrent_queue DEPENDENCIES TBB::tbb)
tbb_add_test(SUBDIR tbb NAME test_resumable_tasks DEPENDENCIES TBB::tbb)
tbb_add_test(SUBDIR tbb NAME test_mutex DEPENDENCIES TBB::tbb)
- tbb_add_test(SUBDIR tbb NAME test_function_node DEPENDENCIES TBB::tbb)
- tbb_add_test(SUBDIR tbb NAME test_multifunction_node DEPENDENCIES TBB::tbb)
+ if(SYSTEM_CONCURRENCY GREATER 1)
+ tbb_add_test(SUBDIR tbb NAME test_function_node DEPENDENCIES TBB::tbb)
+ tbb_add_test(SUBDIR tbb NAME test_multifunction_node DEPENDENCIES TBB::tbb)
+ endif()
tbb_add_test(SUBDIR tbb NAME test_broadcast_node DEPENDENCIES TBB::tbb)
tbb_add_test(SUBDIR tbb NAME test_buffer_node DEPENDENCIES TBB::tbb)
tbb_add_test(SUBDIR tbb NAME test_composite_node DEPENDENCIES TBB::tbb)
@@ -442,7 +444,9 @@
tbb_add_test(SUBDIR tbb NAME test_tagged_msg DEPENDENCIES TBB::tbb)
tbb_add_test(SUBDIR tbb NAME test_overwrite_node DEPENDENCIES TBB::tbb)
tbb_add_test(SUBDIR tbb NAME test_write_once_node DEPENDENCIES TBB::tbb)
- tbb_add_test(SUBDIR tbb NAME test_async_node DEPENDENCIES TBB::tbb)
+ if(SYSTEM_CONCURRENCY GREATER 1)
+ tbb_add_test(SUBDIR tbb NAME test_async_node DEPENDENCIES TBB::tbb)
+ endif()
tbb_add_test(SUBDIR tbb NAME test_input_node DEPENDENCIES TBB::tbb)
tbb_add_test(SUBDIR tbb NAME test_profiling DEPENDENCIES TBB::tbb)
tbb_add_test(SUBDIR tbb NAME test_concurrent_queue_whitebox DEPENDENCIES TBB::tbb)
On the other hand, it may also be the case that the tests are actually meant to be executed everywhere and they are just buggy. I don't know.
I discovered this by using single-cpu virtual machines in the cloud, but it may also be reproduced easily by setting GRUB_CMDLINE_LINUX="nr_cpus=1"
.
Thanks.