[libc-commits] [libc] e831f73 - [libc] Run all unit tests, irrespective of whether they belong to a test suite.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Mon Apr 24 15:38:11 PDT 2023


Author: Siva Chandra Reddy
Date: 2023-04-24T22:37:58Z
New Revision: e831f73ac034f3a43aa9dcccf7ceb7b269089ef6

URL: https://github.com/llvm/llvm-project/commit/e831f73ac034f3a43aa9dcccf7ceb7b269089ef6
DIFF: https://github.com/llvm/llvm-project/commit/e831f73ac034f3a43aa9dcccf7ceb7b269089ef6.diff

LOG: [libc] Run all unit tests, irrespective of whether they belong to a test suite.

Previously, only those unit tests which belonged to a suite were run as
part of libc-unit-tests. It meant that unit tests not part of any suite
were not being tested. This change makes all unit tests run as part of
libc-unit-tests. The convenience function to add a libc unit test suite
has been removed and add_custom_target is used in its place. One of the
bit-rotting test has along been fixed. Math exhaustive and differential
tests are skipped under full build.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D148784

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCTestRules.cmake
    libc/test/src/__support/CMakeLists.txt
    libc/test/src/__support/CPP/CMakeLists.txt
    libc/test/src/__support/FPUtil/CMakeLists.txt
    libc/test/src/__support/OSUtil/CMakeLists.txt
    libc/test/src/assert/CMakeLists.txt
    libc/test/src/ctype/CMakeLists.txt
    libc/test/src/dirent/CMakeLists.txt
    libc/test/src/errno/CMakeLists.txt
    libc/test/src/fcntl/CMakeLists.txt
    libc/test/src/fenv/CMakeLists.txt
    libc/test/src/inttypes/CMakeLists.txt
    libc/test/src/math/CMakeLists.txt
    libc/test/src/network/CMakeLists.txt
    libc/test/src/pthread/CMakeLists.txt
    libc/test/src/sched/CMakeLists.txt
    libc/test/src/setjmp/CMakeLists.txt
    libc/test/src/signal/CMakeLists.txt
    libc/test/src/spawn/CMakeLists.txt
    libc/test/src/stdio/CMakeLists.txt
    libc/test/src/stdlib/CMakeLists.txt
    libc/test/src/string/CMakeLists.txt
    libc/test/src/sys/mman/linux/CMakeLists.txt
    libc/test/src/sys/random/linux/CMakeLists.txt
    libc/test/src/sys/resource/CMakeLists.txt
    libc/test/src/sys/select/CMakeLists.txt
    libc/test/src/sys/sendfile/CMakeLists.txt
    libc/test/src/sys/stat/CMakeLists.txt
    libc/test/src/sys/utsname/CMakeLists.txt
    libc/test/src/sys/wait/CMakeLists.txt
    libc/test/src/termios/CMakeLists.txt
    libc/test/src/time/CMakeLists.txt
    libc/test/src/unistd/CMakeLists.txt
    libc/test/src/wchar/CMakeLists.txt
    libc/test/utils/FPUtil/x86_long_double_test.cpp
    libc/test/utils/UnitTest/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 0757bd27cd392..c7689749b84d2 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -201,6 +201,7 @@ function(create_libc_unittest fq_target_name)
       ${fq_target_name}
     )
   endif()
+  add_dependencies(libc-unit-tests ${fq_target_name})
 endfunction(create_libc_unittest)
 
 # Internal function, used by `add_libc_unittest`.
@@ -298,11 +299,6 @@ function(add_libc_unittest target_name)
   )
 endfunction(add_libc_unittest)
 
-function(add_libc_testsuite suite_name)
-  add_custom_target(${suite_name})
-  add_dependencies(libc-unit-tests ${suite_name})
-endfunction(add_libc_testsuite)
-
 function(add_libc_exhaustive_testsuite suite_name)
   add_custom_target(${suite_name})
   add_dependencies(exhaustive-check-libc ${suite_name})

diff  --git a/libc/test/src/__support/CMakeLists.txt b/libc/test/src/__support/CMakeLists.txt
index a8c5517238882..dddb0a8ed2ba9 100644
--- a/libc/test/src/__support/CMakeLists.txt
+++ b/libc/test/src/__support/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_support_unittests)
+add_custom_target(libc_support_unittests)
 
 add_libc_unittest(
   blockstore_test

diff  --git a/libc/test/src/__support/CPP/CMakeLists.txt b/libc/test/src/__support/CPP/CMakeLists.txt
index 9a9519559db33..a6b80fcce8729 100644
--- a/libc/test/src/__support/CPP/CMakeLists.txt
+++ b/libc/test/src/__support/CPP/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_cpp_utils_unittests)
+add_custom_target(libc_cpp_utils_unittests)
 
 add_libc_unittest(
   bitset_test

diff  --git a/libc/test/src/__support/FPUtil/CMakeLists.txt b/libc/test/src/__support/FPUtil/CMakeLists.txt
index 47d88b169c588..0f57c44b43f15 100644
--- a/libc/test/src/__support/FPUtil/CMakeLists.txt
+++ b/libc/test/src/__support/FPUtil/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_fputil_unittests)
+add_custom_target(libc_fputil_unittests)
 
 add_fp_unittest(
   dyadic_float_test

diff  --git a/libc/test/src/__support/OSUtil/CMakeLists.txt b/libc/test/src/__support/OSUtil/CMakeLists.txt
index c70fedf3ff046..9adac7e73b8ff 100644
--- a/libc/test/src/__support/OSUtil/CMakeLists.txt
+++ b/libc/test/src/__support/OSUtil/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_osutil_tests)
+add_custom_target(libc_osutil_tests)
 
 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
   add_subdirectory(${LIBC_TARGET_OS})

diff  --git a/libc/test/src/assert/CMakeLists.txt b/libc/test/src/assert/CMakeLists.txt
index f672230910272..e66aca8307eeb 100644
--- a/libc/test/src/assert/CMakeLists.txt
+++ b/libc/test/src/assert/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_assert_unittests)
+add_custom_target(libc_assert_unittests)
 
 add_libc_unittest(
   assert_test

diff  --git a/libc/test/src/ctype/CMakeLists.txt b/libc/test/src/ctype/CMakeLists.txt
index eadec223c8ea3..34377aefc0ecd 100644
--- a/libc/test/src/ctype/CMakeLists.txt
+++ b/libc/test/src/ctype/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_ctype_unittests)
+add_custom_target(libc_ctype_unittests)
 
 add_libc_unittest(
   isalnum_test

diff  --git a/libc/test/src/dirent/CMakeLists.txt b/libc/test/src/dirent/CMakeLists.txt
index 014fe37cc09f6..b8ae813141c0d 100644
--- a/libc/test/src/dirent/CMakeLists.txt
+++ b/libc/test/src/dirent/CMakeLists.txt
@@ -1,5 +1,5 @@
 add_subdirectory(testdata)
-add_libc_testsuite(libc_dirent_unittests)
+add_custom_target(libc_dirent_unittests)
 
 add_libc_unittest(
   dirent_test

diff  --git a/libc/test/src/errno/CMakeLists.txt b/libc/test/src/errno/CMakeLists.txt
index 70520735b9d6f..00d381c16817b 100644
--- a/libc/test/src/errno/CMakeLists.txt
+++ b/libc/test/src/errno/CMakeLists.txt
@@ -2,7 +2,7 @@ if(NOT LLVM_LIBC_FULL_BUILD)
   return()
 endif()
 
-add_libc_testsuite(libc_errno_unittests)
+add_custom_target(libc_errno_unittests)
 
 add_libc_unittest(
   errno_test

diff  --git a/libc/test/src/fcntl/CMakeLists.txt b/libc/test/src/fcntl/CMakeLists.txt
index d90b2fab10347..f3d265ec238bd 100644
--- a/libc/test/src/fcntl/CMakeLists.txt
+++ b/libc/test/src/fcntl/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_fcntl_unittests)
+add_custom_target(libc_fcntl_unittests)
 
 add_subdirectory(testdata)
 

diff  --git a/libc/test/src/fenv/CMakeLists.txt b/libc/test/src/fenv/CMakeLists.txt
index cf27fa5b5188c..325ec5b1d2635 100644
--- a/libc/test/src/fenv/CMakeLists.txt
+++ b/libc/test/src/fenv/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_fenv_unittests)
+add_custom_target(libc_fenv_unittests)
 
 add_libc_unittest(
   rounding_mode_test

diff  --git a/libc/test/src/inttypes/CMakeLists.txt b/libc/test/src/inttypes/CMakeLists.txt
index 7fee729bc641c..cbcd8463747e8 100644
--- a/libc/test/src/inttypes/CMakeLists.txt
+++ b/libc/test/src/inttypes/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_inttypes_unittests)
+add_custom_target(libc_inttypes_unittests)
 
 add_libc_unittest(
   strtoimax_test

diff  --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index 0cececdc0cdb4..c71090706cc40 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_math_unittests)
+add_custom_target(libc_math_unittests)
 
 add_library(
   libc_math_test_utils
@@ -1571,5 +1571,8 @@ add_fp_unittest(
 )
 
 add_subdirectory(generic)
-add_subdirectory(exhaustive)
-add_subdirectory(
diff erential_testing)
+
+if(NOT LLVM_LIBC_FULL_BUILD)
+  add_subdirectory(exhaustive)
+  add_subdirectory(
diff erential_testing)
+endif()

diff  --git a/libc/test/src/network/CMakeLists.txt b/libc/test/src/network/CMakeLists.txt
index 7bff6da77ed09..222205dfe247a 100644
--- a/libc/test/src/network/CMakeLists.txt
+++ b/libc/test/src/network/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_network_unittests)
+add_custom_target(libc_network_unittests)
 
 add_libc_unittest(
   htonl

diff  --git a/libc/test/src/pthread/CMakeLists.txt b/libc/test/src/pthread/CMakeLists.txt
index db0516cecc4fd..fb0d22ab9d2a5 100644
--- a/libc/test/src/pthread/CMakeLists.txt
+++ b/libc/test/src/pthread/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_pthread_unittests)
+add_custom_target(libc_pthread_unittests)
 
 add_libc_unittest(
   pthread_attr_test

diff  --git a/libc/test/src/sched/CMakeLists.txt b/libc/test/src/sched/CMakeLists.txt
index 15a6257702346..ef6cdf34843b3 100644
--- a/libc/test/src/sched/CMakeLists.txt
+++ b/libc/test/src/sched/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_sched_unittests)
+add_custom_target(libc_sched_unittests)
 
 add_libc_unittest(
   affinity_test

diff  --git a/libc/test/src/setjmp/CMakeLists.txt b/libc/test/src/setjmp/CMakeLists.txt
index cfa35089d3b67..f637842c03425 100644
--- a/libc/test/src/setjmp/CMakeLists.txt
+++ b/libc/test/src/setjmp/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_setjmp_unittests)
+add_custom_target(libc_setjmp_unittests)
 
 # Skip setjmp tests under sanitizers
 if(LLVM_USE_SANITIZER)

diff  --git a/libc/test/src/signal/CMakeLists.txt b/libc/test/src/signal/CMakeLists.txt
index fe49328668032..3016f2a0a6d40 100644
--- a/libc/test/src/signal/CMakeLists.txt
+++ b/libc/test/src/signal/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_signal_unittests)
+add_custom_target(libc_signal_unittests)
 
 add_libc_unittest(
   raise_test

diff  --git a/libc/test/src/spawn/CMakeLists.txt b/libc/test/src/spawn/CMakeLists.txt
index c7e7bc29ad02b..39b63df190849 100644
--- a/libc/test/src/spawn/CMakeLists.txt
+++ b/libc/test/src/spawn/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_spawn_unittests)
+add_custom_target(libc_spawn_unittests)
 
 add_libc_unittest(
   posix_spawn_file_actions_test

diff  --git a/libc/test/src/stdio/CMakeLists.txt b/libc/test/src/stdio/CMakeLists.txt
index 4261238e7361c..57400d812c107 100644
--- a/libc/test/src/stdio/CMakeLists.txt
+++ b/libc/test/src/stdio/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_stdio_unittests)
+add_custom_target(libc_stdio_unittests)
 
 add_libc_unittest(
   fileop_test

diff  --git a/libc/test/src/stdlib/CMakeLists.txt b/libc/test/src/stdlib/CMakeLists.txt
index 55bc28606e6eb..4664a581aec55 100644
--- a/libc/test/src/stdlib/CMakeLists.txt
+++ b/libc/test/src/stdlib/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_stdlib_unittests)
+add_custom_target(libc_stdlib_unittests)
 
 add_libc_unittest(
   atof_test

diff  --git a/libc/test/src/string/CMakeLists.txt b/libc/test/src/string/CMakeLists.txt
index af5ddfeb3cdce..4614cd809a435 100644
--- a/libc/test/src/string/CMakeLists.txt
+++ b/libc/test/src/string/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_string_unittests)
+add_custom_target(libc_string_unittests)
 
 add_subdirectory(memory_utils)
 

diff  --git a/libc/test/src/sys/mman/linux/CMakeLists.txt b/libc/test/src/sys/mman/linux/CMakeLists.txt
index 8b35842cd810a..e493c8cb6f22c 100644
--- a/libc/test/src/sys/mman/linux/CMakeLists.txt
+++ b/libc/test/src/sys/mman/linux/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_sys_mman_unittests)
+add_custom_target(libc_sys_mman_unittests)
 
 add_libc_unittest(
   mmap_test

diff  --git a/libc/test/src/sys/random/linux/CMakeLists.txt b/libc/test/src/sys/random/linux/CMakeLists.txt
index 6277749087697..32c1b6128166e 100644
--- a/libc/test/src/sys/random/linux/CMakeLists.txt
+++ b/libc/test/src/sys/random/linux/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_sys_random_unittests)
+add_custom_target(libc_sys_random_unittests)
 
 add_libc_unittest(
   getrandom_test

diff  --git a/libc/test/src/sys/resource/CMakeLists.txt b/libc/test/src/sys/resource/CMakeLists.txt
index 574a4dc8d64c0..90dc0e846df6d 100644
--- a/libc/test/src/sys/resource/CMakeLists.txt
+++ b/libc/test/src/sys/resource/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_sys_resource_unittests)
+add_custom_target(libc_sys_resource_unittests)
 
 add_subdirectory(testdata)
 

diff  --git a/libc/test/src/sys/select/CMakeLists.txt b/libc/test/src/sys/select/CMakeLists.txt
index 9d45a447797b7..3ad73d390a4ed 100644
--- a/libc/test/src/sys/select/CMakeLists.txt
+++ b/libc/test/src/sys/select/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_sys_select_unittests)
+add_custom_target(libc_sys_select_unittests)
 
 add_libc_unittest(
   select_ui_test

diff  --git a/libc/test/src/sys/sendfile/CMakeLists.txt b/libc/test/src/sys/sendfile/CMakeLists.txt
index d2aa830fb0529..57dac4accd828 100644
--- a/libc/test/src/sys/sendfile/CMakeLists.txt
+++ b/libc/test/src/sys/sendfile/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_sys_sendfile_unittests)
+add_custom_target(libc_sys_sendfile_unittests)
 
 add_subdirectory(testdata)
 

diff  --git a/libc/test/src/sys/stat/CMakeLists.txt b/libc/test/src/sys/stat/CMakeLists.txt
index f21b7a0323a0f..877a129b627dd 100644
--- a/libc/test/src/sys/stat/CMakeLists.txt
+++ b/libc/test/src/sys/stat/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_sys_stat_unittests)
+add_custom_target(libc_sys_stat_unittests)
 
 add_subdirectory(testdata)
 

diff  --git a/libc/test/src/sys/utsname/CMakeLists.txt b/libc/test/src/sys/utsname/CMakeLists.txt
index a459820c86ea1..d1c0ba2aadd73 100644
--- a/libc/test/src/sys/utsname/CMakeLists.txt
+++ b/libc/test/src/sys/utsname/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_sys_utsname_unittests)
+add_custom_target(libc_sys_utsname_unittests)
 
 add_libc_unittest(
   uname_test

diff  --git a/libc/test/src/sys/wait/CMakeLists.txt b/libc/test/src/sys/wait/CMakeLists.txt
index 59176b8d6d7be..4ba1a939d6a8e 100644
--- a/libc/test/src/sys/wait/CMakeLists.txt
+++ b/libc/test/src/sys/wait/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_sys_wait_unittests)
+add_custom_target(libc_sys_wait_unittests)
 
 add_libc_unittest(
   waitpid_test

diff  --git a/libc/test/src/termios/CMakeLists.txt b/libc/test/src/termios/CMakeLists.txt
index 991d8d613539d..9f770da101394 100644
--- a/libc/test/src/termios/CMakeLists.txt
+++ b/libc/test/src/termios/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_termios_unittests)
+add_custom_target(libc_termios_unittests)
 
 add_libc_unittest(
   termios_test

diff  --git a/libc/test/src/time/CMakeLists.txt b/libc/test/src/time/CMakeLists.txt
index 378d754ca3e0e..85ddd42db2122 100644
--- a/libc/test/src/time/CMakeLists.txt
+++ b/libc/test/src/time/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_time_unittests)
+add_custom_target(libc_time_unittests)
 
 add_libc_unittest(
   asctime

diff  --git a/libc/test/src/unistd/CMakeLists.txt b/libc/test/src/unistd/CMakeLists.txt
index 1ec29d36c65f9..ceee888669b7e 100644
--- a/libc/test/src/unistd/CMakeLists.txt
+++ b/libc/test/src/unistd/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_unistd_unittests)
+add_custom_target(libc_unistd_unittests)
 
 add_subdirectory(testdata)
 

diff  --git a/libc/test/src/wchar/CMakeLists.txt b/libc/test/src/wchar/CMakeLists.txt
index 8b03002e90224..cabf42ba9b0b2 100644
--- a/libc/test/src/wchar/CMakeLists.txt
+++ b/libc/test/src/wchar/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_wchar_unittests)
+add_custom_target(libc_wchar_unittests)
 
 add_libc_unittest(
   btowc_test

diff  --git a/libc/test/utils/FPUtil/x86_long_double_test.cpp b/libc/test/utils/FPUtil/x86_long_double_test.cpp
index 16248ae267619..c2435b43ab72b 100644
--- a/libc/test/utils/FPUtil/x86_long_double_test.cpp
+++ b/libc/test/utils/FPUtil/x86_long_double_test.cpp
@@ -13,7 +13,7 @@
 
 using FPBits = __llvm_libc::fputil::FPBits<long double>;
 
-TEST(X86LongDoubleTest, is_nan) {
+TEST(LlvmLibcX86LongDoubleTest, is_nan) {
   // In the nan checks below, we use the macro isnan from math.h to ensure that
   // a number is actually a NaN. The isnan macro resolves to the compiler
   // builtin function. Hence, matching LLVM-libc's notion of NaN with the
@@ -21,66 +21,66 @@ TEST(X86LongDoubleTest, is_nan) {
   // behavior.
 
   FPBits bits(0.0l);
-  bits.exponent = FPBits::MAX_EXPONENT;
+  bits.set_unbiased_exponent(FPBits::MAX_EXPONENT);
   for (unsigned int i = 0; i < 1000000; ++i) {
     // If exponent has the max value and the implicit bit is 0,
     // then the number is a NaN for all values of mantissa.
-    bits.mantissa = i;
+    bits.set_mantissa(i);
     long double nan = bits;
-    ASSERT_NE(isnan(nan), 0);
+    ASSERT_NE(static_cast<int>(isnan(nan)), 0);
     ASSERT_TRUE(bits.is_nan());
   }
 
-  bits.implicitBit = 1;
+  bits.set_implicit_bit(1);
   for (unsigned int i = 1; i < 1000000; ++i) {
     // If exponent has the max value and the implicit bit is 1,
     // then the number is a NaN for all non-zero values of mantissa.
     // Note the initial value of |i| of 1 to avoid a zero mantissa.
-    bits.mantissa = i;
+    bits.set_mantissa(i);
     long double nan = bits;
-    ASSERT_NE(isnan(nan), 0);
+    ASSERT_NE(static_cast<int>(isnan(nan)), 0);
     ASSERT_TRUE(bits.is_nan());
   }
 
-  bits.exponent = 1;
-  bits.implicitBit = 0;
+  bits.set_unbiased_exponent(1);
+  bits.set_implicit_bit(0);
   for (unsigned int i = 0; i < 1000000; ++i) {
     // If exponent is non-zero and also not max, and the implicit bit is 0,
     // then the number is a NaN for all values of mantissa.
-    bits.mantissa = i;
+    bits.set_mantissa(i);
     long double nan = bits;
-    ASSERT_NE(isnan(nan), 0);
+    ASSERT_NE(static_cast<int>(isnan(nan)), 0);
     ASSERT_TRUE(bits.is_nan());
   }
 
-  bits.exponent = 1;
-  bits.implicitBit = 1;
+  bits.set_unbiased_exponent(1);
+  bits.set_implicit_bit(1);
   for (unsigned int i = 0; i < 1000000; ++i) {
     // If exponent is non-zero and also not max, and the implicit bit is 1,
     // then the number is normal value for all values of mantissa.
-    bits.mantissa = i;
+    bits.set_mantissa(i);
     long double valid = bits;
-    ASSERT_EQ(isnan(valid), 0);
+    ASSERT_EQ(static_cast<int>(isnan(valid)), 0);
     ASSERT_FALSE(bits.is_nan());
   }
 
-  bits.exponent = 0;
-  bits.implicitBit = 1;
+  bits.set_unbiased_exponent(0);
+  bits.set_implicit_bit(1);
   for (unsigned int i = 0; i < 1000000; ++i) {
     // If exponent is zero, then the number is a valid but denormal value.
-    bits.mantissa = i;
+    bits.set_mantissa(i);
     long double valid = bits;
-    ASSERT_EQ(isnan(valid), 0);
+    ASSERT_EQ(static_cast<int>(isnan(valid)), 0);
     ASSERT_FALSE(bits.is_nan());
   }
 
-  bits.exponent = 0;
-  bits.implicitBit = 0;
+  bits.set_unbiased_exponent(0);
+  bits.set_implicit_bit(0);
   for (unsigned int i = 0; i < 1000000; ++i) {
     // If exponent is zero, then the number is a valid but denormal value.
-    bits.mantissa = i;
+    bits.set_mantissa(i);
     long double valid = bits;
-    ASSERT_EQ(isnan(valid), 0);
+    ASSERT_EQ(static_cast<int>(isnan(valid)), 0);
     ASSERT_FALSE(bits.is_nan());
   }
 }

diff  --git a/libc/test/utils/UnitTest/CMakeLists.txt b/libc/test/utils/UnitTest/CMakeLists.txt
index d6031895e4153..ea9bd6c56f772 100644
--- a/libc/test/utils/UnitTest/CMakeLists.txt
+++ b/libc/test/utils/UnitTest/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_libc_testsuite(libc_unittest_tests)
+add_custom_target(libc_unittest_tests)
 
 add_libc_unittest(
   testfilter_test


        


More information about the libc-commits mailing list