Files
TheRock/compiler/amd-llvm/llvm/utils/gn/secondary/third-party/unittest/unittest.gni
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

59 lines
2.3 KiB
Plaintext

# This file defines a template for adding a unittest binary.
#
# It's a thin wrapper around GN's built-in executable() target type and
# accepts the same parameters, and in addition this paramater:
#
# has_custom_main (optional)
# [bool] If set, link against gtest instead of UnitTestMain; for tests
# that define their own main() function.
#
# Example use:
#
# unittest("FormatTest") {
# sources = [ ... ]
# ...
# }
template("unittest") {
executable(target_name) {
has_custom_main = false # Default value.
# Foward everything (has_custom_main if set; configs, sources, deps, ...).
forward_variables_from(invoker, "*")
assert(!defined(invoker.output_dir), "cannot set unittest output_dir")
assert(!defined(invoker.testonly), "cannot set unittest testonly")
# Common settings for all unit tests.
# Unit test binaries shouldn't go right in out/gn/bin, for two reasons:
# 1. That's where production binaries go.
# 2. The CMake build doesn't put the unit tests of all projects (clang,
# lld,...) in one directory, so it's not guaranteed that there won't
# be name collisions between test binaries from separate projects.
# Each lit suite takes an foo_obj_root parameter and puts temporary files
# for lit tests at foo_obj_root/test and looks for unit test binaries
# below foo_obj_root/unittests. As long as the BUILD.gn files processing
# the lit.site.cfg.py.in files match the output dir here, it doesn't
# matter all that much where the unit test binaries go, with the weak
# constraints that test binaries of different projects should go in
# different folders, and that it's not too difficult to manually
# run the unit test binary if necessary. Using target_out_dir here
# means that //clang/unittests/Format gets its binary in
# out/gn/obj/clang/unittests/Format/FormatTests, which seems fine.
#
# If you change output_dir here, look through
# `git grep target_out_dir '*/unittests/*'` and update those too.
output_dir = target_out_dir
if (has_custom_main) {
deps += [ "//third-party/unittest:gtest" ]
} else {
deps += [ "//third-party/unittest/UnitTestMain" ]
}
testonly = true
}
}
set_defaults("unittest") {
configs = shared_binary_target_configs
}