OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/seccomp-bpf/sandbox_bpf.h" | 5 #include "sandbox/linux/seccomp-bpf/sandbox_bpf.h" |
6 #include "sandbox/linux/seccomp-bpf/syscall_iterator.h" | 6 #include "sandbox/linux/seccomp-bpf/syscall_iterator.h" |
7 #include "sandbox/linux/tests/unit_tests.h" | 7 #include "sandbox/linux/tests/unit_tests.h" |
8 | 8 |
9 using namespace playground2; | 9 namespace sandbox { |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 SANDBOX_TEST(SyscallIterator, Monotonous) { | 13 SANDBOX_TEST(SyscallIterator, Monotonous) { |
14 for (int i = 0; i < 2; ++i) { | 14 for (int i = 0; i < 2; ++i) { |
15 bool invalid_only = !i; // Testing both |invalid_only| cases. | 15 bool invalid_only = !i; // Testing both |invalid_only| cases. |
16 SyscallIterator iter(invalid_only); | 16 SyscallIterator iter(invalid_only); |
17 uint32_t next = iter.Next(); | 17 uint32_t next = iter.Next(); |
18 | 18 |
19 if (!invalid_only) { | 19 if (!invalid_only) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 next = iter.Next(); | 124 next = iter.Next(); |
125 // The iterator should skip until the last invalid syscall in this range. | 125 // The iterator should skip until the last invalid syscall in this range. |
126 SANDBOX_ASSERT(next == MIN_GHOST_SYSCALL - 1); | 126 SANDBOX_ASSERT(next == MIN_GHOST_SYSCALL - 1); |
127 while (next <= MAX_SYSCALL) { | 127 while (next <= MAX_SYSCALL) { |
128 next = iter.Next(); | 128 next = iter.Next(); |
129 } | 129 } |
130 SANDBOX_ASSERT(next == MAX_SYSCALL + 1); | 130 SANDBOX_ASSERT(next == MAX_SYSCALL + 1); |
131 #endif | 131 #endif |
132 } | 132 } |
133 | 133 |
134 } // namespace | 134 } // namespace. |
Robert Sesek
2013/12/10 15:07:46
nit: no period
jln (very slow on Chromium)
2013/12/10 18:43:47
Done.
| |
135 | |
136 } // namespace sandbox. | |
OLD | NEW |