blob: 7a9b1394a4da7f90920f45efbc906e412869ddcf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# include(FetchContent)
# FetchContent_Declare(gtest
# QUIET
# URL https://github.com/google/googletest/archive/release-1.10.0.tar.gz
# )
# # configure build of googletest
# set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# set(BUILD_GMOCK OFF CACHE BOOL "" FORCE)
# FetchContent_MakeAvailable(gtest)
cmake_minimum_required(VERSION 2.8)
set(DEBUG_FLAGS "-O3")
include_directories(${PROJECT_SOURCE_DIR}/test)
include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${PROJECT_SOURCE_DIR}/src/tags)
include_directories(${PROJECT_SOURCE_DIR}/src/metrics)
include_directories(${PROJECT_SOURCE_DIR}/include/fieldstat)
# zlib, first install zlib from https://zlib.net/
# SET (ZLIB_ROOT "/home/chenzizhan/zlib")
# SET (ZLIB_INCLUDE_DIR "/home/chenzizhan/zlib/include/")
# SET (ZLIB_LIBRARY "/home/chenzizhan/zlib/lib/libz.so.1.2.13")
if (COVERAGE) # user defined
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage --coverage")
MESSAGE ("CMAKE_C_FLAGS in test is " ${CMAKE_C_FLAGS})
SET(LFLAGS "-lgcov --coverage")
endif()
FIND_PACKAGE (ZLIB REQUIRED)
MESSAGE (" zlib version major is " ${ZLIB_VERSION_MAJOR})
MESSAGE (" zlib version minor is " ${ZLIB_VERSION_MINOR})
MESSAGE (" zlib include is " ${ZLIB_INCLUDE_DIR})
MESSAGE (" zlib libraries are " ${ZLIB_LIBRARIES})
SET(TEST_UTILS_SRC
utils.cpp
)
function (add_unit_test file_name)
add_executable(${file_name} ${SRC} ${TEST_UTILS_SRC} ${file_name}.cpp)
target_link_libraries(${file_name} gtest-static ${ZLIB_LIBRARIES} ${LFLAGS}) #MESA_handle_logger
set_property(TARGET ${file_name} PROPERTY CXX_STANDARD 17)
endfunction()
add_unit_test(test_exporter_json)
add_unit_test(test_fuzz_test)
add_unit_test(test_merge)
add_unit_test(test_metric_counter)
add_unit_test(test_metric_histogram)
add_unit_test(test_metric_hll)
add_unit_test(test_performance)
add_unit_test(test_register_and_reset)
add_unit_test(test_serialize)
add_unit_test(unit_test_cell_manager)
|