1add_libc_testsuite(libc_string_unittests)
2
3add_subdirectory(memory_utils)
4
5add_libc_unittest(
6  strcat_test
7  SUITE
8    libc_string_unittests
9  SRCS
10    strcat_test.cpp
11  DEPENDS
12    # TODO (sivachandra): remove redundant deps.
13    libc.src.string.memcpy
14    libc.src.string.strcat
15    libc.src.string.strcpy
16    libc.src.string.strlen
17)
18
19add_libc_unittest(
20  strcpy_test
21  SUITE
22    libc_string_unittests
23  SRCS
24    strcpy_test.cpp
25  DEPENDS
26    # TODO (sivachandra): remove redundant deps.
27    libc.src.string.memcpy
28    libc.src.string.strcpy
29    libc.src.string.strlen
30)
31
32add_libc_unittest(
33  strlen_test
34  SUITE
35    libc_string_unittests
36  SRCS
37    strlen_test.cpp
38  DEPENDS
39    libc.src.string.strlen
40)
41
42# Tests all implementations of memcpy that can run on the host.
43get_property(memcpy_implementations GLOBAL PROPERTY memcpy_implementations)
44foreach(memcpy_config_name IN LISTS memcpy_implementations)
45  get_target_property(require_cpu_features libc.src.string.${memcpy_config_name} REQUIRE_CPU_FEATURES)
46  host_supports(can_run "${require_cpu_features}")
47  if(can_run)
48    add_libc_unittest(
49      ${memcpy_config_name}_test
50      SUITE
51        libc_string_unittests
52      SRCS
53        memcpy_test.cpp
54      DEPENDS
55        libc.src.string.${memcpy_config_name}
56    )
57  else()
58    message(STATUS "Skipping test for '${memcpy_config_name}' insufficient host cpu features")
59  endif()
60endforeach()
61
62