From: Siva Chandra Reddy Date: Tue, 18 Apr 2023 00:35:28 +0000 (+0000) Subject: [libc][NFC] Move RoundingModeUtils to LibcFPTestHelpers. X-Git-Tag: upstream/17.0.6~11163 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=447d59e071227897207a3cf76e43746e5ce0ab10;p=platform%2Fupstream%2Fllvm.git [libc][NFC] Move RoundingModeUtils to LibcFPTestHelpers. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D148602 --- diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake index 75bb004..f9da04c3 100644 --- a/libc/cmake/modules/LLVMLibCTestRules.cmake +++ b/libc/cmake/modules/LLVMLibCTestRules.cmake @@ -178,11 +178,11 @@ function(create_libc_unittest fq_target_name) ${fq_deps_list} ) - # LibcUnitTest and libc_test_utils should not depend on anything in LINK_LIBRARIES. + # LibcUnitTest should not depend on anything in LINK_LIBRARIES. if(NO_LIBC_UNITTEST_TEST_MAIN) - list(APPEND link_libraries LibcUnitTest libc_test_utils) + list(APPEND link_libraries LibcUnitTest) else() - list(APPEND link_libraries LibcUnitTest LibcUnitTestMain libc_test_utils) + list(APPEND link_libraries LibcUnitTest LibcUnitTestMain) endif() target_link_libraries(${fq_build_target_name} PRIVATE ${link_libraries}) diff --git a/libc/test/UnitTest/CMakeLists.txt b/libc/test/UnitTest/CMakeLists.txt index aa4cca0..f3d5a2b 100644 --- a/libc/test/UnitTest/CMakeLists.txt +++ b/libc/test/UnitTest/CMakeLists.txt @@ -24,7 +24,6 @@ add_dependencies( libc.src.__support.CPP.type_traits libc.src.__support.OSUtil.osutil libc.src.__support.uint128) -target_link_libraries(LibcUnitTest PUBLIC libc_test_utils) add_library( LibcUnitTestMain @@ -33,7 +32,7 @@ add_library( target_include_directories(LibcUnitTestMain PUBLIC ${LIBC_SOURCE_DIR}) add_dependencies(LibcUnitTestMain LibcUnitTest) -target_link_libraries(LibcUnitTestMain PUBLIC LibcUnitTest libc_test_utils) +target_link_libraries(LibcUnitTestMain PUBLIC LibcUnitTest) add_header_library( string_utils @@ -49,9 +48,11 @@ add_library( FPExceptMatcher.cpp FPExceptMatcher.h FPMatcher.h + RoundingModeUtils.cpp + RoundingModeUtils.h ) target_include_directories(LibcFPTestHelpers PUBLIC ${LIBC_SOURCE_DIR}) -target_link_libraries(LibcFPTestHelpers LibcUnitTest libc_test_utils) +target_link_libraries(LibcFPTestHelpers LibcUnitTest) add_dependencies( LibcFPTestHelpers LibcUnitTest diff --git a/libc/test/UnitTest/FPMatcher.h b/libc/test/UnitTest/FPMatcher.h index 1df418c..d9234c3 100644 --- a/libc/test/UnitTest/FPMatcher.h +++ b/libc/test/UnitTest/FPMatcher.h @@ -11,9 +11,9 @@ #include "src/__support/FPUtil/FEnvImpl.h" #include "src/__support/FPUtil/FPBits.h" +#include "test/UnitTest/RoundingModeUtils.h" #include "test/UnitTest/StringUtils.h" #include "test/UnitTest/Test.h" -#include "utils/testutils/RoundingModeUtils.h" #include @@ -196,7 +196,7 @@ FPMatcher getMatcher(T expectedValue) { #define EXPECT_FP_EQ_ALL_ROUNDING(expected, actual) \ do { \ - using namespace __llvm_libc::testutils; \ + using namespace __llvm_libc::fputil::testing; \ ForceRoundingMode __r1(RoundingMode::Nearest); \ EXPECT_FP_EQ((expected), (actual)); \ ForceRoundingMode __r2(RoundingMode::Upward); \ diff --git a/libc/utils/testutils/RoundingModeUtils.cpp b/libc/test/UnitTest/RoundingModeUtils.cpp similarity index 93% rename from libc/utils/testutils/RoundingModeUtils.cpp rename to libc/test/UnitTest/RoundingModeUtils.cpp index aff3380..8cc6834 100644 --- a/libc/utils/testutils/RoundingModeUtils.cpp +++ b/libc/test/UnitTest/RoundingModeUtils.cpp @@ -11,7 +11,8 @@ #include namespace __llvm_libc { -namespace testutils { +namespace fputil { +namespace testing { int get_fe_rounding(RoundingMode mode) { switch (mode) { @@ -44,5 +45,6 @@ ForceRoundingMode::~ForceRoundingMode() { fesetround(old_rounding_mode); } -} // namespace testutils +} // namespace testing +} // namespace fputil } // namespace __llvm_libc diff --git a/libc/utils/testutils/RoundingModeUtils.h b/libc/test/UnitTest/RoundingModeUtils.h similarity index 91% rename from libc/utils/testutils/RoundingModeUtils.h rename to libc/test/UnitTest/RoundingModeUtils.h index 49c81ec..ac9f310 100644 --- a/libc/utils/testutils/RoundingModeUtils.h +++ b/libc/test/UnitTest/RoundingModeUtils.h @@ -12,7 +12,8 @@ #include namespace __llvm_libc { -namespace testutils { +namespace fputil { +namespace testing { enum class RoundingMode : uint8_t { Upward, Downward, TowardZero, Nearest }; @@ -28,7 +29,8 @@ template struct ForceRoundingModeTest : ForceRoundingMode { ForceRoundingModeTest() : ForceRoundingMode(R) {} }; -} // namespace testutils +} // namespace testing +} // namespace fputil } // namespace __llvm_libc #endif // LLVM_LIBC_UTILS_TESTUTILS_ROUNDINGMODEUTILS_H diff --git a/libc/test/src/math/differential_testing/CMakeLists.txt b/libc/test/src/math/differential_testing/CMakeLists.txt index f6522e8..72bc2f8f 100644 --- a/libc/test/src/math/differential_testing/CMakeLists.txt +++ b/libc/test/src/math/differential_testing/CMakeLists.txt @@ -57,7 +57,7 @@ function(add_diff_binary target_name) target_link_libraries( ${fq_target_name} - PRIVATE ${link_object_files} libc_test_utils libc_diff_test_utils) + PRIVATE ${link_object_files} libc_diff_test_utils) set_target_properties(${fq_target_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/libc/test/src/stdio/CMakeLists.txt b/libc/test/src/stdio/CMakeLists.txt index a4b5a9b..4261238 100644 --- a/libc/test/src/stdio/CMakeLists.txt +++ b/libc/test/src/stdio/CMakeLists.txt @@ -112,7 +112,7 @@ add_libc_unittest( LibcMemoryHelpers ) -add_libc_unittest( +add_fp_unittest( sprintf_test SUITE libc_stdio_unittests diff --git a/libc/test/src/stdio/sprintf_test.cpp b/libc/test/src/stdio/sprintf_test.cpp index a6a8315..9311582 100644 --- a/libc/test/src/stdio/sprintf_test.cpp +++ b/libc/test/src/stdio/sprintf_test.cpp @@ -10,8 +10,8 @@ #include "src/__support/FPUtil/FPBits.h" #include "src/__support/FPUtil/PlatformDefs.h" +#include "test/UnitTest/RoundingModeUtils.h" #include "test/UnitTest/Test.h" -#include "utils/testutils/RoundingModeUtils.h" // #include // namespace __llvm_libc { @@ -505,8 +505,8 @@ TEST(LlvmLibcSPrintfTest, OctConv) { #ifndef LIBC_COPT_PRINTF_DISABLE_FLOAT TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Nearest); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Nearest); double inf = __llvm_libc::fputil::FPBits::inf().get_val(); double nan = __llvm_libc::fputil::FPBits::build_nan(1); @@ -706,8 +706,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { // Rounding Mode Tests. { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Nearest); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Nearest); written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); @@ -735,8 +735,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { } { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Upward); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Upward); written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.1p+0"); @@ -764,8 +764,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { } { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Downward); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Downward); written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); @@ -793,8 +793,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { } { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::TowardZero); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::TowardZero); written = __llvm_libc::sprintf(buff, "%.1a", 0x1.08p0); ASSERT_STREQ_LEN(written, buff, "0x1.0p+0"); @@ -866,8 +866,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatHexExpConv) { } TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Nearest); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Nearest); double inf = __llvm_libc::fputil::FPBits::inf().get_val(); double nan = __llvm_libc::fputil::FPBits::build_nan(1); @@ -1222,8 +1222,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { // Rounding Mode Tests. { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Nearest); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Nearest); written = __llvm_libc::sprintf(buff, "%.1f", 1.75); ASSERT_STREQ_LEN(written, buff, "1.8"); @@ -1263,8 +1263,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { } { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Upward); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Upward); written = __llvm_libc::sprintf(buff, "%.1f", 1.75); ASSERT_STREQ_LEN(written, buff, "1.8"); @@ -1304,8 +1304,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { } { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Downward); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Downward); written = __llvm_libc::sprintf(buff, "%.1f", 1.75); ASSERT_STREQ_LEN(written, buff, "1.7"); @@ -1345,8 +1345,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { } { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::TowardZero); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::TowardZero); written = __llvm_libc::sprintf(buff, "%.1f", 1.75); ASSERT_STREQ_LEN(written, buff, "1.7"); @@ -1453,8 +1453,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatDecimalConv) { } TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Nearest); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Nearest); double inf = __llvm_libc::fputil::FPBits::inf().get_val(); double nan = __llvm_libc::fputil::FPBits::build_nan(1); @@ -1808,8 +1808,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { // Rounding Mode Tests. { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Nearest); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Nearest); written = __llvm_libc::sprintf(buff, "%.1e", 1.75); ASSERT_STREQ_LEN(written, buff, "1.8e+00"); @@ -1849,8 +1849,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { } { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Upward); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Upward); written = __llvm_libc::sprintf(buff, "%.1e", 1.75); ASSERT_STREQ_LEN(written, buff, "1.8e+00"); @@ -1890,8 +1890,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { } { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Downward); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Downward); written = __llvm_libc::sprintf(buff, "%.1e", 1.75); ASSERT_STREQ_LEN(written, buff, "1.7e+00"); @@ -1931,8 +1931,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { } { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::TowardZero); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::TowardZero); written = __llvm_libc::sprintf(buff, "%.1e", 1.75); ASSERT_STREQ_LEN(written, buff, "1.7e+00"); @@ -2048,8 +2048,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatExponentConv) { } TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Nearest); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Nearest); double inf = __llvm_libc::fputil::FPBits::inf().get_val(); double nan = __llvm_libc::fputil::FPBits::build_nan(1); @@ -2427,8 +2427,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { // Rounding Mode Tests. { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Nearest); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Nearest); written = __llvm_libc::sprintf(buff, "%.2g", 1.75); ASSERT_STREQ_LEN(written, buff, "1.8"); @@ -2468,8 +2468,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { } { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Upward); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Upward); written = __llvm_libc::sprintf(buff, "%.2g", 1.75); ASSERT_STREQ_LEN(written, buff, "1.8"); @@ -2509,8 +2509,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { } { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::Downward); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::Downward); written = __llvm_libc::sprintf(buff, "%.2g", 1.75); ASSERT_STREQ_LEN(written, buff, "1.7"); @@ -2550,8 +2550,8 @@ TEST_F(LlvmLibcSPrintfTest, FloatAutoConv) { } { - __llvm_libc::testutils::ForceRoundingMode r( - __llvm_libc::testutils::RoundingMode::TowardZero); + __llvm_libc::fputil::testing::ForceRoundingMode r( + __llvm_libc::fputil::testing::RoundingMode::TowardZero); written = __llvm_libc::sprintf(buff, "%.2g", 1.75); ASSERT_STREQ_LEN(written, buff, "1.7"); diff --git a/libc/test/src/stdlib/CMakeLists.txt b/libc/test/src/stdlib/CMakeLists.txt index b1893bc..55bc286 100644 --- a/libc/test/src/stdlib/CMakeLists.txt +++ b/libc/test/src/stdlib/CMakeLists.txt @@ -53,7 +53,7 @@ add_libc_unittest( libc.src.stdlib.atoll ) -add_libc_unittest( +add_fp_unittest( strtod_test SUITE libc_stdlib_unittests @@ -64,7 +64,7 @@ add_libc_unittest( libc.src.stdlib.strtod ) -add_libc_unittest( +add_fp_unittest( strtof_test SUITE libc_stdlib_unittests diff --git a/libc/test/src/stdlib/strtod_test.cpp b/libc/test/src/stdlib/strtod_test.cpp index 3b1458a..aa81eca 100644 --- a/libc/test/src/stdlib/strtod_test.cpp +++ b/libc/test/src/stdlib/strtod_test.cpp @@ -10,14 +10,15 @@ #include "src/errno/libc_errno.h" #include "src/stdlib/strtod.h" +#include "test/UnitTest/FPMatcher.h" +#include "test/UnitTest/RoundingModeUtils.h" #include "test/UnitTest/Test.h" -#include "utils/testutils/RoundingModeUtils.h" #include #include -using __llvm_libc::testutils::ForceRoundingModeTest; -using __llvm_libc::testutils::RoundingMode; +using __llvm_libc::fputil::testing::ForceRoundingModeTest; +using __llvm_libc::fputil::testing::RoundingMode; class LlvmLibcStrToDTest : public __llvm_libc::testing::Test, ForceRoundingModeTest { @@ -46,15 +47,8 @@ public: libc_errno = 0; double result = __llvm_libc::strtod(inputString, &str_end); - __llvm_libc::fputil::FPBits actual_fp = - __llvm_libc::fputil::FPBits(result); - EXPECT_EQ(str_end - inputString, expectedStrLen); - - EXPECT_EQ(actual_fp.bits, expected_fp.bits); - EXPECT_EQ(actual_fp.get_sign(), expected_fp.get_sign()); - EXPECT_EQ(actual_fp.get_exponent(), expected_fp.get_exponent()); - EXPECT_EQ(actual_fp.get_mantissa(), expected_fp.get_mantissa()); + EXPECT_FP_EQ(result, static_cast(expected_fp)); EXPECT_EQ(libc_errno, expectedErrno); } }; diff --git a/libc/test/src/stdlib/strtof_test.cpp b/libc/test/src/stdlib/strtof_test.cpp index 6897df4..45863f6 100644 --- a/libc/test/src/stdlib/strtof_test.cpp +++ b/libc/test/src/stdlib/strtof_test.cpp @@ -10,14 +10,15 @@ #include "src/errno/libc_errno.h" #include "src/stdlib/strtof.h" +#include "test/UnitTest/FPMatcher.h" +#include "test/UnitTest/RoundingModeUtils.h" #include "test/UnitTest/Test.h" -#include "utils/testutils/RoundingModeUtils.h" #include #include -using __llvm_libc::testutils::ForceRoundingModeTest; -using __llvm_libc::testutils::RoundingMode; +using __llvm_libc::fputil::testing::ForceRoundingModeTest; +using __llvm_libc::fputil::testing::RoundingMode; class LlvmLibcStrToFTest : public __llvm_libc::testing::Test, ForceRoundingModeTest { @@ -46,15 +47,8 @@ public: libc_errno = 0; float result = __llvm_libc::strtof(inputString, &str_end); - __llvm_libc::fputil::FPBits actual_fp = - __llvm_libc::fputil::FPBits(result); - EXPECT_EQ(str_end - inputString, expectedStrLen); - - EXPECT_EQ(actual_fp.bits, expected_fp.bits); - EXPECT_EQ(actual_fp.get_sign(), expected_fp.get_sign()); - EXPECT_EQ(actual_fp.get_exponent(), expected_fp.get_exponent()); - EXPECT_EQ(actual_fp.get_mantissa(), expected_fp.get_mantissa()); + EXPECT_FP_EQ(result, static_cast(expected_fp)); EXPECT_EQ(libc_errno, expectedErrno); } }; diff --git a/libc/utils/CMakeLists.txt b/libc/utils/CMakeLists.txt index 685b3a6..9754dcf 100644 --- a/libc/utils/CMakeLists.txt +++ b/libc/utils/CMakeLists.txt @@ -1,6 +1,5 @@ if(LLVM_INCLUDE_TESTS) add_subdirectory(MPFRWrapper) - add_subdirectory(testutils) endif() if(LIBC_TARGET_ARCHITECTURE_IS_GPU) add_subdirectory(gpu) diff --git a/libc/utils/MPFRWrapper/CMakeLists.txt b/libc/utils/MPFRWrapper/CMakeLists.txt index 482c374..6447d06 100644 --- a/libc/utils/MPFRWrapper/CMakeLists.txt +++ b/libc/utils/MPFRWrapper/CMakeLists.txt @@ -13,13 +13,12 @@ if(LIBC_TESTS_CAN_USE_MPFR) libc.src.__support.FPUtil.fp_bits libc.src.__support.FPUtil.platform_defs LibcUnitTest - libc_test_utils ) if(EXISTS ${LLVM_LIBC_MPFR_INSTALL_PATH}) target_include_directories(libcMPFRWrapper PUBLIC ${LLVM_LIBC_MPFR_INSTALL_PATH}/include) target_link_directories(libcMPFRWrapper PUBLIC ${LLVM_LIBC_MPFR_INSTALL_PATH}/lib) endif() - target_link_libraries(libcMPFRWrapper LibcFPTestHelpers LibcUnitTest mpfr gmp libc_test_utils) + target_link_libraries(libcMPFRWrapper LibcFPTestHelpers LibcUnitTest mpfr gmp) elseif(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU) message(WARNING "Math tests using MPFR will be skipped.") endif() diff --git a/libc/utils/MPFRWrapper/MPFRUtils.h b/libc/utils/MPFRWrapper/MPFRUtils.h index 450b31a..cbc4531 100644 --- a/libc/utils/MPFRWrapper/MPFRUtils.h +++ b/libc/utils/MPFRWrapper/MPFRUtils.h @@ -10,8 +10,8 @@ #define LLVM_LIBC_UTILS_TESTUTILS_MPFRUTILS_H #include "src/__support/CPP/type_traits.h" +#include "test/UnitTest/RoundingModeUtils.h" #include "test/UnitTest/Test.h" -#include "utils/testutils/RoundingModeUtils.h" #include @@ -86,8 +86,8 @@ enum class Operation : int { EndTernaryOperationsSingleOutput, }; -using __llvm_libc::testutils::ForceRoundingMode; -using __llvm_libc::testutils::RoundingMode; +using __llvm_libc::fputil::testing::ForceRoundingMode; +using __llvm_libc::fputil::testing::RoundingMode; template struct BinaryInput { static_assert( diff --git a/libc/utils/testutils/CMakeLists.txt b/libc/utils/testutils/CMakeLists.txt deleted file mode 100644 index 8f5a10c..0000000 --- a/libc/utils/testutils/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -add_library( - libc_test_utils - RoundingModeUtils.cpp -) diff --git a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel index 60010e3..319f60b 100644 --- a/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/test/UnitTest/BUILD.bazel @@ -43,7 +43,6 @@ cc_library( "//libc:__support_cpp_type_traits", "//libc:__support_uint128", "//libc:libc_root", - "//libc/utils/testutils:libc_test_utils", "//llvm:Support", ], ) @@ -52,10 +51,12 @@ cc_library( name = "fp_test_helpers", srcs = [ "FPExceptMatcher.cpp", + "RoundingModeUtils.cpp", ], hdrs = [ "FPExceptMatcher.h", "FPMatcher.h", + "RoundingModeUtils.h", ], deps = [ ":LibcUnitTest", @@ -67,7 +68,6 @@ cc_library( "//libc:__support_fputil_fenv_impl", "//libc:__support_fputil_fp_bits", "//libc:libc_root", - "//libc/utils/testutils:libc_test_utils", ], ) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel index 4f49ec7..f646079 100644 --- a/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel @@ -21,7 +21,6 @@ libc_test( "//libc:__support_cpp_string_view", "//libc:__support_cpp_bit", "//libc:__support_arg_list", - "//libc/utils/testutils:libc_test_utils", "//libc/test/UnitTest:printf_matcher", ], ) @@ -64,7 +63,7 @@ libc_test( deps = [ "//libc:__support_fputil_fp_bits", "//libc:__support_fputil_platform_defs", - "//libc/utils/testutils:libc_test_utils", + "//libc/test/UnitTest:fp_test_helpers", ], ) diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel index ca9887b..49dd139 100644 --- a/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/test/src/stdlib/BUILD.bazel @@ -128,7 +128,7 @@ libc_test( ], deps = [ "//libc:__support_fputil_fp_bits", - "//libc/utils/testutils:libc_test_utils", + "//libc/test/UnitTest:fp_test_helpers", ], ) @@ -140,7 +140,7 @@ libc_test( ], deps = [ "//libc:__support_fputil_fp_bits", - "//libc/utils/testutils:libc_test_utils", + "//libc/test/UnitTest:fp_test_helpers", ], ) diff --git a/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel index 1264345..893bb51 100644 --- a/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel @@ -47,6 +47,5 @@ cc_library( "//libc/test/UnitTest:LibcUnitTest", "//libc/test/UnitTest:fp_test_helpers", "//libc/utils/MPFRWrapper:mpfr_impl", - "//libc/utils/testutils:libc_test_utils", ], ) diff --git a/utils/bazel/llvm-project-overlay/libc/utils/testutils/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/utils/testutils/BUILD.bazel deleted file mode 100644 index 43191e1..0000000 --- a/utils/bazel/llvm-project-overlay/libc/utils/testutils/BUILD.bazel +++ /dev/null @@ -1,21 +0,0 @@ -# This file is licensed under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -package(default_visibility = ["//visibility:public"]) - -licenses(["notice"]) - -cc_library( - name = "libc_test_utils", - srcs = [ - "RoundingModeUtils.cpp", - ], - hdrs = [ - "RoundingModeUtils.h", - ], - deps = [ - "//libc:libc_root", - "//llvm:Support", - ], -)