[libc-commits] [libc] e2f5495 - [libc][NFC] Move RandUtils.h to test/src/math.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Mon Apr 17 08:43:37 PDT 2023


Author: Siva Chandra Reddy
Date: 2023-04-17T15:43:28Z
New Revision: e2f5495010c7aac452c981b74fd7e592b9db5efe

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

LOG: [libc][NFC] Move RandUtils.h to test/src/math.

It is currently used only by math tests so moving it to test/src/math
keeps it closer to where it is used.

Reviewed By: lntue

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

Added: 
    libc/test/src/math/RandUtils.cpp
    libc/test/src/math/RandUtils.h

Modified: 
    libc/test/src/CMakeLists.txt
    libc/test/src/math/CMakeLists.txt
    libc/test/src/math/FmaTest.h
    libc/utils/testutils/CMakeLists.txt

Removed: 
    libc/utils/testutils/RandUtils.cpp
    libc/utils/testutils/RandUtils.h


################################################################################
diff  --git a/libc/test/src/CMakeLists.txt b/libc/test/src/CMakeLists.txt
index 6b1c7452fc284..f3f8ca88190e0 100644
--- a/libc/test/src/CMakeLists.txt
+++ b/libc/test/src/CMakeLists.txt
@@ -15,7 +15,7 @@ function(add_fp_unittest name)
   endif()
 
   if(MATH_UNITTEST_NEED_MPFR)
-    list(APPEND MATH_UNITTEST_LINK_LIBRARIES libcMPFRWrapper -lmpfr -lgmp)
+    list(APPEND MATH_UNITTEST_LINK_LIBRARIES libcMPFRWrapper libc_math_test_utils -lmpfr -lgmp)
   endif()
   list(APPEND MATH_UNITTEST_LINK_LIBRARIES LibcFPTestHelpers)
 

diff  --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index 37e6183593b68..c4b883a2f988c 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -1,5 +1,11 @@
 add_libc_testsuite(libc_math_unittests)
 
+add_library(
+  libc_math_test_utils
+  RandUtils.cpp
+  RandUtils.h
+)
+
 add_fp_unittest(
   cosf_test
   NEED_MPFR

diff  --git a/libc/test/src/math/FmaTest.h b/libc/test/src/math/FmaTest.h
index 0daa4631080bf..cbfe8d948b061 100644
--- a/libc/test/src/math/FmaTest.h
+++ b/libc/test/src/math/FmaTest.h
@@ -12,8 +12,8 @@
 #include "src/__support/FPUtil/FPBits.h"
 #include "test/UnitTest/FPMatcher.h"
 #include "test/UnitTest/Test.h"
+#include "test/src/math/RandUtils.h"
 #include "utils/MPFRWrapper/MPFRUtils.h"
-#include "utils/testutils/RandUtils.h"
 
 namespace mpfr = __llvm_libc::testing::mpfr;
 

diff  --git a/libc/utils/testutils/RandUtils.cpp b/libc/test/src/math/RandUtils.cpp
similarity index 100%
rename from libc/utils/testutils/RandUtils.cpp
rename to libc/test/src/math/RandUtils.cpp

diff  --git a/libc/utils/testutils/RandUtils.h b/libc/test/src/math/RandUtils.h
similarity index 100%
rename from libc/utils/testutils/RandUtils.h
rename to libc/test/src/math/RandUtils.h

diff  --git a/libc/utils/testutils/CMakeLists.txt b/libc/utils/testutils/CMakeLists.txt
index 2d36ae5816739..be1e5a1777549 100644
--- a/libc/utils/testutils/CMakeLists.txt
+++ b/libc/utils/testutils/CMakeLists.txt
@@ -5,8 +5,6 @@ endif()
 
 add_library(
   libc_test_utils
-  RandUtils.cpp
-  RandUtils.h
   StreamWrapper.cpp
   StreamWrapper.h
   ${EFFile}


        


More information about the libc-commits mailing list