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

Unified Diff: sandbox/linux/services/resource_limits_unittests.cc

Issue 919203002: Linux Sandbox: add resource limits to NaCl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable on sanitizers. Created 5 years, 10 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/services/resource_limits_unittests.cc
diff --git a/sandbox/linux/services/resource_limits_unittests.cc b/sandbox/linux/services/resource_limits_unittests.cc
new file mode 100644
index 0000000000000000000000000000000000000000..35afdb9032f936bf6293c5c6f895d7a3804559c9
--- /dev/null
+++ b/sandbox/linux/services/resource_limits_unittests.cc
@@ -0,0 +1,36 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sandbox/linux/services/resource_limits.h"
+
+#include <errno.h>
+#include <sys/resource.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+#include "base/logging.h"
+#include "sandbox/linux/tests/test_utils.h"
+#include "sandbox/linux/tests/unit_tests.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace sandbox {
+
+namespace {
+
+// Not being able to fork breaks LSAN, so disable on
Mark Seaborn 2015/02/13 17:11:54 LSAN -> LeakSanitizer perhaps. (Mentioning LSAN a
jln (very slow on Chromium) 2015/02/13 18:00:06 Done.
+// all ASAN builds.
+SANDBOX_TEST(ResourceLimits, DISABLE_ON_ASAN(NoFork)) {
+ // Make sure that fork will fail with EAGAIN.
+ SANDBOX_ASSERT(ResourceLimits::Lower(RLIMIT_NPROC, 0));
+ errno = 0;
+ pid_t pid = fork();
+ // Reap any child if fork succeeded.
+ TestUtils::HandlePostForkReturn(pid);
+ SANDBOX_ASSERT_EQ(-1, pid);
+ CHECK_EQ(EAGAIN, errno);
+}
+
+} // namespace
+
+} // namespace sandbox
« sandbox/linux/services/resource_limits.cc ('K') | « sandbox/linux/services/resource_limits.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698