From 9dc842a35da0ee163309709a1b20cede65d019c8 Mon Sep 17 00:00:00 2001 From: Hugues Delorme Date: Wed, 13 Jan 2016 10:55:59 +0100 Subject: [PATCH] tests: enable fast_atof() benchmark check only for release builds --- CMakeLists.txt | 8 ++++++++ src/gmio_core/config.h.cmake | 3 +++ tests/test_core_benchmark_fast_atof.c | 2 ++ 3 files changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4aa30bf..1f2a6cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,14 @@ if(CMAKE_COMPILER_IS_GNUCC set(CMAKE_C_COMPILER_IS_GCC_COMPATIBLE 1) # Compatible with GNUCC options endif() +# Build type +string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER) +if(CMAKE_BUILD_TYPE_LOWER MATCHES "debug") + set(GMIO_DEBUG_BUILD 1) +else() + set(GMIO_DEBUG_BUILD 0) +endif() + # Options option(GMIO_BUILD_STRICT_C90 "Build gmio library(and tests) with strict conformance to C90 standard" OFF) option(GMIO_BUILD_SHARED_LIBS "Build gmio as a shared library (DLL)" OFF) diff --git a/src/gmio_core/config.h.cmake b/src/gmio_core/config.h.cmake index e724dad..2856ff9 100644 --- a/src/gmio_core/config.h.cmake +++ b/src/gmio_core/config.h.cmake @@ -18,6 +18,9 @@ #ifndef GMIO_CONFIG_H_CMAKE #define GMIO_CONFIG_H_CMAKE +/* Build type */ +#cmakedefine GMIO_DEBUG_BUILD + /* Size(in bytes) of integer types */ #cmakedefine GMIO_SIZEOF_SHORT @GMIO_SIZEOF_SHORT@ #cmakedefine GMIO_SIZEOF_INT @GMIO_SIZEOF_INT@ diff --git a/tests/test_core_benchmark_fast_atof.c b/tests/test_core_benchmark_fast_atof.c index 82b9c3d..21ca476 100644 --- a/tests/test_core_benchmark_fast_atof.c +++ b/tests/test_core_benchmark_fast_atof.c @@ -177,7 +177,9 @@ const char* test_internal__benchmark_gmio_fast_atof() header, bmk_res_array); +#ifndef GMIO_DEBUG_BUILD /* Check only for release builds */ UTEST_ASSERT((1.2*bmk_res.func1_exec_time_ms) < bmk_res.func2_exec_time_ms); +#endif return NULL; }