Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(719)

Side by Side Diff: components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc

Issue 1497543006: GN: Build nacl_helper_nonsfi unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/nacl/loader/BUILD.gn ('k') | sandbox/linux/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Sanitizers internally use some syscalls which non-SFI NaCl disallows. 5 // Sanitizers internally use some syscalls which non-SFI NaCl disallows.
6 #if !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) && \ 6 #if !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) && \
7 !defined(MEMORY_SANITIZER) && !defined(LEAK_SANITIZER) 7 !defined(MEMORY_SANITIZER) && !defined(LEAK_SANITIZER)
8 8
9 #include "components/nacl/loader/nonsfi/nonsfi_sandbox.h" 9 #include "components/nacl/loader/nonsfi/nonsfi_sandbox.h"
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 namespace { 107 namespace {
108 108
109 void DoPipe(base::ScopedFD* fds) { 109 void DoPipe(base::ScopedFD* fds) {
110 int tmp_fds[2]; 110 int tmp_fds[2];
111 BPF_ASSERT_EQ(0, pipe(tmp_fds)); 111 BPF_ASSERT_EQ(0, pipe(tmp_fds));
112 fds[0].reset(tmp_fds[0]); 112 fds[0].reset(tmp_fds[0]);
113 fds[1].reset(tmp_fds[1]); 113 fds[1].reset(tmp_fds[1]);
114 } 114 }
115 115
116 void DoSocketpair(base::ScopedFD* fds) {
117 int tmp_fds[2];
118 BPF_ASSERT_EQ(0, socketpair(AF_UNIX, SOCK_STREAM, 0, tmp_fds));
119 fds[0].reset(tmp_fds[0]);
120 fds[1].reset(tmp_fds[1]);
121 }
122
123 TEST(NaClNonSfiSandboxTest, BPFIsSupported) { 116 TEST(NaClNonSfiSandboxTest, BPFIsSupported) {
124 bool seccomp_bpf_supported = sandbox::SandboxBPF::SupportsSeccompSandbox( 117 bool seccomp_bpf_supported = sandbox::SandboxBPF::SupportsSeccompSandbox(
125 sandbox::SandboxBPF::SeccompLevel::SINGLE_THREADED); 118 sandbox::SandboxBPF::SeccompLevel::SINGLE_THREADED);
126 119
127 if (!seccomp_bpf_supported) { 120 if (!seccomp_bpf_supported) {
128 LOG(ERROR) << "Seccomp BPF is not supported, these tests " 121 LOG(ERROR) << "Seccomp BPF is not supported, these tests "
129 << "will pass without running"; 122 << "will pass without running";
130 } 123 }
131 } 124 }
132 125
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 RESTRICT_SYSCALL_EPERM_TEST(ptrace); 693 RESTRICT_SYSCALL_EPERM_TEST(ptrace);
701 RESTRICT_SYSCALL_EPERM_TEST(set_robust_list); 694 RESTRICT_SYSCALL_EPERM_TEST(set_robust_list);
702 #if defined(__i386__) || defined(__x86_64__) 695 #if defined(__i386__) || defined(__x86_64__)
703 RESTRICT_SYSCALL_EPERM_TEST(time); 696 RESTRICT_SYSCALL_EPERM_TEST(time);
704 #endif 697 #endif
705 698
706 } // namespace 699 } // namespace
707 700
708 #endif // !ADDRESS_SANITIZER && !THREAD_SANITIZER && 701 #endif // !ADDRESS_SANITIZER && !THREAD_SANITIZER &&
709 // !MEMORY_SANITIZER && !LEAK_SANITIZER 702 // !MEMORY_SANITIZER && !LEAK_SANITIZER
OLDNEW
« no previous file with comments | « components/nacl/loader/BUILD.gn ('k') | sandbox/linux/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698