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") { ...@@ -149,7 +149,16 @@ set_defaults("angle_static_library") {
set_defaults("angle_test") { set_defaults("angle_test") {
configs = angle_common_configs configs = angle_common_configs
public_configs = [] public_configs = []
public_deps = []
sources = []
data = []
main = ""
suppressed_configs = angle_remove_configs 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") { template("angle_executable") {
...@@ -232,6 +241,18 @@ template("angle_static_library") { ...@@ -232,6 +241,18 @@ template("angle_static_library") {
} }
template("angle_test") { 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) { test(target_name) {
forward_variables_from(invoker, forward_variables_from(invoker,
"*", "*",
...@@ -257,5 +278,16 @@ template("angle_test") { ...@@ -257,5 +278,16 @@ template("angle_test") {
configs += [ angle_root + ":build_id_config" ] configs += [ angle_root + ":build_id_config" ]
configs -= [ "//build/config/android:hide_all_but_jni" ] 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() { ...@@ -13,16 +13,7 @@ declare_args() {
build_angle_gles1_conform_tests = false build_angle_gles1_conform_tests = false
} }
googletest_deps = [ if (!build_with_chromium) {
"//testing/gmock",
"//testing/gtest",
"//third_party/googletest:gmock",
"//third_party/googletest:gtest",
]
if (build_with_chromium) {
googletest_deps += [ "//base/test:test_support" ]
} else {
group("all") { group("all") {
testonly = true testonly = true
deps = [ deps = [
...@@ -54,43 +45,7 @@ if (build_with_chromium) { ...@@ -54,43 +45,7 @@ if (build_with_chromium) {
} }
} }
# Helper template for including "main" files in Chromium. angle_executable("angle_unittests_helper") {
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") {
sources = angle_unittests_helper_sources sources = angle_unittests_helper_sources
deps = [ deps = [
...@@ -131,20 +86,20 @@ angle_static_library("angle_test_expectations") { ...@@ -131,20 +86,20 @@ angle_static_library("angle_test_expectations") {
angle_test("angle_unittests") { angle_test("angle_unittests") {
sources = angle_unittests_sources sources = angle_unittests_sources
main = "angle_unittest_main"
if (angle_enable_hlsl) { if (angle_enable_hlsl) {
sources += angle_unittests_hlsl_sources sources += angle_unittests_hlsl_sources
defines = [ "ANGLE_ENABLE_HLSL" ] defines = [ "ANGLE_ENABLE_HLSL" ]
} }
deps = googletest_deps + [ deps = [
"${angle_root}:libANGLE", ":angle_test_expectations",
":angle_test_expectations", "${angle_root}:libANGLE",
"${angle_root}:preprocessor", "${angle_root}:libfeature_support",
"${angle_root}:translator", "${angle_root}:preprocessor",
"${angle_root}:libfeature_support", "${angle_root}:translator",
":angle_unittests_main", ]
]
if (!is_android && !is_fuchsia) { if (!is_android && !is_fuchsia) {
# SystemUtils.RunApp, the only unittest using a helper binary, is not supported on these # SystemUtils.RunApp, the only unittest using a helper binary, is not supported on these
# platforms yet. # platforms yet.
...@@ -161,6 +116,7 @@ if (is_win || is_linux || is_mac || is_android || is_fuchsia) { ...@@ -161,6 +116,7 @@ if (is_win || is_linux || is_mac || is_android || is_fuchsia) {
include_dirs = [ "." ] include_dirs = [ "." ]
sources = angle_end2end_tests_sources sources = angle_end2end_tests_sources
main = "angle_end2end_tests_main"
libs = [] libs = []
if (is_mac) { if (is_mac) {
...@@ -186,7 +142,6 @@ if (is_win || is_linux || is_mac || is_android || is_fuchsia) { ...@@ -186,7 +142,6 @@ if (is_win || is_linux || is_mac || is_android || is_fuchsia) {
] ]
deps = [ deps = [
":angle_end2end_tests_main",
":angle_test_expectations", ":angle_test_expectations",
"${angle_root}:angle_gpu_info_util", "${angle_root}:angle_gpu_info_util",
"${angle_root}:angle_image_util", "${angle_root}:angle_image_util",
...@@ -215,6 +170,7 @@ if (is_win || is_linux || is_mac || is_android) { ...@@ -215,6 +170,7 @@ if (is_win || is_linux || is_mac || is_android) {
angle_test("angle_white_box_tests") { angle_test("angle_white_box_tests") {
include_dirs = [ "." ] include_dirs = [ "." ]
sources = angle_white_box_tests_sources sources = angle_white_box_tests_sources
main = "angle_end2end_tests_main"
if (is_win) { if (is_win) {
sources += angle_white_box_tests_win_sources sources += angle_white_box_tests_win_sources
...@@ -230,7 +186,6 @@ if (is_win || is_linux || is_mac || is_android) { ...@@ -230,7 +186,6 @@ if (is_win || is_linux || is_mac || is_android) {
] ]
deps = [ deps = [
":angle_end2end_tests_main",
"${angle_root}:angle_util_static", "${angle_root}:angle_util_static",
"${angle_root}:libANGLE", "${angle_root}:libANGLE",
"${angle_root}:libEGL_static", "${angle_root}:libEGL_static",
...@@ -252,9 +207,9 @@ if (is_win || is_linux || is_android || is_mac) { ...@@ -252,9 +207,9 @@ if (is_win || is_linux || is_android || is_mac) {
angle_test("angle_white_box_perftests") { angle_test("angle_white_box_perftests") {
include_dirs = [ "." ] include_dirs = [ "." ]
sources = angle_white_box_perf_tests_sources sources = angle_white_box_perf_tests_sources
main = "angle_perftests_main"
deps = [ deps = [
":angle_perftests_main",
"${angle_jsoncpp_dir}:jsoncpp", "${angle_jsoncpp_dir}:jsoncpp",
"${angle_root}:angle_util_static", "${angle_root}:angle_util_static",
"${angle_root}:libANGLE", "${angle_root}:libANGLE",
...@@ -290,9 +245,9 @@ if (is_win || is_linux || is_android || is_mac || is_fuchsia) { ...@@ -290,9 +245,9 @@ if (is_win || is_linux || is_android || is_mac || is_fuchsia) {
angle_test("angle_perftests") { angle_test("angle_perftests") {
include_dirs = [ "." ] include_dirs = [ "." ]
sources = angle_perf_tests_sources sources = angle_perf_tests_sources
main = "angle_perftests_main"
deps = [ deps = [
":angle_perftests_main",
"${angle_jsoncpp_dir}:jsoncpp", "${angle_jsoncpp_dir}:jsoncpp",
"${angle_root}:angle_common", "${angle_root}:angle_common",
"${angle_root}:angle_gpu_info_util", "${angle_root}:angle_gpu_info_util",
...@@ -523,7 +478,6 @@ if (build_angle_gles1_conform_tests) { ...@@ -523,7 +478,6 @@ if (build_angle_gles1_conform_tests) {
angle_test("angle_gles1_conformance_tests") { angle_test("angle_gles1_conformance_tests") {
deps = [ deps = [
":angle_end2end_tests_main",
":angle_gles1_conformance_no_gtest", ":angle_gles1_conformance_no_gtest",
] ]
...@@ -539,6 +493,7 @@ if (build_angle_gles1_conform_tests) { ...@@ -539,6 +493,7 @@ if (build_angle_gles1_conform_tests) {
"test_utils/angle_test_instantiate.h", "test_utils/angle_test_instantiate.h",
"test_utils/gl_raii.h", "test_utils/gl_raii.h",
] ]
main = "angle_end2end_tests_main"
configs += [ configs += [
"${angle_root}:libANGLE_config", "${angle_root}:libANGLE_config",
...@@ -559,10 +514,6 @@ if (build_angle_gles1_conform_tests) { ...@@ -559,10 +514,6 @@ if (build_angle_gles1_conform_tests) {
if (build_angle_deqp_tests && !is_fuchsia) { if (build_angle_deqp_tests && !is_fuchsia) {
import("deqp.gni") import("deqp.gni")
angle_tests_main("angle_deqp_tests_main") {
main = "angle_deqp_tests_main"
}
config("angle_deqp_support") { config("angle_deqp_support") {
include_dirs = deqp_include_dirs include_dirs = deqp_include_dirs
if (is_win && !is_clang) { if (is_win && !is_clang) {
...@@ -840,19 +791,6 @@ if (build_angle_deqp_tests && !is_fuchsia) { ...@@ -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") { set_defaults("angle_deqp_gtest") {
deps = [] deps = []
sources = [] sources = []
...@@ -908,13 +846,16 @@ if (build_angle_deqp_tests && !is_fuchsia) { ...@@ -908,13 +846,16 @@ if (build_angle_deqp_tests && !is_fuchsia) {
angle_test("angle_deqp_${_api}_tests") { angle_test("angle_deqp_${_api}_tests") {
deps = [ deps = [
":${shared_library_name}", ":${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 # Must be included outside of the source set for the define
sources = [ sources = [
"deqp_support/angle_deqp_gtest.cpp", "deqp_support/angle_deqp_gtest.cpp",
] ]
main = "angle_deqp_tests_main"
data = [ data = [
"deqp_support/deqp_${_api}_test_expectations.txt", "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