summaryrefslogtreecommitdiffstats
path: root/libc/test/src/__support/CMakeLists.txt
blob: 91dd0dc4decfe060a59c1e6be1510cee6f17a6a8 (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
add_custom_target(libc-support-tests)

add_libc_test(
  blockstore_test
  SUITE
    libc-support-tests
  SRCS
    blockstore_test.cpp
  DEPENDS
    libc.src.__support.blockstore
)

add_libc_test(
  endian_test
  SUITE
    libc-support-tests
  SRCS
    endian_test.cpp
  DEPENDS
    libc.src.__support.common
)

add_libc_test(
  math_extras_test
  SUITE
    libc-support-tests
  SRCS
    math_extras_test.cpp
  DEPENDS
    libc.src.__support.integer_literals
    libc.src.__support.math_extras
    libc.src.__support.uint128
)

add_libc_test(
  high_precision_decimal_test
  SUITE
    libc-support-tests
  SRCS
  high_precision_decimal_test.cpp
  DEPENDS
    libc.src.__support.high_precision_decimal
    libc.src.__support.uint128
)

add_libc_test(
  str_to_float_test
  SUITE
    libc-support-tests
  SRCS
    str_to_float_test.cpp
    str_to_double_test.cpp
    str_to_long_double_test.cpp
  DEPENDS
    libc.src.__support.integer_literals
    libc.src.__support.str_to_float
    libc.src.__support.uint128
    libc.src.errno.errno
)


add_libc_test(
  str_to_integer_test
  SUITE
    libc-support-tests
  SRCS
    str_to_integer_test.cpp
  DEPENDS
    libc.src.__support.integer_literals
    libc.src.__support.str_to_integer
    libc.src.errno.errno
)

add_libc_test(
  integer_to_string_test
  SUITE
    libc-support-tests
  SRCS
    integer_to_string_test.cpp
  DEPENDS
    libc.src.__support.CPP.string_view
    libc.src.__support.integer_literals
    libc.src.__support.integer_to_string
    libc.src.__support.uint
    libc.src.__support.uint128
)

# The GPU does not support varargs currently.
if(NOT LIBC_TARGET_OS_IS_GPU)
  add_libc_test(
    arg_list_test
    SUITE
      libc-support-tests
    SRCS
      arg_list_test.cpp
    DEPENDS
      libc.src.__support.arg_list
  )
endif()

if(NOT LIBC_TARGET_ARCHITECTURE_IS_NVPTX)
  add_libc_test(
    uint_test
    SUITE
      libc-support-tests
    SRCS
      uint_test.cpp
    DEPENDS
      libc.src.__support.CPP.optional
      libc.src.__support.macros.properties.types
      libc.src.__support.uint
  )
endif()

add_libc_test(
  integer_literals_test
  SUITE
    libc-support-tests
  SRCS
    integer_literals_test.cpp
  DEPENDS
    libc.src.__support.CPP.optional
    libc.src.__support.integer_literals
    libc.src.__support.macros.properties.types
)

add_libc_test(
  fixedvector_test
  SUITE
    libc-support-tests
  SRCS
    fixedvector_test.cpp
  DEPENDS
    libc.src.__support.fixedvector
)

add_libc_test(
  char_vector_test
  SUITE
    libc-support-tests
  SRCS
    char_vector_test.cpp
  DEPENDS
    libc.src.__support.char_vector
)

add_libc_test(
  hash_test
  SUITE
    libc-support-tests
  SRCS
    hash_test.cpp
  DEPENDS
    libc.src.__support.hash
    libc.src.__support.CPP.new
    libc.src.stdlib.rand
    libc.src.stdlib.srand
    libc.src.string.memset
  UNIT_TEST_ONLY
    # Aligned Allocation is not supported in hermetic builds.
)

add_libc_test(
  memory_size_test
  SUITE
    libc-support-tests
  SRCS
    memory_size_test.cpp
  DEPENDS
    libc.src.__support.memory_size
)

# FIXME: We shouldn't have regular executables created because we could be
#        cross-compiling the tests and running through an emulator.
if(NOT LIBC_TARGET_OS_IS_GPU)
  add_executable(
    libc_str_to_float_comparison_test
    str_to_float_comparison_test.cpp
  )

  target_link_libraries(libc_str_to_float_comparison_test
    PRIVATE
      "${LIBC_TARGET}"
  )

  add_executable(
    libc_system_str_to_float_comparison_test
    str_to_float_comparison_test.cpp
  )

  set(float_test_file ${CMAKE_CURRENT_SOURCE_DIR}/str_to_float_comparison_data.txt)

  add_custom_command(TARGET libc_str_to_float_comparison_test
                     POST_BUILD
                     COMMAND $<TARGET_FILE:libc_str_to_float_comparison_test> ${float_test_file}
                     DEPENDS ${float_test_file}
                     COMMENT "Test the strtof and strtod implementations against precomputed results."
                     VERBATIM)
endif()

add_subdirectory(CPP)
add_subdirectory(File)
add_subdirectory(RPC)
add_subdirectory(OSUtil)
add_subdirectory(FPUtil)
add_subdirectory(fixed_point)
add_subdirectory(HashTable)