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

Unified Diff: sandbox/linux/bpf_dsl/bpf_dsl_unittest.cc

Issue 559653004: Convert sandbox_bpf_unittest.cc to use bpf_dsl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test for != Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sandbox/linux/bpf_dsl/bpf_dsl_more_unittest.cc ('k') | sandbox/linux/sandbox_linux_test_sources.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/bpf_dsl/bpf_dsl_unittest.cc
diff --git a/sandbox/linux/bpf_dsl/bpf_dsl_unittest.cc b/sandbox/linux/bpf_dsl/bpf_dsl_unittest.cc
index f4760a6593762f436e49ceef4ca8734bf70c6671..6215d6ea6f8171ca2eb31e44f948935a3be5e0a8 100644
--- a/sandbox/linux/bpf_dsl/bpf_dsl_unittest.cc
+++ b/sandbox/linux/bpf_dsl/bpf_dsl_unittest.cc
@@ -67,6 +67,10 @@ class BasicPolicy : public SandboxBPFDSLPolicy {
const Arg<pid_t> pid(0);
return If(pid == 0, Error(EPERM)).Else(Error(EINVAL));
}
+ if (sysno == __NR_setuid) {
+ const Arg<uid_t> uid(0);
+ return If(uid != 42, Error(ESRCH)).Else(Error(ENOMEM));
+ }
return Allow();
}
@@ -77,6 +81,9 @@ class BasicPolicy : public SandboxBPFDSLPolicy {
BPF_TEST_C(BPFDSL, Basic, BasicPolicy) {
ASSERT_SYSCALL_RESULT(-EPERM, getpgid, 0);
ASSERT_SYSCALL_RESULT(-EINVAL, getpgid, 1);
+
+ ASSERT_SYSCALL_RESULT(-ENOMEM, setuid, 42);
+ ASSERT_SYSCALL_RESULT(-ESRCH, setuid, 43);
}
/* On IA-32, socketpair() is implemented via socketcall(). :-( */
« no previous file with comments | « sandbox/linux/bpf_dsl/bpf_dsl_more_unittest.cc ('k') | sandbox/linux/sandbox_linux_test_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698