summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2014-04-22 13:20:45 -0700
committerEric Anholt <eric@anholt.net>2014-10-10 17:27:07 +0200
commitdd1982d7709849410277baf78d6fcafee5101c29 (patch)
treed23da830ccc4a25a7cd6243410d6db1a3c794562 /CMakeLists.txt
parent1ea4e712649573bf226950b4ee7b2c77b2e27042 (diff)
Add piglit_set_timeout for tests that might hang.
Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt31
1 files changed, 28 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 14d292730..c6c48bcb3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -302,10 +302,16 @@ if (OPENGL_FOUND)
endif (APPLE)
endif()
+if(CMAKE_USE_PTHREADS_INIT)
+ set(PIGLIT_HAS_PTHREADS true)
+ add_definitions(-DPIGLIT_HAS_PTHREADS)
+endif()
+
FIND_LIBRARY(HAVE_LIBRT NAMES rt)
if(HAVE_LIBRT)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} rt)
endif()
+
check_c_source_compiles(
"
#define _POSIX_C_SOURCE 199309L
@@ -314,15 +320,34 @@ check_c_source_compiles(
"
PIGLIT_HAS_POSIX_CLOCK_MONOTONIC
)
+
+if(PIGLIT_HAS_PTHREADS AND PIGLIT_HAS_POSIX_CLOCK_MONOTONIC)
+ check_c_source_compiles(
+ "
+ #include <signal.h>
+ #include <time.h>
+ static void timeout(union sigval val) { }
+ int main() {
+ struct sigevent sev = {
+ .sigev_notify = SIGEV_THREAD,
+ .sigev_notify_function = timeout,
+ };
+ timer_t timerid;
+ return timer_create(CLOCK_MONOTONIC, &sev, &timerid);
+ }
+ "
+ PIGLIT_HAS_POSIX_TIMER_NOTIFY_THREAD
+ )
+endif()
+
set(CMAKE_REQUIRED_LIBRARIES)
if(PIGLIT_HAS_POSIX_CLOCK_MONOTONIC)
add_definitions(-DPIGLIT_HAS_POSIX_CLOCK_MONOTONIC)
endif()
-if(CMAKE_USE_PTHREADS_INIT)
- set(PIGLIT_HAS_PTHREADS true)
- add_definitions(-DPIGLIT_HAS_PTHREADS)
+if(PIGLIT_HAS_POSIX_TIMER_NOTIFY_THREAD)
+ add_definitions(-DPIGLIT_HAS_POSIX_TIMER_NOTIFY_THREAD)
endif()
if(PIGLIT_USE_WAFFLE AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")