diff options
author | phosek <phosek@chromium.org> | 2015-12-17 08:35:42 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-17 16:36:29 +0000 |
commit | ca8571a9777c5207d61dc28c323779e767b99bad (patch) | |
tree | e8363cb8c850dfbfcdde4048a20a473f59fe9a5e /components/nacl/loader | |
parent | 270402789b8e60ccbeb19229e681ae9bb02aebf5 (diff) | |
download | chromium_src-ca8571a9777c5207d61dc28c323779e767b99bad.zip chromium_src-ca8571a9777c5207d61dc28c323779e767b99bad.tar.gz chromium_src-ca8571a9777c5207d61dc28c323779e767b99bad.tar.bz2 |
GN: Build nacl_helper_nonsfi unit tests
The DoSocketpair function in nonsfi_sandbox_unittest.cc is unused
which causes a build error due to -Wunused-function which is set by
default in GN hence removing the function.
BUG=564877
Review URL: https://codereview.chromium.org/1497543006
Cr-Commit-Position: refs/heads/master@{#365836}
Diffstat (limited to 'components/nacl/loader')
-rw-r--r-- | components/nacl/loader/BUILD.gn | 84 | ||||
-rw-r--r-- | components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc | 7 |
2 files changed, 79 insertions, 12 deletions
diff --git a/components/nacl/loader/BUILD.gn b/components/nacl/loader/BUILD.gn index 3698fd7..db7a71d 100644 --- a/components/nacl/loader/BUILD.gn +++ b/components/nacl/loader/BUILD.gn @@ -75,6 +75,20 @@ test("nacl_loader_unittests") { "//ppapi/c", "//testing/gtest", ] + + if (is_nacl_nonsfi) { + sources += [ + # TODO(hamaji): Currently, we build them twice. Stop building + # them for components_unittests. See crbug.com/364751 + "nonsfi/nonsfi_sandbox_sigsys_unittest.cc", + "nonsfi/nonsfi_sandbox_unittest.cc", + ] + + deps += [ + ":nacl_linux", + "//sandbox/linux:sandbox_linux_test_utils", + ] + } } if (is_linux) { @@ -114,6 +128,39 @@ if (is_linux) { ":nacl_helper", ] } + + test("nacl_helper_nonsfi_unittests") { + sources = [ + "nonsfi/nacl_helper_nonsfi_unittests.cc", + ] + deps = [ + "//base", + "//base/test:test_launcher_nacl_nonsfi", + ] + } + + group("helper_nonsfi") { + deps = [ + ":nacl_helper_nonsfi_copy(//build/toolchain/nacl:newlib_pnacl_nonsfi)", + ] + } + + group("helper_nonsfi_unittests") { + testonly = true + data_deps = [ + ":nacl_helper_nonsfi_unittests", + ":nacl_helper_nonsfi_unittests_main_copy(//build/toolchain/nacl:newlib_pnacl_nonsfi)", + ] + } + + # TODO(GYP): Delete this after we've converted everything to GN. + # The _run targets exist only for compatibility w/ GYP. + group("nacl_helper_nonsfi_unittests_run") { + testonly = true + data_deps = [ + ":helper_nonsfi_unittests", + ] + } } if (is_nacl_nonsfi) { @@ -186,10 +233,37 @@ if (is_nacl_nonsfi) { ":nacl_helper_nonsfi_nexe", ] } -} -group("helper_nonsfi") { - deps = [ - ":nacl_helper_nonsfi_copy(//build/toolchain/nacl:newlib_pnacl_nonsfi)", - ] + test("nacl_helper_nonsfi_unittests_main") { + sources = [ + "nonsfi/nonsfi_sandbox_sigsys_unittest.cc", + "nonsfi/nonsfi_sandbox_unittest.cc", + "nonsfi/run_all_unittests.cc", + ] + deps = [ + ":nacl_helper_nonsfi_sandbox", + "//base", + "//base/test:test_support", + "//content", + "//native_client/src/nonsfi/irt:nacl_sys_private", + "//native_client/src/untrusted/nacl:nacl", + "//sandbox/linux:sandbox", + "//sandbox/linux:sandbox_linux_test_utils", + "//sandbox/linux:sandbox_services_headers", + "//testing/gtest", + ] + } + + copy("nacl_helper_nonsfi_unittests_main_copy") { + testonly = true + sources = [ + "${root_out_dir}/nacl_helper_nonsfi_unittests_main", + ] + outputs = [ + "${root_build_dir}/{{source_file_part}}", + ] + deps = [ + ":nacl_helper_nonsfi_unittests_main", + ] + } } diff --git a/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc b/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc index 85b94a8..8500a69 100644 --- a/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc +++ b/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc @@ -113,13 +113,6 @@ void DoPipe(base::ScopedFD* fds) { fds[1].reset(tmp_fds[1]); } -void DoSocketpair(base::ScopedFD* fds) { - int tmp_fds[2]; - BPF_ASSERT_EQ(0, socketpair(AF_UNIX, SOCK_STREAM, 0, tmp_fds)); - fds[0].reset(tmp_fds[0]); - fds[1].reset(tmp_fds[1]); -} - TEST(NaClNonSfiSandboxTest, BPFIsSupported) { bool seccomp_bpf_supported = sandbox::SandboxBPF::SupportsSeccompSandbox( sandbox::SandboxBPF::SeccompLevel::SINGLE_THREADED); |