[libc] [llvm] [libc][bazel] Enable __support tests (PR #73125)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 06:36:23 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Guillaume Chatelet (gchatelet)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/73125.diff


3 Files Affected:

- (modified) libc/src/__support/char_vector.h (+1-1) 
- (modified) utils/bazel/llvm-project-overlay/libc/BUILD.bazel (+25) 
- (added) utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel (+90) 


``````````diff
diff --git a/libc/src/__support/char_vector.h b/libc/src/__support/char_vector.h
index ed55c48cc94cc9b..955abdc1fa5ae08 100644
--- a/libc/src/__support/char_vector.h
+++ b/libc/src/__support/char_vector.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC___SUPPORT_CHARVECTOR_H
 #define LLVM_LIBC_SRC___SUPPORT_CHARVECTOR_H
 
-#include "src/__support/common.h"
+#include "src/__support/common.h" // LIBC_INLINE
 
 #include <stddef.h>
 #include <stdlib.h> // For allocation.
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index c89c1f7950b974e..748bf160b4df410 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -338,6 +338,15 @@ libc_support_library(
     ],
 )
 
+libc_support_library(
+    name = "__support_blockstore",
+    hdrs = ["src/__support/blockstore.h"],
+    deps = [
+        ":__support_cpp_new",
+        ":__support_libc_assert",
+    ],
+)
+
 libc_support_library(
     name = "__support_arg_list",
     hdrs = ["src/__support/arg_list.h"],
@@ -354,6 +363,22 @@ libc_support_library(
     ],
 )
 
+libc_support_library(
+    name = "__support_fixedvector",
+    hdrs = ["src/__support/fixedvector.h"],
+    deps = [
+        ":__support_cpp_array",
+    ],
+)
+
+libc_support_library(
+    name = "__support_char_vector",
+    hdrs = ["src/__support/char_vector.h"],
+    deps = [
+        ":__support_common",
+    ],
+)
+
 libc_support_library(
     name = "__support_error_or",
     hdrs = ["src/__support/error_or.h"],
diff --git a/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
new file mode 100644
index 000000000000000..b286eb70d8c7cb5
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
@@ -0,0 +1,90 @@
+# This file is licensed 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
+
+# Tests for LLVM libc __support functions.
+
+load("//libc/test:libc_test_rules.bzl", "libc_test")
+
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])
+
+# This test is currently disabled because of an issue in
+# `libc/src/__support/CPP/new.h` which currently fails with
+# "error: cannot apply asm label to function after its first use"
+# libc_test(
+#     name = "blockstore_test",
+#     srcs = ["blockstore_test.cpp"],
+#     deps = ["//libc:__support_blockstore"],
+# )
+
+libc_test(
+    name = "endian_test",
+    srcs = ["endian_test.cpp"],
+    deps = ["//libc:__support_common"],
+)
+
+libc_test(
+    name = "high_precision_decimal_test",
+    srcs = ["high_precision_decimal_test.cpp"],
+    deps = [
+        "//libc:__support_str_to_float",
+        "//libc:__support_uint128",
+    ],
+)
+
+libc_test(
+    name = "str_to_float_test",
+    srcs = ["str_to_float_test.cpp"],
+    deps = [
+        "//libc:__support_fputil_fp_bits",
+        "//libc:__support_str_to_float",
+        "//libc:__support_uint128",
+    ],
+)
+
+libc_test(
+    name = "integer_to_string_test",
+    srcs = ["integer_to_string_test.cpp"],
+    deps = [
+        "//libc:__support_cpp_span",
+        "//libc:__support_cpp_string_view",
+        "//libc:__support_integer_to_string",
+        "//libc:__support_uint",
+        "//libc:__support_uint128",
+    ],
+)
+
+libc_test(
+    name = "arg_list_test",
+    srcs = ["arg_list_test.cpp"],
+    deps = [
+        "//libc:__support_arg_list",
+    ],
+)
+
+libc_test(
+    name = "uint_test",
+    srcs = ["uint_test.cpp"],
+    deps = [
+        "//libc:__support_cpp_optional",
+        "//libc:__support_uint",
+    ],
+)
+
+libc_test(
+    name = "fixedvector_test",
+    srcs = ["fixedvector_test.cpp"],
+    deps = [
+        "//libc:__support_fixedvector",
+    ],
+)
+
+libc_test(
+    name = "char_vector_test",
+    srcs = ["char_vector_test.cpp"],
+    deps = [
+        "//libc:__support_char_vector",
+    ],
+)

``````````

</details>


https://github.com/llvm/llvm-project/pull/73125


More information about the llvm-commits mailing list