[libc-commits] [libc] [llvm] [libc][bazel] Enable __support tests (PR #73125)
Guillaume Chatelet via libc-commits
libc-commits at lists.llvm.org
Wed Nov 22 06:35:51 PST 2023
https://github.com/gchatelet created https://github.com/llvm/llvm-project/pull/73125
None
>From c2896a80f3570a804e7cd5a31709c2c14fa37d4f Mon Sep 17 00:00:00 2001
From: Guillaume Chatelet <gchatelet at google.com>
Date: Wed, 22 Nov 2023 13:21:16 +0000
Subject: [PATCH 1/2] [libc][bazel] Add __support unit tests
---
libc/src/__support/char_vector.h | 2 +-
.../llvm-project-overlay/libc/BUILD.bazel | 25 ++++++
.../libc/test/src/__support/BUILD.bazel | 87 +++++++++++++++++++
3 files changed, 113 insertions(+), 1 deletion(-)
create mode 100644 utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
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..c0eb9498def025c
--- /dev/null
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
@@ -0,0 +1,87 @@
+# 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"])
+
+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",
+ ],
+)
>From 8b5a49abcc5de7892c565c0002d113abc2331dba Mon Sep 17 00:00:00 2001
From: Guillaume Chatelet <gchatelet at google.com>
Date: Wed, 22 Nov 2023 14:34:09 +0000
Subject: [PATCH 2/2] Disable blockstore_test for now
---
.../libc/test/src/__support/BUILD.bazel | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
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
index c0eb9498def025c..b286eb70d8c7cb5 100644
--- a/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/test/src/__support/BUILD.bazel
@@ -10,11 +10,14 @@ package(default_visibility = ["//visibility:public"])
licenses(["notice"])
-libc_test(
- name = "blockstore_test",
- srcs = ["blockstore_test.cpp"],
- deps = ["//libc:__support_blockstore"],
-)
+# 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",
More information about the libc-commits
mailing list