Skip to content

[libc][bazel] Enable __support tests #73125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libc/src/__support/char_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
25 changes: 25 additions & 0 deletions utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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"],
Expand Down
Original file line number Diff line number Diff line change
@@ -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"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] Do we need public here ?

Copy link
Contributor Author

@gchatelet gchatelet Nov 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do this in a separate patch if you don't mind since there are several other files to fix.
Also I need to make sure that it doesn't break things downstream (like the need to have a package statement).


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",
],
)