# Copyright 2015 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/compiler/compiler.gni")
import("//build/config/features.gni")
import("//build/config/nacl/config.gni")
import("//components/nacl/features.gni")
import("//components/nacl/target_cpu.gni")
import("//ppapi/native_client/nacl_test_data.gni")
group("nacl") {
newlib = "//build/toolchain/nacl:clang_newlib_${nacl_target_cpu}"
pnacl = "//build/toolchain/nacl:newlib_pnacl"
test_irt = "//build/toolchain/nacl:test_irt_${nacl_target_cpu}"
data_deps = [
":exit_status_test($newlib)",
":exit_status_test($pnacl)",
":extension_validation_cache($newlib)",
":irt_exception_test($newlib)",
":irt_exception_test($pnacl)",
":irt_manifest_file($newlib)",
":pnacl_debug_url_test($pnacl)",
":pnacl_dyncode_syscall_disabled_test($pnacl)",
":pnacl_error_handling_test($pnacl)",
":pnacl_hw_eh_disabled_test($pnacl)",
":pnacl_options_test($pnacl)",
":pnacl_url_loader_test($pnacl)",
":ppapi_bad_get_ppp_instance_crash($newlib)",
":ppapi_bad_no_ppp_instance($newlib)",
":ppapi_bad_ppp_initialize($newlib)",
":ppapi_bad_ppp_initialize_crash($newlib)",
":ppapi_bad_ppp_instance_didcreate($newlib)",
":ppapi_bad_ppp_instance_didcreate_crash($newlib)",
":ppapi_crash_in_callback($newlib)",
":ppapi_crash_in_callback($pnacl)",
":ppapi_crash_off_main_thread($newlib)",
":ppapi_crash_off_main_thread($pnacl)",
":ppapi_crash_ppapi_off_main_thread($newlib)",
":ppapi_crash_ppapi_off_main_thread($pnacl)",
":ppapi_crash_via_check_failure($newlib)",
":ppapi_crash_via_check_failure($pnacl)",
":ppapi_crash_via_exit_call($newlib)",
":ppapi_crash_via_exit_call($pnacl)",
":ppapi_crash_via_libcxx_assert_failure($test_irt)",
":ppapi_extension_mime_handler($newlib)",
":ppapi_ppb_core($newlib)",
":ppapi_ppb_core($pnacl)",
":ppapi_ppb_instance($newlib)",
":ppapi_ppb_instance($pnacl)",
":ppapi_ppp_instance($newlib)",
":ppapi_ppp_instance($pnacl)",
":ppapi_progress_events($newlib)",
":ppapi_progress_events($pnacl)",
":shared_test_files($newlib)",
":shared_test_files($pnacl)",
":shared_test_files($test_irt)",
":simple_test($newlib)",
":simple_test($pnacl)",
":sysconf_nprocessors_onln_test($newlib)",
":sysconf_nprocessors_onln_test($pnacl)",
]
if (nacl_target_cpu != "arm") {
data_deps += [ ":partly_invalid($newlib)" ]
}
if (target_cpu != "mipsel") {
# GlibC tools are not available for MIPS
glibc = "//build/toolchain/nacl:glibc_${nacl_target_cpu}"
data_deps += [
":exit_status_test($glibc)",
":extension_validation_cache($glibc)",
":irt_exception_test($glibc)",
":ppapi_crash_in_callback($glibc)",
":ppapi_crash_off_main_thread($glibc)",
":ppapi_crash_ppapi_off_main_thread($glibc)",
":ppapi_crash_via_check_failure($glibc)",
":ppapi_crash_via_exit_call($glibc)",
":ppapi_ppb_core($glibc)",
":ppapi_ppb_instance($glibc)",
":ppapi_ppp_instance($glibc)",
":ppapi_progress_events($glibc)",
":shared_test_files($glibc)",
":simple_test($glibc)",
":sysconf_nprocessors_onln_test($glibc)",
]
}
}
if (is_nacl) {
copy("shared_test_files") {
sources = [
# TODO(ncbray) move into chrome/test/data/nacl when all tests are
# converted.
"//ppapi/native_client/tools/browser_tester/browserdata/nacltest.js",
# Files that aren't associated with any particular executable.
"bad/ppapi_bad.html",
"bad/ppapi_bad.js",
"bad/ppapi_bad_doesnotexist.nmf",
"bad/ppapi_bad_magic.nmf",
"bad/ppapi_bad_manifest_bad_files.nmf",
"bad/ppapi_bad_manifest_nexe_arch.nmf",
"bad/ppapi_bad_manifest_uses_nexes.nmf",
"bad/ppapi_bad_native.html",
"crash/ppapi_crash.js",
"crash/ppapi_crash_in_callback.html",
"crash/ppapi_crash_off_main_thread.html",
"crash/ppapi_crash_ppapi_off_main_thread.html",
"crash/ppapi_crash_via_check_failure.html",
"crash/ppapi_crash_via_exit_call.html",
"load_util.js",
"manifest_file/test_file.txt",
"progress_event_listener.js",
"simple_cc.js",
]
outputs = [ "${root_build_dir}/nacl_test_data/${nacl_toolchain_variant}/{{source_file_part}}" ]
}
static_library("ppapi_test_lib") {
sources = [
"ppapi_test_lib/get_browser_interface.cc",
"ppapi_test_lib/get_browser_interface.h",
"ppapi_test_lib/internal_utils.cc",
"ppapi_test_lib/internal_utils.h",
"ppapi_test_lib/module_instance.cc",
"ppapi_test_lib/test_interface.cc",
"ppapi_test_lib/test_interface.h",
"ppapi_test_lib/testable_callback.cc",
"ppapi_test_lib/testable_callback.h",
]
deps = [
"//native_client/src/shared/gio",
"//native_client/src/shared/platform",
"//ppapi/c",
"//ppapi/native_client:ppapi_lib",
]
}
nacl_test_data("irt_manifest_file") {
sources = [ "manifest_file/irt_manifest_file_test.cc" ]
deps = [ "//ppapi/cpp" ]
nmfflags = [
"-xtest_file:test_file.txt",
"-xnmf says hello world:test_file.txt",
# There is no dummy_test_file.txt file intentionally. This is just for
# a test case where there is a manifest entry, but no actual file.
"-xdummy_test_file:dummy_test_file.txt",
]
destination_dir = "nacl_test_data"
test_files = [ "manifest_file/irt_manifest_file_test.html" ]
}
nacl_test_data("irt_exception_test") {
sources = [ "irt_exception/irt_exception_test.cc" ]
deps = [ ":ppapi_test_lib" ]
libs = [ "nacl_exception" ]
destination_dir = "nacl_test_data"
test_files = [ "irt_exception/irt_exception_test.html" ]
}
}
if (is_nacl) {
nacl_test_data("simple_test") {
output_name = "simple"
sources = [ "simple.cc" ]
deps = [ "//ppapi/cpp" ]
destination_dir = "nacl_test_data"
test_files = [ "nacl_load_test.html" ]
}
nacl_test_data("exit_status_test") {
output_name = "pm_exit_status_test"
sources = [ "exit_status/pm_exit_status_test.cc" ]
deps = [ "//ppapi/cpp" ]
destination_dir = "nacl_test_data"
test_files = [ "exit_status/pm_exit_status_test.html" ]
}
nacl_test_data("extension_validation_cache") {
sources = [ "simple.cc" ]
deps = [ "//ppapi/cpp" ]
# Need a new directory to not clash with with other extension
# tests's files (e.g., manifest.json).
destination_dir = "nacl_test_data/extension_vcache_test"
test_files = [
# TODO(ncbray) move into chrome/test/data/nacl when all tests are
# converted.
"//ppapi/native_client/tools/browser_tester/browserdata/nacltest.js",
"extension_validation_cache/extension_validation_cache.html",
"extension_validation_cache/extension_validation_cache.js",
# Turns the test data directory into an extension.
# Use a different nexe_destination_dir to isolate the files.
# Note that the .nexe names are embedded in this file.
"extension_validation_cache/manifest.json",
"load_util.js",
"simple_cc.js",
]
}
nacl_test_data("sysconf_nprocessors_onln_test") {
sources = [ "sysconf_nprocessors_onln/sysconf_nprocessors_onln_test.cc" ]
deps = [ "//ppapi/cpp" ]
destination_dir = "nacl_test_data"
test_files =
[ "sysconf_nprocessors_onln/sysconf_nprocessors_onln_test.html" ]
}
nacl_test_data("ppapi_progress_events") {
sources = [ "progress_events/ppapi_progress_events.cc" ]
destination_dir = "nacl_test_data"
test_files = [ "progress_events/ppapi_progress_events.html" ]
deps = [ ":ppapi_test_lib" ]
}
nacl_test_data("ppapi_bad_ppp_initialize") {
sources = [ "bad/ppapi_bad_ppp_initialize.cc" ]
destination_dir = "nacl_test_data"
}
nacl_test_data("ppapi_bad_ppp_initialize_crash") {
sources = [ "bad/ppapi_bad_ppp_initialize_crash.cc" ]
deps = [ ":ppapi_test_lib" ]
destination_dir = "nacl_test_data"
}
nacl_test_data("ppapi_bad_no_ppp_instance") {
sources = [ "bad/ppapi_bad_no_ppp_instance.cc" ]
deps = [ "//native_client/src/shared/platform" ]
destination_dir = "nacl_test_data"
}
nacl_test_data("ppapi_bad_get_ppp_instance_crash") {
sources = [ "bad/ppapi_bad_get_ppp_instance_crash.cc" ]
deps = [ ":ppapi_test_lib" ]
destination_dir = "nacl_test_data"
}
nacl_test_data("ppapi_bad_ppp_instance_didcreate") {
sources = [ "bad/ppapi_bad_ppp_instance_didcreate.cc" ]
destination_dir = "nacl_test_data"
}
nacl_test_data("ppapi_bad_ppp_instance_didcreate_crash") {
sources = [ "bad/ppapi_bad_ppp_instance_didcreate_crash.cc" ]
deps = [ ":ppapi_test_lib" ]
destination_dir = "nacl_test_data"
}
nacl_test_data("ppapi_crash_via_check_failure") {
sources = [ "crash/ppapi_crash_via_check_failure.cc" ]
destination_dir = "nacl_test_data"
deps = [ ":ppapi_test_lib" ]
}
nacl_test_data("ppapi_crash_via_exit_call") {
sources = [ "crash/ppapi_crash_via_exit_call.cc" ]
destination_dir = "nacl_test_data"
deps = [ ":ppapi_test_lib" ]
}
nacl_test_data("ppapi_crash_via_libcxx_assert_failure") {
sources = [ "crash/ppapi_crash_via_libcxx_assert_failure.cc" ]
destination_dir = "nacl_test_data"
deps = [ ":ppapi_test_lib" ]
test_files = [ "crash/ppapi_crash_via_libcxx_assert_failure.html" ]
}
nacl_test_data("ppapi_crash_in_callback") {
sources = [ "crash/ppapi_crash_in_callback.cc" ]
destination_dir = "nacl_test_data"
deps = [ ":ppapi_test_lib" ]
}
nacl_test_data("ppapi_crash_off_main_thread") {
sources = [ "crash/ppapi_crash_off_main_thread.cc" ]
destination_dir = "nacl_test_data"
deps = [ ":ppapi_test_lib" ]
}
nacl_test_data("ppapi_crash_ppapi_off_main_thread") {
sources = [ "crash/ppapi_crash_ppapi_off_main_thread.cc" ]
destination_dir = "nacl_test_data"
deps = [ ":ppapi_test_lib" ]
}
nacl_test_data("ppapi_extension_mime_handler") {
sources = [ "extension_mime_handler/ppapi_extension_mime_handler.cc" ]
deps = [ ":ppapi_test_lib" ]
destination_dir = "nacl_test_data"
test_files = [
"extension_mime_handler/ppapi_extension_mime_handler.html",
"extension_mime_handler/mime_test_data.dat",
# For faking the file's MIME type.
"extension_mime_handler/mime_test_data.dat.mock-http-headers",
# Turns the test data directory into an extension. Hackish.
# Note that the .nexe names are embedded in this file.
"extension_mime_handler/manifest.json",
]
}
nacl_test_data("pnacl_debug_url_test") {
output_name = "pnacl_debug_url"
sources = [ "simple.cc" ]
deps = [ "//ppapi/cpp" ]
generate_nmf = false
if (current_cpu == "pnacl") {
debug_pexe = true
}
destination_dir = "nacl_test_data"
test_files = [
"pnacl_debug_url/pnacl_debug_url.html",
"pnacl_debug_url/pnacl_has_debug.nmf",
"pnacl_debug_url/pnacl_has_debug_flag_off.nmf",
"pnacl_debug_url/pnacl_no_debug.nmf",
]
}
nacl_test_data("pnacl_error_handling_test") {
output_name = "pnacl_errors"
sources = [ "simple.cc" ]
deps = [ "//ppapi/cpp" ]
generate_nmf = false
if (current_cpu == "pnacl") {
nonstable_pexe = true
}
destination_dir = "nacl_test_data"
test_files = [
"pnacl_error_handling/pnacl_error_handling.html",
"pnacl_error_handling/bad.pexe",
"pnacl_error_handling/pnacl_bad_pexe.nmf",
"pnacl_error_handling/pnacl_bad_pexe_O0.nmf",
"pnacl_error_handling/pnacl_bad_doesnotexist.nmf",
"pnacl_error_handling/pnacl_illformed_manifest.nmf",
"pnacl_error_handling/pnacl_nonfinal_pexe_O0.nmf",
]
}
nacl_test_data("pnacl_options_test") {
output_name = "pnacl_options"
sources = [ "simple.cc" ]
deps = [ "//ppapi/cpp" ]
generate_nmf = false
destination_dir = "nacl_test_data"
test_files = [
"pnacl_nmf_options/pnacl_options.html",
"pnacl_nmf_options/pnacl_o_0.nmf",
"pnacl_nmf_options/pnacl_o_2.nmf",
"pnacl_nmf_options/pnacl_o_large.nmf",
]
}
nacl_test_data("pnacl_url_loader_test") {
output_name = "pnacl_url_loader"
sources = [ "pnacl_url_loader/pnacl_url_loader.cc" ]
deps = [ "//ppapi/cpp" ]
generate_nmf = true
destination_dir = "nacl_test_data"
test_files = [ "pnacl_url_loader/pnacl_url_loader.html" ]
}
nacl_test_data("pnacl_dyncode_syscall_disabled_test") {
output_name = "pnacl_dyncode_syscall_disabled"
sources =
[ "pnacl_dyncode_syscall_disabled/pnacl_dyncode_syscall_disabled.cc" ]
deps = [
":ppapi_test_lib",
"//native_client/src/untrusted/nacl:nacl_dyncode_private",
]
destination_dir = "nacl_test_data"
test_files =
[ "pnacl_dyncode_syscall_disabled/pnacl_dyncode_syscall_disabled.html" ]
}
nacl_test_data("pnacl_hw_eh_disabled_test") {
output_name = "pnacl_hw_eh_disabled"
sources = [ "pnacl_hw_eh_disabled/pnacl_hw_eh_disabled.cc" ]
deps = [
":ppapi_test_lib",
"//native_client/src/untrusted/nacl:nacl_exception_private",
]
destination_dir = "nacl_test_data"
test_files = [ "pnacl_hw_eh_disabled/pnacl_hw_eh_disabled.html" ]
}
# Legacy NaCl PPAPI interface tests being here.
nacl_test_data("ppapi_ppb_core") {
sources = [ "ppapi/ppb_core/ppapi_ppb_core.cc" ]
deps = [ ":ppapi_test_lib" ]
destination_dir = "nacl_test_data"
test_files = [ "ppapi/ppb_core/ppapi_ppb_core.html" ]
}
nacl_test_data("ppapi_ppb_instance") {
sources = [ "ppapi/ppb_instance/ppapi_ppb_instance.cc" ]
deps = [ ":ppapi_test_lib" ]
destination_dir = "nacl_test_data"
test_files = [ "ppapi/ppb_instance/ppapi_ppb_instance.html" ]
}
nacl_test_data("ppapi_ppp_instance") {
sources = [ "ppapi/ppp_instance/ppapi_ppp_instance.cc" ]
deps = [ ":ppapi_test_lib" ]
destination_dir = "nacl_test_data"
test_files = [
"ppapi/ppp_instance/ppapi_ppp_instance.html",
"ppapi/ppp_instance/ppapi_ppp_instance.js",
]
}
if (target_cpu != "arm") {
# Source file does not have asm for ARM.
nacl_test_data("partly_invalid") {
sources = [ "//native_client/tests/stubout_mode/partly_invalid.c" ]
destination_dir = "nacl_test_data"
}
}
}