[libc] Fix dependency to unit tests, and quitting in non-GPU mode
authorJoseph Huber <jhuber6@vols.utk.edu>
Fri, 17 Mar 2023 18:06:58 +0000 (13:06 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Fri, 17 Mar 2023 18:08:01 +0000 (13:08 -0500)
Summary:
Fixes the lack of a dependency after changing the order of some
includes. Also we weren't running any tests as the GPU was always
disabling them. Fix the logic.

libc/test/CMakeLists.txt

index 8a7023c..710f113 100644 (file)
@@ -5,6 +5,10 @@ add_dependencies(check-libc libc-unit-tests)
 add_custom_target(exhaustive-check-libc)
 add_custom_target(libc-long-running-tests)
 
+if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
+  add_subdirectory(UnitTest)
+endif()
+
 add_header_library(
   errno_setter_matcher
   HDRS
@@ -13,13 +17,13 @@ add_header_library(
     libc.src.errno.errno
 )
 
-if(NOT TARGET libc.utils.gpu.loader OR NOT TARGET libc.startup.gpu.crt1)
+if(LIBC_TARGET_ARCHITECTURE_IS_GPU AND
+   (NOT TARGET libc.utils.gpu.loader OR NOT TARGET libc.startup.gpu.crt1))
   message(WARNING "Cannot build libc GPU tests, missing loader implementation")
   return()
 endif()
 
 if(NOT LIBC_TARGET_ARCHITECTURE_IS_GPU)
-  add_subdirectory(UnitTest)
   add_subdirectory(src)
   add_subdirectory(utils)
 endif()