-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathtesting.cmake
More file actions
87 lines (72 loc) · 3.97 KB
/
testing.cmake
File metadata and controls
87 lines (72 loc) · 3.97 KB
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
if (__testing_columnar_includedd)
return ()
endif ()
set ( __testing_columnar_includedd YES )
include ( CTest )
if (NOT BUILD_TESTING)
return ()
endif ()
if ((NOT TARGET columnar_lib) AND (NOT TARGET secondary_index))
return ()
endif ()
# cb called by manticore ubertest adding tests - add special columnar\secondary-pass for rt tests
function ( special_ubertest_addtest testN tst_name REQUIRES )
if (NOT NON-RT IN_LIST REQUIRES AND NOT NON-COLUMNAR IN_LIST REQUIRES)
add_ubertest ( "${testN}" "${tst_name}" "${REQUIRES}" "col" "COLUMNAR" "--rt --ignore-weights --columnar" )
elseif (NOT NON-SECONDARY IN_LIST REQUIRES)
add_ubertest ( "${testN}" "${tst_name}" "${REQUIRES}" "secondary" "SECONDARY" "" )
endif ()
endfunction ()
# cb called by manticore ubertest - filter out non-columnar or non-secondary here.
function ( special_ubertest_filter accept_var explain_var REQUIRES )
if ((NOT COLUMNAR IN_LIST REQUIRES) AND (NOT SECONDARY IN_LIST REQUIRES))
set ( ${accept_var} 0 PARENT_SCOPE )
set ( ${explain_var} "not specially columnar" PARENT_SCOPE )
endif ()
endfunction ()
# cb called by manticore ubertest - append path to columnar to given test properties
function ( special_ubertest_properties test )
set_property ( TEST "${test}" APPEND PROPERTY ENVIRONMENT "LIB_MANTICORE_COLUMNAR=$<TARGET_FILE:columnar_lib>" )
set_property ( TEST "${test}" APPEND PROPERTY ENVIRONMENT "LIB_MANTICORE_SECONDARY=$<TARGET_FILE:secondary_index>" )
set_property ( TEST "${test}" APPEND PROPERTY ENVIRONMENT "LIB_MANTICORE_KNN=$<TARGET_FILE:knn_lib>" )
set ( EMBEDDINGS_LIB_PATH "" )
if ( MANTICORE_KNN_EMBEDDINGS_LIB )
set ( EMBEDDINGS_LIB_PATH "${MANTICORE_KNN_EMBEDDINGS_LIB}" )
elseif ( TARGET embeddings )
get_target_property ( EMBEDDINGS_LIB_PATH embeddings IMPORTED_LOCATION )
endif ()
if ( EMBEDDINGS_LIB_PATH )
set_property ( TEST "${test}" APPEND PROPERTY ENVIRONMENT "LIB_MANTICORE_KNN_EMBEDDINGS=${EMBEDDINGS_LIB_PATH}" )
endif ()
endfunction ()
if ( MANTICORE_KNN_EMBEDDINGS_LIB )
message ( STATUS "Using manticoresearch text embeddings library for tests: ${MANTICORE_KNN_EMBEDDINGS_LIB}" )
elseif ( TARGET embeddings )
get_target_property ( EMBEDDINGS_LIB_PATH embeddings IMPORTED_LOCATION )
if ( EMBEDDINGS_LIB_PATH )
message ( STATUS "Using manticoresearch text embeddings library for tests: ${EMBEDDINGS_LIB_PATH}" )
endif ()
endif ()
# this will switch off pure manticore-specific tests: google, api, keyword consistency and benches (we don't need them here)
set ( TEST_SPECIAL_EXTERNAL ON )
message ( STATUS "Checking MANTICORE_LOCATOR sources..." )
if (DEFINED ENV{MANTICORE_LOCATOR} AND NOT "$ENV{MANTICORE_LOCATOR}" STREQUAL "")
set ( MANTICORE_LOCATOR $ENV{MANTICORE_LOCATOR} )
message ( STATUS "Using MANTICORE_LOCATOR from environment: '${MANTICORE_LOCATOR}'" )
elseif (EXISTS "${columnar_SOURCE_DIR}/local_manticore_src.txt")
file ( READ "${columnar_SOURCE_DIR}/local_manticore_src.txt" MANTICORE_LOCATOR )
message ( STATUS "Using MANTICORE_LOCATOR from local_manticore_src.txt: '${MANTICORE_LOCATOR}'" )
else ()
file ( READ "${columnar_SOURCE_DIR}/manticore_src.txt" MANTICORE_LOCATOR )
message ( STATUS "Using MANTICORE_LOCATOR from manticore_src.txt: '${MANTICORE_LOCATOR}'" )
endif ()
message ( STATUS "MANTICORE_LOCATOR before configure: '${MANTICORE_LOCATOR}'" )
string ( CONFIGURE "${MANTICORE_LOCATOR}" MANTICORE_LOCATOR ) # that is to expand possible inside variables
message ( STATUS "MANTICORE_LOCATOR after configure: '${MANTICORE_LOCATOR}'" )
file ( WRITE "${columnar_BINARY_DIR}/manticore-get.cmake" "FetchContent_Declare ( manticore ${MANTICORE_LOCATOR} )\n" )
message ( STATUS "Written to ${columnar_BINARY_DIR}/manticore-get.cmake: 'FetchContent_Declare ( manticore ${MANTICORE_LOCATOR} )'" )
include ( FetchContent )
include ( "${columnar_BINARY_DIR}/manticore-get.cmake" )
# add manticore sources to the tree. All testing will be done on manticore side; necessary additional tests/properties will
# be set by cb functions defined above.
FetchContent_MakeAvailable ( manticore )