blob: 822574210ff995b77de0921248e907a7688e93e0 (
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
# -*- cmake -*-
project (lltest)
include(00-Common)
include(LLCommon)
include(LLCoreHttp)
include(Linking)
include(Tut)
include(LLAddBuildTest)
include(bugsplat)
include(GoogleMock)
set(test_SOURCE_FILES
io.cpp
llapp_tut.cpp
llblowfish_tut.cpp
llbuffer_tut.cpp
lldoubledispatch_tut.cpp
llevents_tut.cpp
llhttpdate_tut.cpp
llhttpnode_tut.cpp
lliohttpserver_tut.cpp
llmessageconfig_tut.cpp
llpermissions_tut.cpp
llpipeutil.cpp
llsaleinfo_tut.cpp
llsdmessagebuilder_tut.cpp
llsdmessagereader_tut.cpp
llsd_new_tut.cpp
llsdutil_tut.cpp
llservicebuilder_tut.cpp
llstreamtools_tut.cpp
lltemplatemessagebuilder_tut.cpp
lltut.cpp
message_tut.cpp
test.cpp
)
set(test_HEADER_FILES
CMakeLists.txt
debug.h
llpipeutil.h
llsdtraits.h
lltut.h
sync.h
)
if (NOT WINDOWS)
list(APPEND test_SOURCE_FILES
llmessagetemplateparser_tut.cpp
)
endif (NOT WINDOWS)
set_source_files_properties(${test_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
list(APPEND test_SOURCE_FILES ${test_HEADER_FILES})
add_executable(lltest ${test_SOURCE_FILES})
if (USE_BUGSPLAT)
set_target_properties(lltest PROPERTIES COMPILE_DEFINITIONS "${BUGSPLAT_DEFINE}")
endif (USE_BUGSPLAT)
target_link_libraries(lltest
${LEGACY_STDIO_LIBS}
${LLDATABASE_LIBRARIES}
llinventory
llmessage
llmath
llfilesystem
llxml
llcommon
llcorehttp
ll::googlemock
)
if (WINDOWS)
set_target_properties(lltest
PROPERTIES
LINK_FLAGS "/NODEFAULTLIB:LIBCMT"
LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\""
)
endif (WINDOWS)
set(TEST_EXE $<TARGET_FILE:lltest>)
SET_TEST_PATH(DYLD_LIBRARY_PATH)
LL_TEST_COMMAND(command
"${DYLD_LIBRARY_PATH}"
"${TEST_EXE}"
"--output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt"
"--touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt")
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt
COMMAND ${command}
DEPENDS lltest
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "C++ unit tests"
)
set(test_results ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt)
# This should cause the test executable to be built, but not
# run if LL_TESTS is disabled. This will hopefully keep the
# tests up to date with any code changes changes even if
# developers choose to disable LL_TESTS.
if (LL_TESTS)
add_custom_target(tests_ok ALL DEPENDS ${test_results})
endif (LL_TESTS)
|