Skip to content

Commit 3b63359

Browse files
Add test for internal threadpool and a new testing directory for internal APIs.
1 parent d6ce3dc commit 3b63359

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

test/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ if (${QTHREADS_BUILD_TESTS})
2929

3030
add_subdirectory(basics)
3131
add_subdirectory(features)
32+
add_subdirectory(internal)
3233
add_subdirectory(stress)
3334
endif()

test/internal/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# tests for internal APIs can access internal headers.
2+
include_directories("../../include")
3+
4+
qthreads_test(threadpool)

test/internal/threadpool.c

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include "argparsing.h"
2+
#include "qt_threadpool.h"
3+
4+
static int on_thread_test(void *arg) {
5+
printf("hello from thread\n");
6+
return 0;
7+
}
8+
9+
int main() {
10+
hw_pool_init(2);
11+
hw_pool_destroy();
12+
hw_pool_init(2);
13+
hw_pool_run_on_all(&on_thread_test, NULL);
14+
hw_pool_destroy();
15+
printf("exited successfully\n");
16+
fflush(stdout);
17+
return 0;
18+
}

0 commit comments

Comments
 (0)