[libc-commits] [libc] 20f4f29 - [libc] Fix 'clock()' testing on the GPU

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Wed Aug 30 14:58:22 PDT 2023


Author: Joseph Huber
Date: 2023-08-30T16:58:11-05:00
New Revision: 20f4f295da4d3f05d88eb85a8bb83c0e8139ece8

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

LOG: [libc] Fix 'clock()' testing on the GPU

Summary:
We should check for the GPU architectures first, since `__linux__` can
be set potentially during these compilations. Also the test needs to be
a hermetic test.

Added: 
    

Modified: 
    libc/include/llvm-libc-macros/time-macros.h
    libc/test/src/time/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/include/llvm-libc-macros/time-macros.h b/libc/include/llvm-libc-macros/time-macros.h
index e5b79f8e4dc48d..c3bd7aa24f56c3 100644
--- a/libc/include/llvm-libc-macros/time-macros.h
+++ b/libc/include/llvm-libc-macros/time-macros.h
@@ -1,10 +1,10 @@
 #ifndef __LLVM_LIBC_MACROS_TIME_MACROS_H
 #define __LLVM_LIBC_MACROS_TIME_MACROS_H
 
-#ifdef __linux__
-#include "linux/time-macros.h"
-#elif defined(__AMDGPU__) || defined(__NVPTX__)
+#if defined(__AMDGPU__) || defined(__NVPTX__)
 #include "gpu/time-macros.h"
+#elif defined(__linux__)
+#include "linux/time-macros.h"
 #endif
 
 #endif // __LLVM_LIBC_MACROS_TIME_MACROS_H

diff  --git a/libc/test/src/time/CMakeLists.txt b/libc/test/src/time/CMakeLists.txt
index 6f15bdbc07d4a5..1a829188156a2e 100644
--- a/libc/test/src/time/CMakeLists.txt
+++ b/libc/test/src/time/CMakeLists.txt
@@ -136,7 +136,7 @@ add_libc_unittest(
     libc.src.errno.errno
 )
 
-add_libc_unittest(
+add_libc_test(
   clock_test
   SUITE
     libc_time_unittests


        


More information about the libc-commits mailing list