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

Unified Diff: sandbox/linux/tests/main.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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
« no previous file with comments | « sandbox/linux/system_headers/x86_64_linux_syscalls.h ('k') | services/gles2/gpu_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/tests/main.cc
diff --git a/sandbox/linux/tests/main.cc b/sandbox/linux/tests/main.cc
index 17b4fe7e501ca0aed5869278046a2e5a9d1f86d8..687c8bb087019f9020cd93297f0a8bebf143671d 100644
--- a/sandbox/linux/tests/main.cc
+++ b/sandbox/linux/tests/main.cc
@@ -5,8 +5,11 @@
#include "base/at_exit.h"
#include "base/base_switches.h"
#include "base/command_line.h"
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/test/test_suite.h"
+#include "build/build_config.h"
#include "sandbox/linux/tests/test_utils.h"
#include "sandbox/linux/tests/unit_tests.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -16,10 +19,17 @@ namespace sandbox {
namespace {
// Check for leaks in our tests.
-void RunPostTestsChecks() {
+void RunPostTestsChecks(const base::FilePath& orig_cwd) {
if (TestUtils::CurrentProcessHasChildren()) {
- LOG(ERROR) << "One of the tests created a child that was not waited for. "
- << "Please, clean-up after your tests!";
+ LOG(FATAL) << "One of the tests created a child that was not waited for. "
+ << "Please, clean up after your tests!";
+ }
+
+ base::FilePath cwd;
+ CHECK(GetCurrentDirectory(&cwd));
+ if (orig_cwd != cwd) {
+ LOG(FATAL) << "One of the tests changed the current working directory. "
+ << "Please, clean up after your tests!";
}
}
@@ -42,6 +52,9 @@ int main(int argc, char* argv[]) {
return multi_process_function_list::InvokeChildProcessTest(client_func);
}
+ base::FilePath orig_cwd;
+ CHECK(GetCurrentDirectory(&orig_cwd));
+
#if defined(OS_ANDROID)
// The use of Callbacks requires an AtExitManager.
base::AtExitManager exit_manager;
@@ -62,6 +75,6 @@ int main(int argc, char* argv[]) {
int tests_result = base::RunUnitTestsUsingBaseTestSuite(argc, argv);
#endif
- sandbox::RunPostTestsChecks();
+ sandbox::RunPostTestsChecks(orig_cwd);
return tests_result;
}
« no previous file with comments | « sandbox/linux/system_headers/x86_64_linux_syscalls.h ('k') | services/gles2/gpu_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698