CMakeLists.txt
1.72 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
88
add_libc_testsuite(libc_string_unittests)
add_subdirectory(memory_utils)
add_libc_unittest(
strcat_test
SUITE
libc_string_unittests
SRCS
strcat_test.cpp
DEPENDS
libc.src.string.strcat
)
add_libc_unittest(
strcpy_test
SUITE
libc_string_unittests
SRCS
strcpy_test.cpp
DEPENDS
libc.src.string.strcpy
)
add_libc_unittest(
strlen_test
SUITE
libc_string_unittests
SRCS
strlen_test.cpp
DEPENDS
libc.src.string.strlen
)
add_libc_unittest(
strcmp_test
SUITE
libc_string_unittests
SRCS
strcmp_test.cpp
DEPENDS
libc.src.string.strcmp
)
add_libc_unittest(
memchr_test
SUITE
libc_string_unittests
SRCS
memchr_test.cpp
DEPENDS
libc.src.string.memchr
)
add_libc_unittest(
strchr_test
SUITE
libc_string_unittests
SRCS
strchr_test.cpp
DEPENDS
libc.src.string.strchr
)
# Tests all implementations that can run on the host.
function(add_libc_multi_impl_test name)
get_property(fq_implementations GLOBAL PROPERTY ${name}_implementations)
foreach(fq_config_name IN LISTS fq_implementations)
get_target_property(required_cpu_features ${fq_config_name} REQUIRE_CPU_FEATURES)
host_supports(can_run "${required_cpu_features}")
if(can_run)
add_libc_unittest(
${fq_config_name}_test
SUITE
libc_string_unittests
DEPENDS
${fq_config_name}
${ARGN}
)
else()
message(STATUS "Skipping test for '${fq_config_name}' insufficient host cpu features '${required_cpu_features}'")
endif()
endforeach()
endfunction()
add_libc_multi_impl_test(memcpy SRCS memcpy_test.cpp)
add_libc_multi_impl_test(memset SRCS memset_test.cpp)
add_libc_multi_impl_test(bzero SRCS bzero_test.cpp)