summaryrefslogtreecommitdiffstats
path: root/sandbox
diff options
context:
space:
mode:
authorjln@chromium.org <jln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-03 20:33:01 +0000
committerjln@chromium.org <jln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-03 20:33:01 +0000
commitd968e999f336ec6328dc8adefb0dd5f1d22bce2a (patch)
tree67f58cd839d2ea19276ebf7fbe69160e288bb8f2 /sandbox
parent32630ce2ed33734df6da4774488290fe0335386b (diff)
downloadchromium_src-d968e999f336ec6328dc8adefb0dd5f1d22bce2a.zip
chromium_src-d968e999f336ec6328dc8adefb0dd5f1d22bce2a.tar.gz
chromium_src-d968e999f336ec6328dc8adefb0dd5f1d22bce2a.tar.bz2
Linux Sandbox: add test for one argument system calls.
Make it easier to reproduce simple bugs and issues by adding a trivial test for system calls with one argument. BUG=163904 NOTRY=true Review URL: https://chromiumcodereview.appspot.com/11434088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170804 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/linux/seccomp-bpf/syscall_unittest.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/sandbox/linux/seccomp-bpf/syscall_unittest.cc b/sandbox/linux/seccomp-bpf/syscall_unittest.cc
index 374a0fb..b00177d 100644
--- a/sandbox/linux/seccomp-bpf/syscall_unittest.cc
+++ b/sandbox/linux/seccomp-bpf/syscall_unittest.cc
@@ -54,6 +54,14 @@ TEST(Syscall, TrivialSyscallNoArgs) {
EXPECT_EQ(SandboxSyscall(__NR_getpid), syscall(__NR_getpid));
}
+TEST(Syscall, TrivialSyscallOneArg) {
+ int new_fd;
+ // Duplicate standard error and close it.
+ ASSERT_GE(new_fd = SandboxSyscall(__NR_dup, 2), 0);
+ int close_return_value = HANDLE_EINTR(SandboxSyscall(__NR_close, new_fd));
+ ASSERT_EQ(close_return_value, 0);
+}
+
TEST(Syscall, ComplexSyscallSixArgs) {
int fd;
ASSERT_LE(0, fd = SandboxSyscall(__NR_open, "/dev/null", O_RDWR, 0L));