[libc-commits] [libc] [libc][NFC] Correct test header inclusion, license (PR #114604)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Fri Nov 1 14:02:02 PDT 2024


https://github.com/michaelrj-google created https://github.com/llvm/llvm-project/pull/114604

Some tests were including LibcTest.h directly. Instead you should
include Test.h which does proper indirection for other test frameworks
we support (zxtest, gtest). Also added some license headers to tests
that were missing them.


>From 7ef5e64b3787a7d21e366eac8eca2a87998466f8 Mon Sep 17 00:00:00 2001
From: Michael Jones <michaelrj at google.com>
Date: Fri, 1 Nov 2024 13:54:21 -0700
Subject: [PATCH] [libc][NFC] Correct test header inclusion, license

Some tests were including LibcTest.h directly. Instead you should
include Test.h which does proper indirection for other test frameworks
we support (zxtest, gtest). Also added some license headers to tests
that were missing them.
---
 libc/test/src/__support/OSUtil/linux/vdso_test.cpp  | 1 -
 libc/test/src/__support/integer_literals_test.cpp   | 1 -
 libc/test/src/__support/str_to_double_test.cpp      | 8 ++++++++
 libc/test/src/__support/str_to_float_test.cpp       | 8 ++++++++
 libc/test/src/__support/str_to_long_double_test.cpp | 8 ++++++++
 libc/test/src/sys/mman/linux/mincore_test.cpp       | 1 -
 libc/test/src/sys/mman/linux/mlock_test.cpp         | 1 -
 libc/test/src/sys/mman/linux/msync_test.cpp         | 1 -
 libc/test/src/sys/mman/linux/shm_test.cpp           | 2 +-
 libc/test/src/unistd/access_test.cpp                | 1 -
 10 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/libc/test/src/__support/OSUtil/linux/vdso_test.cpp b/libc/test/src/__support/OSUtil/linux/vdso_test.cpp
index 2363db69c02f97..2f68470e8f678f 100644
--- a/libc/test/src/__support/OSUtil/linux/vdso_test.cpp
+++ b/libc/test/src/__support/OSUtil/linux/vdso_test.cpp
@@ -19,7 +19,6 @@
 #include "src/signal/raise.h"
 #include "src/signal/sigaction.h"
 #include "test/UnitTest/ErrnoSetterMatcher.h"
-#include "test/UnitTest/LibcTest.h"
 #include "test/UnitTest/Test.h"
 #include <linux/time_types.h>
 #include <sys/syscall.h>
diff --git a/libc/test/src/__support/integer_literals_test.cpp b/libc/test/src/__support/integer_literals_test.cpp
index cbc906aa7c99ad..5c626f43beb951 100644
--- a/libc/test/src/__support/integer_literals_test.cpp
+++ b/libc/test/src/__support/integer_literals_test.cpp
@@ -1,4 +1,3 @@
-
 //===-- Unittests for user defined integer literals -----------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
diff --git a/libc/test/src/__support/str_to_double_test.cpp b/libc/test/src/__support/str_to_double_test.cpp
index 2b99138480284d..03d21852dac2bb 100644
--- a/libc/test/src/__support/str_to_double_test.cpp
+++ b/libc/test/src/__support/str_to_double_test.cpp
@@ -1,3 +1,11 @@
+//===-- Unittests for str_to_float<double> --------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
 #include "src/__support/macros/config.h"
 #include "str_to_fp_test.h"
 
diff --git a/libc/test/src/__support/str_to_float_test.cpp b/libc/test/src/__support/str_to_float_test.cpp
index 90633d72c429dc..fa4c642ec9cdbb 100644
--- a/libc/test/src/__support/str_to_float_test.cpp
+++ b/libc/test/src/__support/str_to_float_test.cpp
@@ -1,3 +1,11 @@
+//===-- Unittests for str_to_float<float> ---------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
 #include "src/__support/macros/config.h"
 #include "str_to_fp_test.h"
 
diff --git a/libc/test/src/__support/str_to_long_double_test.cpp b/libc/test/src/__support/str_to_long_double_test.cpp
index 0616edf2d85855..9efa457aac9577 100644
--- a/libc/test/src/__support/str_to_long_double_test.cpp
+++ b/libc/test/src/__support/str_to_long_double_test.cpp
@@ -1,3 +1,11 @@
+//===-- Unittests for str_to_float<long double> ---------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
 #include "src/__support/macros/config.h"
 #include "str_to_fp_test.h"
 
diff --git a/libc/test/src/sys/mman/linux/mincore_test.cpp b/libc/test/src/sys/mman/linux/mincore_test.cpp
index 8e0c29c2ac1777..e49e300e43c88c 100644
--- a/libc/test/src/sys/mman/linux/mincore_test.cpp
+++ b/libc/test/src/sys/mman/linux/mincore_test.cpp
@@ -16,7 +16,6 @@
 #include "src/sys/mman/munmap.h"
 #include "src/unistd/sysconf.h"
 #include "test/UnitTest/ErrnoSetterMatcher.h"
-#include "test/UnitTest/LibcTest.h"
 #include "test/UnitTest/Test.h"
 
 #include <sys/mman.h>
diff --git a/libc/test/src/sys/mman/linux/mlock_test.cpp b/libc/test/src/sys/mman/linux/mlock_test.cpp
index c6e459276a8fbf..48cde1317655a5 100644
--- a/libc/test/src/sys/mman/linux/mlock_test.cpp
+++ b/libc/test/src/sys/mman/linux/mlock_test.cpp
@@ -20,7 +20,6 @@
 #include "src/sys/resource/getrlimit.h"
 #include "src/unistd/sysconf.h"
 #include "test/UnitTest/ErrnoSetterMatcher.h"
-#include "test/UnitTest/LibcTest.h"
 #include "test/UnitTest/Test.h"
 
 #include <linux/capability.h>
diff --git a/libc/test/src/sys/mman/linux/msync_test.cpp b/libc/test/src/sys/mman/linux/msync_test.cpp
index 0d60415b1243ab..65eedb2b8232e7 100644
--- a/libc/test/src/sys/mman/linux/msync_test.cpp
+++ b/libc/test/src/sys/mman/linux/msync_test.cpp
@@ -14,7 +14,6 @@
 #include "src/sys/mman/munmap.h"
 #include "src/unistd/sysconf.h"
 #include "test/UnitTest/ErrnoSetterMatcher.h"
-#include "test/UnitTest/LibcTest.h"
 #include "test/UnitTest/Test.h"
 
 using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;
diff --git a/libc/test/src/sys/mman/linux/shm_test.cpp b/libc/test/src/sys/mman/linux/shm_test.cpp
index 97de705c4c2b06..7f4be1844e9582 100644
--- a/libc/test/src/sys/mman/linux/shm_test.cpp
+++ b/libc/test/src/sys/mman/linux/shm_test.cpp
@@ -16,7 +16,7 @@
 #include "src/unistd/close.h"
 #include "src/unistd/ftruncate.h"
 #include "test/UnitTest/ErrnoSetterMatcher.h"
-#include "test/UnitTest/LibcTest.h"
+#include "test/UnitTest/Test.h"
 #include <sys/syscall.h>
 
 using namespace LIBC_NAMESPACE::testing::ErrnoSetterMatcher;
diff --git a/libc/test/src/unistd/access_test.cpp b/libc/test/src/unistd/access_test.cpp
index 808cd5f3c8d824..0643b2b992a5cf 100644
--- a/libc/test/src/unistd/access_test.cpp
+++ b/libc/test/src/unistd/access_test.cpp
@@ -12,7 +12,6 @@
 #include "src/unistd/close.h"
 #include "src/unistd/unlink.h"
 #include "test/UnitTest/ErrnoSetterMatcher.h"
-#include "test/UnitTest/LibcTest.h"
 #include "test/UnitTest/Test.h"
 
 #include <sys/stat.h>



More information about the libc-commits mailing list