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

Side by Side Diff: sandbox/linux/services/syscall_wrappers_unittest.cc

Issue 1093843002: Revert of Introduce sys_sigprocmask and sys_sigaction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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
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 #include "sandbox/linux/services/syscall_wrappers.h" 5 #include "sandbox/linux/services/syscall_wrappers.h"
6 6
7 #include <sys/syscall.h> 7 #include <sys/syscall.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <sys/wait.h> 9 #include <sys/wait.h>
10 #include <unistd.h> 10 #include <unistd.h>
11 #include <cstring>
12 11
13 #include "base/logging.h" 12 #include "base/logging.h"
14 #include "base/posix/eintr_wrapper.h" 13 #include "base/posix/eintr_wrapper.h"
15 #include "base/third_party/valgrind/valgrind.h" 14 #include "base/third_party/valgrind/valgrind.h"
16 #include "build/build_config.h" 15 #include "build/build_config.h"
17 #include "sandbox/linux/system_headers/linux_signal.h"
18 #include "sandbox/linux/tests/test_utils.h" 16 #include "sandbox/linux/tests/test_utils.h"
19 #include "sandbox/linux/tests/unit_tests.h" 17 #include "sandbox/linux/tests/unit_tests.h"
20 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
21 19
22 namespace sandbox { 20 namespace sandbox {
23 21
24 namespace { 22 namespace {
25 23
26 TEST(SyscallWrappers, BasicSyscalls) { 24 TEST(SyscallWrappers, BasicSyscalls) {
27 EXPECT_EQ(getpid(), sys_getpid()); 25 EXPECT_EQ(getpid(), sys_getpid());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 TEST(SyscallWrappers, GetRESGid) { 73 TEST(SyscallWrappers, GetRESGid) {
76 gid_t rgid, egid, sgid; 74 gid_t rgid, egid, sgid;
77 gid_t sys_rgid, sys_egid, sys_sgid; 75 gid_t sys_rgid, sys_egid, sys_sgid;
78 ASSERT_EQ(0, getresgid(&rgid, &egid, &sgid)); 76 ASSERT_EQ(0, getresgid(&rgid, &egid, &sgid));
79 ASSERT_EQ(0, sys_getresgid(&sys_rgid, &sys_egid, &sys_sgid)); 77 ASSERT_EQ(0, sys_getresgid(&sys_rgid, &sys_egid, &sys_sgid));
80 EXPECT_EQ(rgid, sys_rgid); 78 EXPECT_EQ(rgid, sys_rgid);
81 EXPECT_EQ(egid, sys_egid); 79 EXPECT_EQ(egid, sys_egid);
82 EXPECT_EQ(sgid, sys_sgid); 80 EXPECT_EQ(sgid, sys_sgid);
83 } 81 }
84 82
85 TEST(SyscallWrappers, LinuxSigSet) {
86 sigset_t sigset;
87 ASSERT_EQ(0, sigemptyset(&sigset));
88 ASSERT_EQ(0, sigaddset(&sigset, LINUX_SIGSEGV));
89 ASSERT_EQ(0, sigaddset(&sigset, LINUX_SIGBUS));
90 uint64_t linux_sigset = 0;
91 std::memcpy(&linux_sigset, &sigset,
92 std::min(sizeof(sigset), sizeof(linux_sigset)));
93 EXPECT_EQ((1ULL << (LINUX_SIGSEGV - 1)) | (1ULL << (LINUX_SIGBUS - 1)),
94 linux_sigset);
95 }
96
97 } // namespace 83 } // namespace
98 84
99 } // namespace sandbox 85 } // namespace sandbox
OLDNEW
« no previous file with comments | « sandbox/linux/services/syscall_wrappers.cc ('k') | sandbox/linux/system_headers/android_arm64_ucontext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698