Commit eb254530 authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

gc: Add library and test targets

Adds a target for the library and test targets.

- Integrate into compontents_unittests as all other components do as
  well. This ensures that unittests are automatically run on CI.
- Provide a separate gc_unittests binary as the components binary
  requires ~35k files to build.

Bug: 1056170
Change-Id: I8fa235c239f2dc5217145c12abb8c1f27af84fc5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2080422
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745597}
parent efba5337
...@@ -73,6 +73,7 @@ group("gn_all") { ...@@ -73,6 +73,7 @@ group("gn_all") {
"//chrome/installer", "//chrome/installer",
"//chrome/updater", "//chrome/updater",
"//components:components_unittests", "//components:components_unittests",
"//components/gc:gc_unittests",
"//components/gwp_asan:gwp_asan_unittests", "//components/gwp_asan:gwp_asan_unittests",
"//net:net_unittests", "//net:net_unittests",
"//services:services_unittests", "//services:services_unittests",
......
...@@ -36,9 +36,7 @@ if (is_ios) { ...@@ -36,9 +36,7 @@ if (is_ios) {
"$root_out_dir/components_tests_resources.pak", "$root_out_dir/components_tests_resources.pak",
"$root_out_dir/ui_test.pak", "$root_out_dir/ui_test.pak",
] ]
outputs = [ outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
"{{bundle_resources_dir}}/{{source_file_part}}",
]
} }
} }
...@@ -48,9 +46,7 @@ if (is_ios) { ...@@ -48,9 +46,7 @@ if (is_ios) {
# test target if convenient. # test target if convenient.
test("components_unittests") { test("components_unittests") {
if (is_android || is_linux || is_mac || is_win) { if (is_android || is_linux || is_mac || is_win) {
data = [ data = [ "test/data/" ]
"test/data/",
]
} }
# Add only ":unit_tests" dependencies here. If your tests have dependencies # Add only ":unit_tests" dependencies here. If your tests have dependencies
...@@ -93,6 +89,7 @@ test("components_unittests") { ...@@ -93,6 +89,7 @@ test("components_unittests") {
"//components/filename_generation:unit_tests", "//components/filename_generation:unit_tests",
"//components/flags_ui:unit_tests", "//components/flags_ui:unit_tests",
"//components/games/core:unit_tests", "//components/games/core:unit_tests",
"//components/gc:unit_tests",
"//components/gcm_driver:unit_tests", "//components/gcm_driver:unit_tests",
"//components/gcm_driver/crypto:unit_tests", "//components/gcm_driver/crypto:unit_tests",
"//components/google/core/common:unit_tests", "//components/google/core/common:unit_tests",
......
# Copyright 2020 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//testing/test.gni")
component("gc") {
sources = [
"core/gc.cc",
"core/gc_export.h",
]
deps = []
defines = [ "GC_IMPLEMENTATION=1" ]
}
source_set("unit_tests") {
testonly = true
sources = []
deps = [
":gc",
"//testing/gtest",
]
}
# Convenience target to allow just building GC-related tests for local development.
test("gc_unittests") {
testonly = true
sources = [ "test/run_all_unittests.cc" ]
deps = [
":unit_tests",
"//testing/gtest",
]
}
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/gc/core/gc_export.h"
namespace gc {
namespace internal {
GC_EXPORT void Dummy() {
// TODO(mlippautz): Placeholder to force building a library. Remove as soon as
// actual code is available.
}
} // namespace internal
} // namespace gc
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_GC_CORE_GC_EXPORT_H_
#define COMPONENTS_GC_CORE_GC_EXPORT_H_
#if defined(COMPONENT_BUILD)
#if defined(WIN32)
#if defined(GC_IMPLEMENTATION)
#define GC_EXPORT __declspec(dllexport)
#else
#define GC_EXPORT __declspec(dllimport)
#endif // defined(GC_IMPLEMENTATION)
#else // defined(WIN32)
#if defined(GC_IMPLEMENTATION)
#define GC_EXPORT __attribute__((visibility("default")))
#else
#define GC_EXPORT
#endif // defined(GC_IMPLEMENTATION)
#endif
#else // defined(COMPONENT_BUILD)
#define GC_EXPORT
#endif
#endif // COMPONENTS_GC_CORE_GC_EXPORT_H_
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "testing/gtest/include/gtest/gtest.h"
int main(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment