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

Side by Side Diff: sandbox/linux/seccomp-bpf/kernel_return_value_helpers_unittest.cc

Issue 260793003: [MIPS] Add seccomp bpf support (Closed) Base URL: https://git.chromium.org/git/chromium/src.git@master
Patch Set: Update per code review Created 6 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5
6 #include <errno.h>
7 #include <asm/unistd.h>
8
9 #include "sandbox/linux/seccomp-bpf/bpf_tests.h"
10 #include "sandbox/linux/seccomp-bpf/kernel_return_value_helpers.h"
11 #include "sandbox/linux/seccomp-bpf/syscall.h"
12 #include "sandbox/linux/tests/unit_tests.h"
13
14 namespace sandbox {
15
16 namespace {
17
18 // Check that ErrnoToKernelRet works.
19 TEST(KernelReturnValueHelpers, ErrnoToKernelRet) {
20 int expected_kernel_ret = SandboxSyscall(__NR_dup, -1);
21 #if defined(__mips__)
22 // SandboxSyscall() for MIPS was written so it returns negation of the value
23 // returned by kernel on error. This was done in order for this function to
24 // behave like other architectures on places where return value from
25 // SandboxSyscall() is used directly (like in the most tests), but for this
26 // test to pass we need to cancel this negation.
27 expected_kernel_ret = - expected_kernel_ret;
jln (very slow on Chromium) 2014/05/28 00:06:57 This looks very strange as it doesn't really like
nedeljko 2014/05/28 09:33:43 I could use SandboxSyscallRaw() as you suggested i
nedeljko 2014/05/29 14:06:45 Done.
28 #endif
29 ASSERT_EQ(expected_kernel_ret, ErrnoToKernelRet(EBADF));}
30
31 }
32 } // namespace sandbox
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698