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

Unified Diff: sandbox/linux/seccomp-bpf/syscall_iterator_unittest.cc

Issue 260793003: [MIPS] Add seccomp bpf support (Closed) Base URL: https://git.chromium.org/git/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 8 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
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..bd03b423892ed850245fe89b8da965a3eb25c2b4 100644
--- a/sandbox/linux/seccomp-bpf/syscall_iterator_unittest.cc
+++ b/sandbox/linux/seccomp-bpf/syscall_iterator_unittest.cc
@@ -17,8 +17,13 @@ SANDBOX_TEST(SyscallIterator, Monotonous) {
uint32_t next = iter.Next();
if (!invalid_only) {
+#if defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32)
+ // The iterator should start at 4000 for MIPS O32 ABI
+ SANDBOX_ASSERT(next == 4000);
jln (very slow on Chromium) 2014/05/02 20:42:04 This adds no value, we need to re-work these tests
nedeljko 2014/05/07 15:40:05 Done.
+#else
// The iterator should start at 0.
SANDBOX_ASSERT(next == 0);
jln (very slow on Chromium) 2014/05/02 20:42:04 This should still hold on MIPS.
nedeljko 2014/05/07 15:40:05 Done.
+#endif
}
for (uint32_t last = next; !iter.Done(); last = next) {
next = iter.Next();
@@ -35,9 +40,14 @@ SANDBOX_TEST(SyscallIterator, PublicSyscallRange) {
// The iterator should cover the public syscall range
// MIN_SYSCALL..MAX_PUBLIC_SYSCALL, without skipping syscalls.
- // We're assuming MIN_SYSCALL == 0 for all architectures,
- // this is currently valid for Intel and ARM EABI.
+ // We're assuming MIN_SYSCALL == 0 for all architectures
+ // (this is currently valid for Intel and ARM EABI), except for
+ // Mips O32 ABI for which MIN_SYSCALL == 4000 .
+#if defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32)
+ SANDBOX_ASSERT(MIN_SYSCALL == 4000);
+#else
SANDBOX_ASSERT(MIN_SYSCALL == 0);
+#endif
SANDBOX_ASSERT(next == MIN_SYSCALL);
for (uint32_t last = next; next < MAX_PUBLIC_SYSCALL + 1; last = next) {
SANDBOX_ASSERT((next = iter.Next()) == last + 1);
@@ -107,10 +117,15 @@ SANDBOX_TEST(SyscallIterator, InvalidOnly) {
bool invalid_only = true;
SyscallIterator iter(invalid_only);
uint32_t next = iter.Next();
- // We're assuming MIN_SYSCALL == 0 for all architectures,
- // this is currently valid for Intel and ARM EABI.
+ // We're assuming MIN_SYSCALL == 0 for all architectures
+ // (this is currently valid for Intel and ARM EABI), except
+ // for Mips O32 ABI for which MIN_SYSCALL == 4000.
// First invalid syscall should then be |MAX_PUBLIC_SYSCALL + 1|.
+#if defined(__mips__) && (_MIPS_SIM == _MIPS_SIM_ABI32)
+ SANDBOX_ASSERT(MIN_SYSCALL == 4000);
+#else
SANDBOX_ASSERT(MIN_SYSCALL == 0);
+#endif
SANDBOX_ASSERT(next == MAX_PUBLIC_SYSCALL + 1);
#if defined(__arm__)

Powered by Google App Engine
This is Rietveld 408576698