Index: sandbox/linux/seccomp-bpf/syscall_iterator_unittest.cc |
diff --git a/sandbox/linux/seccomp-bpf/syscall_iterator_unittest.cc b/sandbox/linux/seccomp-bpf/syscall_iterator_unittest.cc |
index 08a857a2e2933ad03eb29406874f0e48bb99d5ef..5409a63d9b3978f27f37b0d45d7dd0ff5e5b09a4 100644 |
--- a/sandbox/linux/seccomp-bpf/syscall_iterator_unittest.cc |
+++ b/sandbox/linux/seccomp-bpf/syscall_iterator_unittest.cc |
@@ -29,7 +29,26 @@ SANDBOX_TEST(SyscallIterator, Monotonous) { |
} |
} |
-SANDBOX_TEST(SyscallIterator, PublicSyscallRange) { |
+#if defined(__mips__) |
+SANDBOX_TEST(SyscallIterator, PublicSyscallRangeMIPS) { |
+ SyscallIterator iter(false); |
+ uint32_t next = iter.Next(); |
+ |
+ // The iterator should cover the public syscall range |
+ // MIN_SYSCALL..MAX_PUBLIC_SYSCALL, without skipping syscalls. |
+ // Since MIN_SYSCALL != 0 we need to move iterator to valid range. |
+ while (next < MIN_SYSCALL - 1) { |
jln (very slow on Chromium)
2014/05/28 00:06:57
Don't perform a while loop here. This test should
nedeljko
2014/05/29 14:06:45
Done.
|
+ next = iter.Next(); |
+ } |
+ SANDBOX_ASSERT(next == MIN_SYSCALL -1); |
+ |
+ for (uint32_t last = next; next < MAX_PUBLIC_SYSCALL + 1; last = next) { |
+ SANDBOX_ASSERT((next = iter.Next()) == last + 1); |
+ } |
+ SANDBOX_ASSERT(next == MAX_PUBLIC_SYSCALL + 1); |
+} |
+#else |
+SANDBOX_TEST(SyscallIterator, PublicSyscallRangeIntelArm) { |
SyscallIterator iter(false); |
uint32_t next = iter.Next(); |
@@ -44,6 +63,7 @@ SANDBOX_TEST(SyscallIterator, PublicSyscallRange) { |
} |
SANDBOX_ASSERT(next == MAX_PUBLIC_SYSCALL + 1); |
} |
+#endif |
jln (very slow on Chromium)
2014/05/28 00:06:57
Nit: add "// defined(__mips__)"
nedeljko
2014/05/29 14:06:45
Done.
|
#if defined(__arm__) |
SANDBOX_TEST(SyscallIterator, ARMPrivateSyscallRange) { |
@@ -103,7 +123,30 @@ SANDBOX_TEST(SyscallIterator, Invalid) { |
} |
} |
-SANDBOX_TEST(SyscallIterator, InvalidOnly) { |
+#if defined(__mips__) |
+SANDBOX_TEST(SyscallIterator, InvalidOnlyMIPS) { |
+ bool invalid_only = true; |
+ SyscallIterator iter(invalid_only); |
+ uint32_t next = iter.Next(); |
jln (very slow on Chromium)
2014/05/28 00:06:57
You should ASSERT the value of iter.Next() here.
nedeljko
2014/05/29 14:06:45
Done.
|
+ // For Mips O32 ABI we're assuming MIN_SYSCALL == 4000. |
+ SANDBOX_ASSERT(MIN_SYSCALL == 4000); |
+ |
+ // Since MIN_SYSCALL != 0, we need to move iterator to valid range |
+ next = iter.Next(); |
+ // The iterator should skip until the last invalid syscall in this range. |
+ SANDBOX_ASSERT(next == MIN_SYSCALL - 1); |
+ int count = 0; |
+ while (next <= MAX_PUBLIC_SYSCALL) { |
+ printf("count: %d\n",count++); |
jln (very slow on Chromium)
2014/05/28 00:06:57
Did you forget to remove this printf?
You should
nedeljko
2014/05/28 09:33:43
Yes, sorry...
nedeljko
2014/05/29 14:06:45
Done.
|
+ next = iter.Next(); |
+ } |
+ // First next invalid syscall should then be |MAX_PUBLIC_SYSCALL + 1|. |
+ SANDBOX_ASSERT(next == MAX_PUBLIC_SYSCALL + 1); |
+} |
+ |
+#else |
+ |
+SANDBOX_TEST(SyscallIterator, InvalidOnlyIntelArm) { |
bool invalid_only = true; |
SyscallIterator iter(invalid_only); |
uint32_t next = iter.Next(); |
@@ -130,6 +173,7 @@ SANDBOX_TEST(SyscallIterator, InvalidOnly) { |
SANDBOX_ASSERT(next == MAX_SYSCALL + 1); |
#endif |
jln (very slow on Chromium)
2014/05/28 00:06:57
Nit: add "// defined(__arm__)"
nedeljko
2014/05/29 14:06:45
Done.
|
} |
+#endif |
jln (very slow on Chromium)
2014/05/28 00:06:57
Nit: add "// defined(__mips__)
nedeljko
2014/05/29 14:06:45
Done.
|
} // namespace |