<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/129838>129838</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc] str_to_float_comparison_test should be hermetic
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
RossComputerGuy
</td>
</tr>
</table>
<pre>
The test in question, https://github.com/llvm/llvm-project/blob/main/libc/test/src/__support/str_to_float_comparison_test.cpp, is not hermetic right now. This causes problems for NixOS/nixpkgs where full builds use clang without a libc. Being able to run all tests without needing the host's libc would be very beneficial.
Relevant log:
```
libc> [1145/1151] Building CXX object libc/test/src/__support/CMakeFiles/libc_str_to_float_comparison_test.dir/str_to_float_comparison_test.cpp.o
libc> FAILED: libc/test/src/__support/CMakeFiles/libc_str_to_float_comparison_test.dir/str_to_float_comparison_test.cpp.o
libc> /nix/store/h3wgz6n8bc4n61vv427xl8cz69vcd96c-clang-wrapper-20.1.0-rc3/bin/clang++ -DLIBC_NAMESPACE=__llvm_libc_20_1_0_rc3 -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wno-comment -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=gnu++17 -MD -MT libc/test/src/__support/CMakeFiles/libc_str_to_float_comparison_test.dir/str_to_float_comparison_test.cpp.o -MF libc/test/src/__support/CMakeFiles/libc_str_to_float_comparison_test.dir/str_to_float_comparison_test.cpp.o.d -o libc/test/src/__support/CMakeFiles/libc_str_to_float_comparison_test.dir/str_to_float_comparison_test.cpp.o -c /build/libc-src-20.1.0-rc3/libc/test/src/__support/str_to_float_comparison_test.cpp
libc> In file included from /build/libc-src-20.1.0-rc3/libc/test/src/__support/str_to_float_comparison_test.cpp:11:
libc> In file included from /nix/store/l71wz2r8ki25kzw33jwssg8rh77xfkpr-gcc-14-20241116/include/c++/14-20241116/stdlib.h:36:
libc> In file included from /nix/store/l71wz2r8ki25kzw33jwssg8rh77xfkpr-gcc-14-20241116/include/c++/14-20241116/cstdlib:41:
libc> In file included from /nix/store/l71wz2r8ki25kzw33jwssg8rh77xfkpr-gcc-14-20241116/include/c++/14-20241116/aarch64-unknown-linux-gnu/bits/c++config.h:680:
libc> /nix/store/l71wz2r8ki25kzw33jwssg8rh77xfkpr-gcc-14-20241116/include/c++/14-20241116/aarch64-unknown-linux-gnu/bits/os_defines.h:39:10: fatal error: 'features.h' file not found
libc> 39 | #include <features.h>
libc> | ^~~~~~~~~~~~
libc> 1 error generated.
libc> [1146/1151] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.strfromf.dir/strfromf.cpp.o
libc> [1147/1151] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.strfromd.dir/strfromd.cpp.o
libc> [1148/1151] Building CXX object libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o
libc> ninja: build stopped: subcommand failed.
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMl19v4zgOwD-N8kLIsOUkTh7ykCb1YoDt7GF3Dt03Q5ZoW1NF8upP0vbhPvtBdmba3v7H4W4aBDAkk_JPJEWR3HvVG8QdWd2Q1XHBYxis2_1ovT_Y0xgDuu_i06K18mn3aUAI6AMoA79E9EFZQ9gBhhBGT8o9YTVhda_CENtM2BNhtdbnLw86OvsZRSCsbrVtCatPXJn0UrWCsDqtTFjtXRo0jY_jaN00E1wTbNNpy0Mj7GnkTnlrmqSQiXFMCMqDsQEGdCcMSoBT_RDA2EsGnwblQfDo0cPobKvx5KGzDj6qxx9-Iqw26nF86D1cBnQIXdQa2qi09BA9gtDc9HBRYbAxAIdEm8ENKtMDbzVCsOCi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