Skip to content

Commit

Permalink
Integrate MT ID test with testframe testing framework (HDFGroup#38)
Browse files Browse the repository at this point in the history
* Integrate MT ID test with testframe testing framework

* Add environment variable to testframe framework for max. threads

Adds an environment variable to make it easier for CMake CI to specify
the maximum number of threads that multi-threaded tests can spawn in
addition to the main thread

* Update for const changes and handle errors at coarse granularity

---------

Co-authored-by: Matt L <[email protected]>
  • Loading branch information
jhendersonHDF and mattjala authored Jan 23, 2025
1 parent 3496e43 commit 79263cf
Show file tree
Hide file tree
Showing 4 changed files with 437 additions and 256 deletions.
12 changes: 10 additions & 2 deletions test/h5test.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,16 @@ typedef struct thread_info_t {
#ifdef H5_HAVE_MULTITHREAD
extern pthread_key_t test_thread_info_key_g;

#define IS_MAIN_TEST_THREAD (!TEST_EXECUTION_CONCURRENT ||\
((pthread_getspecific(test_thread_info_key_g)) && (((thread_info_t*)pthread_getspecific(test_thread_info_key_g))->thread_idx == 0)))
#define IS_MAIN_TEST_THREAD ( \
/* if GetTestMaxNumThreads() == 0, no additional threads can be spawned */ \
(GetTestMaxNumThreads() == 0) || \
/* if no thread-specific 'test_thread_info_key_g' key is set, we can't \
* determine which thread is the main thread anyway */ \
(pthread_getspecific(test_thread_info_key_g) == NULL) || \
/* for now, if a thread-specific 'test_thread_info_key_g' key is set, \
* assume that the thread with thread_idx 0 is the main thread */ \
(((thread_info_t*)pthread_getspecific(test_thread_info_key_g))->thread_idx == 0) \
)

#else
#define IS_MAIN_TEST_THREAD true
Expand Down
Loading

0 comments on commit 79263cf

Please sign in to comment.