blob: 7a15862d480b5f2526528c01619d3656712ebfce [file]
# Copyright 2026 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
load("//build/bazel/rules/cc:fx_cc_test_binary.bzl", "fx_cc_test_binary")
load("//build/bazel/rules/packages:fx_package.bzl", "fx_package")
load("//build/bazel/rules/testing:fx_test.bzl", "fx_test")
load("//build/bazel/rules/testing:fx_unittest_component.bzl", "fx_unittest_component")
package(default_applicable_licenses = ["//:license"])
_TEST_DEPS = [
"//sdk/lib/async",
"//sdk/lib/async:async-cpp",
"//sdk/lib/async-default",
"//sdk/lib/async-loop",
"//sdk/lib/async-loop:async-loop-cpp",
"//sdk/lib/async-loop:async-loop-default",
"//sdk/lib/fdio",
"//src/lib/fxl/test:gtest_main",
"@com_google_googletest//:gtest",
]
fx_cc_test_binary(
name = "async-loop-cxx17",
srcs = ["loop_tests.cc"],
build_flags = ["//build/config:c++17"],
deps = _TEST_DEPS,
)
fx_cc_test_binary(
name = "async-loop-cxx20",
srcs = ["loop_tests.cc"],
build_flags = ["//build/config:c++20"],
deps = _TEST_DEPS,
)
fx_cc_test_binary(
name = "async-loop-cxx23",
srcs = ["loop_tests.cc"],
build_flags = ["//build/config:c++23"],
deps = _TEST_DEPS,
)
# Preserve the component names generated by GN's `sdk_cpp_unittest_package()`
# so `tests.json` URLs and ResultDB test history remain unchanged.
fx_unittest_component(
name = "async-loop-cxx17-component",
binary = ":async-loop-cxx17",
component_name = "_sdk_cpp_unittest_package.async-loop-test-pkg.component-cxx17",
)
fx_unittest_component(
name = "async-loop-cxx20-component",
binary = ":async-loop-cxx20",
component_name = "_sdk_cpp_unittest_package.async-loop-test-pkg.component-cxx20",
)
fx_unittest_component(
name = "async-loop-cxx23-component",
binary = ":async-loop-cxx23",
component_name = "_sdk_cpp_unittest_package.async-loop-test-pkg.component-cxx23",
)
fx_package(
name = "async-loop-test-pkg_package",
package_name = "async-loop-test-pkg",
test_components = [
":async-loop-cxx17-component",
":async-loop-cxx20-component",
":async-loop-cxx23-component",
],
)
fx_test(
name = "async-loop-test-pkg",
package = ":async-loop-test-pkg_package",
)