[libc-commits] [libc] b06617f - [libc] Fix GPU tests failing after recent changes

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Jul 26 07:06:27 PDT 2023


Author: Joseph Huber
Date: 2023-07-26T09:06:19-05:00
New Revision: b06617f1eca24ea34c1e6dbcf88c3f5c9eb40112

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

LOG: [libc] Fix GPU tests failing after recent changes

Summray:
We landed some extra math support, which is apparently broken on the
max / min functions. the `mod` functions cannot be tested as they use
`std::limits` which don't exist in a freestanding environment. Also the
`blockstore` test seems to be broken. We will need to fix these in the
future but for now we need something in a workable state.

Reviewed By: jplehr

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

Added: 
    

Modified: 
    libc/test/src/__support/CMakeLists.txt
    libc/test/src/math/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/test/src/__support/CMakeLists.txt b/libc/test/src/__support/CMakeLists.txt
index 5eabf9320ed406..c899d9bd1fcd06 100644
--- a/libc/test/src/__support/CMakeLists.txt
+++ b/libc/test/src/__support/CMakeLists.txt
@@ -1,14 +1,17 @@
 add_custom_target(libc-support-tests)
 
-add_libc_test(
-  blockstore_test
-  SUITE
-    libc-support-tests
-  SRCS
-    blockstore_test.cpp
-  DEPENDS
-    libc.src.__support.blockstore
-)
+# FIXME: These tests are currently broken on the GPU.
+if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
+  add_libc_test(
+    blockstore_test
+    SUITE
+      libc-support-tests
+    SRCS
+      blockstore_test.cpp
+    DEPENDS
+      libc.src.__support.blockstore
+  )
+endif()
 
 add_libc_test(
   endian_test

diff  --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index b2f475be99c9c1..4303bc11fd508f 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -847,6 +847,8 @@ add_fp_unittest(
     libc.src.math.modf
     libc.src.__support.FPUtil.basic_operations
     libc.src.__support.FPUtil.nearest_integer_operations
+  # Requires C++ limits.
+  UNIT_TEST_ONLY
 )
 
 add_fp_unittest(
@@ -862,6 +864,8 @@ add_fp_unittest(
     libc.src.math.modff
     libc.src.__support.FPUtil.basic_operations
     libc.src.__support.FPUtil.nearest_integer_operations
+  # Requires C++ limits.
+  UNIT_TEST_ONLY
 )
 
 add_fp_unittest(
@@ -924,89 +928,92 @@ add_fp_unittest(
     libc.src.__support.FPUtil.fp_bits
 )
 
-add_fp_unittest(
-  fminf_test
-  SUITE
-    libc_math_unittests
-  SRCS
-    fminf_test.cpp
-  HDRS
-    FMinTest.h
-  DEPENDS
-    libc.include.math
-    libc.src.math.fminf
-    libc.src.__support.FPUtil.fp_bits
-)
-
-add_fp_unittest(
-  fmin_test
-  SUITE
-    libc_math_unittests
-  SRCS
-    fmin_test.cpp
-  HDRS
-    FMinTest.h
-  DEPENDS
-    libc.include.math
-    libc.src.math.fmin
-    libc.src.__support.FPUtil.fp_bits
-)
-
-add_fp_unittest(
-  fminl_test
-  SUITE
-    libc_math_unittests
-  SRCS
-    fminl_test.cpp
-  HDRS
-    FMinTest.h
-  DEPENDS
-    libc.include.math
-    libc.src.math.fminl
-    libc.src.__support.FPUtil.fp_bits
-)
-
-add_fp_unittest(
-  fmaxf_test
-  SUITE
-    libc_math_unittests
-  SRCS
-    fmaxf_test.cpp
-  HDRS
-    FMaxTest.h
-  DEPENDS
-    libc.include.math
-    libc.src.math.fmaxf
-    libc.src.__support.FPUtil.fp_bits
-)
-
-add_fp_unittest(
-  fmax_test
-  SUITE
-    libc_math_unittests
-  SRCS
-    fmax_test.cpp
-  HDRS
-    FMaxTest.h
-  DEPENDS
-    libc.include.math
-    libc.src.math.fmax
-    libc.src.__support.FPUtil.fp_bits
-)
-
-add_fp_unittest(
-  fmaxl_test
-  SUITE
-    libc_math_unittests
-  SRCS
-    fmaxl_test.cpp
-  HDRS
-    FMaxTest.h
-  DEPENDS
-    libc.include.math
-    libc.src.math.fmaxl
-    libc.src.__support.FPUtil.fp_bits
-)
+# FIXME: These tests are currently broken on the GPU.
+if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
+  add_fp_unittest(
+    fminf_test
+    SUITE
+      libc_math_unittests
+    SRCS
+      fminf_test.cpp
+    HDRS
+      FMinTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.fminf
+      libc.src.__support.FPUtil.fp_bits
+  )
+
+  add_fp_unittest(
+    fmin_test
+    SUITE
+      libc_math_unittests
+    SRCS
+      fmin_test.cpp
+    HDRS
+      FMinTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.fmin
+      libc.src.__support.FPUtil.fp_bits
+  )
+
+  add_fp_unittest(
+    fminl_test
+    SUITE
+      libc_math_unittests
+    SRCS
+      fminl_test.cpp
+    HDRS
+      FMinTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.fminl
+      libc.src.__support.FPUtil.fp_bits
+  )
+
+  add_fp_unittest(
+    fmaxf_test
+    SUITE
+      libc_math_unittests
+    SRCS
+      fmaxf_test.cpp
+    HDRS
+      FMaxTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.fmaxf
+      libc.src.__support.FPUtil.fp_bits
+  )
+
+  add_fp_unittest(
+    fmax_test
+    SUITE
+      libc_math_unittests
+    SRCS
+      fmax_test.cpp
+    HDRS
+      FMaxTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.fmax
+      libc.src.__support.FPUtil.fp_bits
+  )
+
+  add_fp_unittest(
+    fmaxl_test
+    SUITE
+      libc_math_unittests
+    SRCS
+      fmaxl_test.cpp
+    HDRS
+      FMaxTest.h
+    DEPENDS
+      libc.include.math
+      libc.src.math.fmaxl
+      libc.src.__support.FPUtil.fp_bits
+  )
+endif()
 
 add_fp_unittest(
   sqrtf_test
@@ -1393,6 +1400,8 @@ add_fp_unittest(
     libc.src.math.fmodf
     libc.src.__support.FPUtil.basic_operations
     libc.src.__support.FPUtil.nearest_integer_operations
+  # Requires C++ limits.
+  UNIT_TEST_ONLY
 )
 
 add_fp_unittest(
@@ -1409,6 +1418,8 @@ add_fp_unittest(
     libc.src.math.fmod
     libc.src.__support.FPUtil.basic_operations
     libc.src.__support.FPUtil.nearest_integer_operations
+  # Requires C++ limits.
+  UNIT_TEST_ONLY
 )
 
 add_fp_unittest(


        


More information about the libc-commits mailing list