Commit ba04be8c by Jamie Madill Committed by Commit Bot

GN: Refactor angle_test and remove angle_test_main.

This cleans up the GN files and prepares them for eventually using a custom test harness. Bug: anglerproject:3162 Change-Id: I3d8568628a9465093adec9e838617a002192beef Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1821939Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 273175cd
......@@ -149,7 +149,16 @@ set_defaults("angle_static_library") {
set_defaults("angle_test") {
configs = angle_common_configs
public_configs = []
public_deps = []
sources = []
data = []
main = ""
suppressed_configs = angle_remove_configs
# TODO(jmadill): Migrate to standalone harness. http://anglebug.com/3162
if (build_with_chromium) {
suppressed_configs -= [ "//build/config/compiler:default_include_dirs" ]
}
}
template("angle_executable") {
......@@ -232,6 +241,18 @@ template("angle_static_library") {
}
template("angle_test") {
_googletest_deps = [
"//testing/gmock",
"//testing/gtest",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
]
# TODO(jmadill): Migrate to standalone harness. http://anglebug.com/3162
if (build_with_chromium) {
_googletest_deps += [ "//base/test:test_support" ]
}
test(target_name) {
forward_variables_from(invoker,
"*",
......@@ -257,5 +278,16 @@ template("angle_test") {
configs += [ angle_root + ":build_id_config" ]
configs -= [ "//build/config/android:hide_all_but_jni" ]
}
deps += _googletest_deps + [
"$angle_root:angle_common",
"$angle_root:includes",
]
if (build_with_chromium) {
sources += [ "//gpu/${invoker.main}.cc" ]
} else {
sources += [ "${invoker.main}.cpp" ]
}
}
}
......@@ -13,16 +13,7 @@ declare_args() {
build_angle_gles1_conform_tests = false
}
googletest_deps = [
"//testing/gmock",
"//testing/gtest",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
]
if (build_with_chromium) {
googletest_deps += [ "//base/test:test_support" ]
} else {
if (!build_with_chromium) {
group("all") {
testonly = true
deps = [
......@@ -54,43 +45,7 @@ if (build_with_chromium) {
}
}
# Helper template for including "main" files in Chromium.
template("angle_tests_main") {
source_set(target_name) {
testonly = true
public_deps = googletest_deps
deps = [
"${angle_root}:includes",
]
main = invoker.main
if (build_with_chromium) {
sources = [
"//gpu/$main.cc",
]
} else {
sources = [
"$main.cpp",
]
}
}
}
# Should fix the naming here once we migrate away from Chromium "main" files.
angle_tests_main("angle_unittests_main") {
main = "angle_unittest_main"
}
angle_tests_main("angle_end2end_tests_main") {
main = "angle_end2end_tests_main"
}
angle_tests_main("angle_perftests_main") {
main = "angle_perftests_main"
}
angle_test("angle_unittests_helper") {
angle_executable("angle_unittests_helper") {
sources = angle_unittests_helper_sources
deps = [
......@@ -131,20 +86,20 @@ angle_static_library("angle_test_expectations") {
angle_test("angle_unittests") {
sources = angle_unittests_sources
main = "angle_unittest_main"
if (angle_enable_hlsl) {
sources += angle_unittests_hlsl_sources
defines = [ "ANGLE_ENABLE_HLSL" ]
}
deps = googletest_deps + [
"${angle_root}:libANGLE",
":angle_test_expectations",
"${angle_root}:preprocessor",
"${angle_root}:translator",
"${angle_root}:libfeature_support",
":angle_unittests_main",
]
deps = [
":angle_test_expectations",
"${angle_root}:libANGLE",
"${angle_root}:libfeature_support",
"${angle_root}:preprocessor",
"${angle_root}:translator",
]
if (!is_android && !is_fuchsia) {
# SystemUtils.RunApp, the only unittest using a helper binary, is not supported on these
# platforms yet.
......@@ -161,6 +116,7 @@ if (is_win || is_linux || is_mac || is_android || is_fuchsia) {
include_dirs = [ "." ]
sources = angle_end2end_tests_sources
main = "angle_end2end_tests_main"
libs = []
if (is_mac) {
......@@ -186,7 +142,6 @@ if (is_win || is_linux || is_mac || is_android || is_fuchsia) {
]
deps = [
":angle_end2end_tests_main",
":angle_test_expectations",
"${angle_root}:angle_gpu_info_util",
"${angle_root}:angle_image_util",
......@@ -215,6 +170,7 @@ if (is_win || is_linux || is_mac || is_android) {
angle_test("angle_white_box_tests") {
include_dirs = [ "." ]
sources = angle_white_box_tests_sources
main = "angle_end2end_tests_main"
if (is_win) {
sources += angle_white_box_tests_win_sources
......@@ -230,7 +186,6 @@ if (is_win || is_linux || is_mac || is_android) {
]
deps = [
":angle_end2end_tests_main",
"${angle_root}:angle_util_static",
"${angle_root}:libANGLE",
"${angle_root}:libEGL_static",
......@@ -252,9 +207,9 @@ if (is_win || is_linux || is_android || is_mac) {
angle_test("angle_white_box_perftests") {
include_dirs = [ "." ]
sources = angle_white_box_perf_tests_sources
main = "angle_perftests_main"
deps = [
":angle_perftests_main",
"${angle_jsoncpp_dir}:jsoncpp",
"${angle_root}:angle_util_static",
"${angle_root}:libANGLE",
......@@ -290,9 +245,9 @@ if (is_win || is_linux || is_android || is_mac || is_fuchsia) {
angle_test("angle_perftests") {
include_dirs = [ "." ]
sources = angle_perf_tests_sources
main = "angle_perftests_main"
deps = [
":angle_perftests_main",
"${angle_jsoncpp_dir}:jsoncpp",
"${angle_root}:angle_common",
"${angle_root}:angle_gpu_info_util",
......@@ -523,7 +478,6 @@ if (build_angle_gles1_conform_tests) {
angle_test("angle_gles1_conformance_tests") {
deps = [
":angle_end2end_tests_main",
":angle_gles1_conformance_no_gtest",
]
......@@ -539,6 +493,7 @@ if (build_angle_gles1_conform_tests) {
"test_utils/angle_test_instantiate.h",
"test_utils/gl_raii.h",
]
main = "angle_end2end_tests_main"
configs += [
"${angle_root}:libANGLE_config",
......@@ -559,10 +514,6 @@ if (build_angle_gles1_conform_tests) {
if (build_angle_deqp_tests && !is_fuchsia) {
import("deqp.gni")
angle_tests_main("angle_deqp_tests_main") {
main = "angle_deqp_tests_main"
}
config("angle_deqp_support") {
include_dirs = deqp_include_dirs
if (is_win && !is_clang) {
......@@ -840,19 +791,6 @@ if (build_angle_deqp_tests && !is_fuchsia) {
}
}
angle_source_set("angle_deqp_gtest_support") {
testonly = true
public_deps = [
":angle_deqp_tests_main",
":angle_test_expectations",
"${angle_root}:angle_common",
"${angle_root}:angle_util",
]
libs = []
}
set_defaults("angle_deqp_gtest") {
deps = []
sources = []
......@@ -908,13 +846,16 @@ if (build_angle_deqp_tests && !is_fuchsia) {
angle_test("angle_deqp_${_api}_tests") {
deps = [
":${shared_library_name}",
":angle_deqp_gtest_support",
":angle_test_expectations",
"${angle_root}:angle_common",
"${angle_root}:angle_util",
]
# Must be included outside of the source set for the define
sources = [
"deqp_support/angle_deqp_gtest.cpp",
]
main = "angle_deqp_tests_main"
data = [
"deqp_support/deqp_${_api}_test_expectations.txt",
......
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