| # Copyright 2014 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. |
| |
| copy("copy_test_files") { |
| visibility = [ ":*" ] |
| sources = [ |
| # Keep "test_case.html.mock-http-headers" with "test_case.html". |
| "tests/ppapi_nacl_tests_newlib.nmf", |
| "tests/test_case.html", |
| "tests/test_case.html.mock-http-headers", |
| "tests/test_page.css", |
| "tests/test_page.css.mock-http-headers", |
| ] |
| outputs = [ |
| "$root_out_dir/{{source_file_part}}", |
| ] |
| } |
| |
| copy("copy_test_files2") { |
| visibility = [ ":*" ] |
| sources = [ |
| "tests/test_url_loader_data/hello.txt", |
| ] |
| outputs = [ |
| "$root_out_dir/test_url_loader_data/{{source_file_part}}", |
| ] |
| } |
| |
| import("//build/config/features.gni") |
| import("//build/config/nacl/config.gni") |
| import("//ppapi/ppapi_sources.gni") |
| import("//testing/test.gni") |
| |
| shared_library("ppapi_tests") { |
| sources = ppapi_sources.test_common_source_files + |
| ppapi_sources.test_trusted_source_files |
| |
| configs += [ |
| "//build/config:precompiled_headers", |
| "//v8:external_startup_data", |
| ] |
| |
| defines = [ "GL_GLEXT_PROTOTYPES" ] |
| include_dirs = [ "lib/gl/include" ] |
| |
| deps = [ |
| ":copy_test_files", |
| ":copy_test_files2", |
| "//build/config/sanitizers:deps", |
| "//ppapi/cpp", |
| "//ppapi/shared_impl", |
| ] |
| } |
| |
| shared_library("power_saver_test_plugin") { |
| sources = [ |
| "tests/power_saver_test_plugin.cc", |
| "tests/test_utils.cc", |
| ] |
| |
| deps = [ |
| "//build/config/sanitizers:deps", |
| "//ppapi/cpp", |
| "//ppapi/shared_impl", |
| ] |
| } |
| |
| test("ppapi_unittests") { |
| sources = [ |
| "host/resource_message_filter_unittest.cc", |
| "proxy/device_enumeration_resource_helper_unittest.cc", |
| "proxy/file_chooser_resource_unittest.cc", |
| "proxy/file_system_resource_unittest.cc", |
| "proxy/flash_resource_unittest.cc", |
| "proxy/interface_list_unittest.cc", |
| "proxy/mock_resource.cc", |
| "proxy/mock_resource.h", |
| "proxy/nacl_message_scanner_unittest.cc", |
| "proxy/pdf_resource_unittest.cc", |
| "proxy/plugin_dispatcher_unittest.cc", |
| "proxy/plugin_resource_tracker_unittest.cc", |
| "proxy/plugin_var_tracker_unittest.cc", |
| "proxy/ppb_var_unittest.cc", |
| "proxy/ppp_instance_private_proxy_unittest.cc", |
| "proxy/ppp_instance_proxy_unittest.cc", |
| "proxy/ppp_messaging_proxy_unittest.cc", |
| "proxy/printing_resource_unittest.cc", |
| "proxy/raw_var_data_unittest.cc", |
| "proxy/serialized_var_unittest.cc", |
| "proxy/tracked_callback_unittest.cc", |
| "proxy/video_decoder_resource_unittest.cc", |
| "proxy/video_encoder_resource_unittest.cc", |
| "proxy/websocket_resource_unittest.cc", |
| "shared_impl/media_stream_audio_track_shared_unittest.cc", |
| "shared_impl/media_stream_buffer_manager_unittest.cc", |
| "shared_impl/media_stream_video_track_shared_unittest.cc", |
| "shared_impl/proxy_lock_unittest.cc", |
| "shared_impl/resource_tracker_unittest.cc", |
| "shared_impl/thread_aware_callback_unittest.cc", |
| "shared_impl/time_conversion_unittest.cc", |
| "shared_impl/var_tracker_unittest.cc", |
| ] |
| |
| deps = [ |
| "//base/allocator", |
| "//base/test:run_all_unittests", |
| "//base/test:test_support", |
| "//gpu/ipc", |
| "//ipc", |
| "//ipc:test_support", |
| "//media:shared_memory_support", |
| "//ppapi/host", |
| "//ppapi/proxy", |
| "//ppapi/proxy:test_support", |
| "//ppapi/shared_impl", |
| "//ppapi/shared_impl:test_support", |
| "//testing/gmock", |
| "//testing/gtest", |
| "//ui/surface", |
| ] |
| } |
| |
| test("ppapi_perftests") { |
| sources = [ |
| "proxy/ppapi_perftests.cc", |
| "proxy/ppp_messaging_proxy_perftest.cc", |
| ] |
| |
| deps = [ |
| "//base/allocator", |
| "//base/test:test_support", |
| "//ppapi/proxy", |
| "//ppapi/proxy:test_support", |
| "//ppapi/shared_impl", |
| "//ppapi/shared_impl:test_support", |
| "//testing/gtest", |
| ] |
| } |
| |
| executable("pepper_hash_for_uma") { |
| sources = [ |
| "tools/pepper_hash_for_uma.cc", |
| ] |
| |
| deps = [ |
| "//base", |
| "//build/config/sanitizers:deps", |
| ] |
| } |
| |
| source_set("ppapi_cpp_lib") { |
| sources = ppapi_sources.cpp_source_files |
| sources += [ |
| "cpp/module_embedder.h", |
| "cpp/ppp_entrypoints.cc", |
| ] |
| deps = [ |
| "//build/config/nacl:nacl_base", |
| ] |
| } |
| |
| source_set("ppapi_gles2_lib") { |
| include_dirs = [ "lib/gl/include" ] |
| sources = [ |
| "lib/gl/gles2/gl2ext_ppapi.c", |
| "lib/gl/gles2/gl2ext_ppapi.h", |
| "lib/gl/gles2/gles2.c", |
| ] |
| deps = [ |
| "//ppapi/cpp", |
| ] |
| } |
| |
| if (enable_nacl) { |
| if (is_nacl) { |
| shared_library("ppapi_cpp_lib_shared") { |
| # When using gcc, we hide all symbols by default, but that breaks at |
| # link time as the test executable requires symbols defined in the |
| # shared library. |
| if (is_nacl_glibc) { |
| configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] |
| } |
| |
| sources = ppapi_sources.cpp_source_files |
| sources += [ |
| "cpp/module_embedder.h", |
| "cpp/ppp_entrypoints.cc", |
| ] |
| cflags = [ "-fPIC" ] |
| deps = [ |
| "//build/config/nacl:nacl_base", |
| ] |
| } |
| |
| executable("ppapi_nacl_tests") { |
| include_dirs = [ "lib/gl/include" ] |
| sources = ppapi_sources.test_common_source_files + |
| ppapi_sources.test_nacl_source_files |
| defines = [ |
| "GL_GLEXT_PROTOTYPES", |
| "PPAPI_TEST_IMPLEMENTATION", |
| ] |
| ldflags = [ "-pthread" ] |
| deps = [ |
| "//build/config/nacl:nacl_base", |
| "//ppapi/native_client:ppapi_lib", |
| ] |
| if (is_nacl_glibc) { |
| deps += [ ":ppapi_cpp_lib_shared" ] |
| } else { |
| deps += [ ":ppapi_cpp_lib" ] |
| } |
| } |
| |
| if (current_cpu == "pnacl") { |
| action("translate_pexe_to_nexe") { |
| # We specify the toolchain explicitly because in the Non-SFI case, we |
| # still want to use the pexe built using the newlib_pnacl toolchain. |
| tests = ":ppapi_nacl_tests(//build/toolchain/nacl:newlib_pnacl)" |
| |
| pexe = get_label_info(tests, "root_out_dir") + "/ppapi_nacl_tests.pexe" |
| nexe = "${root_out_dir}/ppapi_nacl_tests.nexe" |
| |
| script = "${nacl_toolchain_bindir}/pydir/loader.py" |
| sources = [ |
| pexe, |
| ] |
| outputs = [ |
| nexe, |
| ] |
| |
| if (is_nacl_nonsfi) { |
| if (target_cpu == "x86" || target_cpu == "x64") { |
| arch = "x86-32-nonsfi" |
| } else if (target_cpu == "arm") { |
| arch = "arm-nonsfi" |
| } |
| } else { |
| # TODO(phosek): remove the following once change 1360243003 is rolled |
| # into Chrome and use $target_cpu directly. |
| if (target_cpu == "x86") { |
| arch = "i686" |
| } else if (target_cpu == "x64") { |
| arch = "x86-64" |
| } else if (target_cpu == "arm") { |
| arch = "armv7" |
| } |
| } |
| |
| # The pre-translated object file has to be linked with an IRT shim to |
| # get a runnable nexe. This is handled by pnacl-translate, which passes |
| # -l:libpnacl_irt_shim.a to native linker, and we need to ensure the |
| # linker can find the correct library. |
| if (is_nacl_nonsfi) { |
| pnacl_irt_shim = "//ppapi/native_client/src/untrusted/pnacl_irt_shim:aot(//build/toolchain/nacl:newlib_pnacl_nonsfi)" |
| } else { |
| pnacl_irt_shim = "//ppapi/native_client/src/untrusted/pnacl_irt_shim:aot(//build/toolchain/nacl:clang_newlib_${target_cpu})" |
| } |
| |
| args = [ |
| "pnacl-translate", |
| rebase_path(pexe, root_build_dir), |
| "-o", |
| rebase_path(nexe, root_build_dir), |
| "-arch", |
| arch, |
| "-Wl,-L" + |
| rebase_path(get_label_info(pnacl_irt_shim, "target_out_dir")), |
| ] |
| deps = [ |
| tests, |
| ] |
| data_deps = [ |
| pnacl_irt_shim, |
| ] |
| } |
| } |
| |
| copy("nacl_tests_copy") { |
| sources = [ |
| "${root_out_dir}/ppapi_nacl_tests.nexe", |
| ] |
| |
| # The CPU names used in tests/ppapi_nacl_tests_newlib.nmf |
| # are the ones used in GYP (x32 for x86). |
| if (current_cpu == "pnacl") { |
| suffix = "pnacl" |
| } else { |
| if (target_cpu == "x86") { |
| nmf_cpu = "x32" |
| } else { |
| nmf_cpu = target_cpu |
| } |
| if (is_nacl_glibc) { |
| suffix = "glibc_${nmf_cpu}" |
| } else { |
| suffix = "newlib_${nmf_cpu}" |
| } |
| } |
| outputs = [ |
| "${root_build_dir}/{{source_name_part}}_${suffix}.nexe", |
| ] |
| if (current_cpu == "pnacl") { |
| deps = [ |
| ":translate_pexe_to_nexe", |
| ] |
| } else { |
| deps = [ |
| ":ppapi_nacl_tests", |
| ] |
| } |
| } |
| |
| action("generate_nmf") { |
| if (is_nacl_glibc) { |
| nmf = "${root_build_dir}/ppapi_nacl_tests_glibc.nmf" |
| } else if (current_cpu == "pnacl") { |
| nmf = "${root_build_dir}/ppapi_nacl_tests_pnacl.nmf" |
| } else { |
| nmf = "${root_build_dir}/ppapi_nacl_tests_newlib.nmf" |
| } |
| nexe = "${root_out_dir}/ppapi_nacl_tests.nexe" |
| |
| objdump = rebase_path("${nacl_toolprefix}objdump") |
| |
| script = "//native_client_sdk/src/tools/create_nmf.py" |
| sources = [ |
| nexe, |
| ] |
| outputs = [ |
| nmf, |
| ] |
| data = [ |
| nexe, |
| ] |
| nmf_flags = [] |
| if (is_nacl_glibc) { |
| nmf_flags += [ "--library-path=" + rebase_path(root_out_dir) ] |
| if (current_cpu == "x86") { |
| nmf_flags += [ "--library-path=" + |
| rebase_path("${nacl_toolchain_tooldir}/lib32") ] |
| data += [ "$root_build_dir/lib32/" ] |
| } |
| if (target_cpu == "x64" || (target_cpu == "x86" && is_win)) { |
| nmf_flags += [ "--library-path=" + |
| rebase_path("${nacl_toolchain_tooldir}/lib") ] |
| data += [ "$root_build_dir/lib64/" ] |
| } |
| if (current_cpu == "arm") { |
| nmf_flags += [ "--library-path=" + |
| rebase_path("${nacl_toolchain_tooldir}/lib") ] |
| data += [ "$root_build_dir/lib/" ] |
| } |
| } |
| args = [ |
| "--no-default-libpath", |
| "--objdump=" + objdump, |
| "--output=" + rebase_path(nmf, root_build_dir), |
| "--stage-dependencies=" + rebase_path(root_build_dir), |
| ] + nmf_flags + rebase_path(sources, root_build_dir) |
| if (current_cpu == "pnacl") { |
| deps = [ |
| ":translate_pexe_to_nexe", |
| ] |
| } else { |
| deps = [ |
| ":ppapi_nacl_tests", |
| ] |
| if (is_nacl_glibc && current_cpu == "arm") { |
| deps += [ "//native_client/src/untrusted/elf_loader:elf_loader" ] |
| } |
| } |
| } |
| |
| action("generate_nonsfi_nmf") { |
| nmf = "${root_build_dir}/ppapi_nacl_tests_pnacl_nonsfi.nmf" |
| nexe = "${root_out_dir}/ppapi_nacl_tests.nexe" |
| |
| script = "//ppapi/tests/create_nonsfi_test_nmf.py" |
| sources = [ |
| nexe, |
| ] |
| outputs = [ |
| nmf, |
| ] |
| data = [ |
| nexe, |
| ] |
| if (target_cpu == "x86") { |
| arch = "x86-32" |
| } else if (target_cpu == "x64") { |
| arch = "x86-64" |
| } else if (target_cpu == "arm") { |
| arch = "arm" |
| } |
| args = [ |
| "--program=" + rebase_path(sources[0], root_build_dir), |
| "--arch=${arch}", |
| "--output=" + rebase_path(nmf, root_build_dir), |
| ] |
| deps = [ |
| ":translate_pexe_to_nexe", |
| ] |
| } |
| } |
| |
| group("ppapi_nacl_tests_all") { |
| data_deps = [ |
| ":copy_test_files", |
| ":nacl_tests_copy(//build/toolchain/nacl:clang_newlib_${target_cpu})", |
| ":generate_nmf(//build/toolchain/nacl:glibc_${target_cpu})", |
| ":generate_nmf(//build/toolchain/nacl:newlib_pnacl)", |
| ":generate_nonsfi_nmf(//build/toolchain/nacl:newlib_pnacl_nonsfi)", |
| ] |
| } |
| } |