summaryrefslogtreecommitdiffstats
path: root/sandbox/linux
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 13:10:43 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 13:10:43 +0000
commita0ea90e8dffa2d3cf0c8c66d246b2bf7421e56a1 (patch)
tree4d3c3b7d88c1bd8bf5a887d5a677c394fb9a610c /sandbox/linux
parentc61885f7c47d823da89e905093e591d64c997f93 (diff)
downloadchromium_src-a0ea90e8dffa2d3cf0c8c66d246b2bf7421e56a1.zip
chromium_src-a0ea90e8dffa2d3cf0c8c66d246b2bf7421e56a1.tar.gz
chromium_src-a0ea90e8dffa2d3cf0c8c66d246b2bf7421e56a1.tar.bz2
Enable the new test launcher for sandbox_linux_unittests
BUG=355084, 236893 R=jln@chromium.org Review URL: https://codereview.chromium.org/221873004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263213 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/linux')
-rw-r--r--sandbox/linux/sandbox_linux_test_sources.gypi1
-rw-r--r--sandbox/linux/services/scoped_process_unittest.cc1
-rw-r--r--sandbox/linux/tests/main.cc7
-rw-r--r--sandbox/linux/tests/unit_tests_unittest.cc19
4 files changed, 10 insertions, 18 deletions
diff --git a/sandbox/linux/sandbox_linux_test_sources.gypi b/sandbox/linux/sandbox_linux_test_sources.gypi
index e81c2a8..01db0e9 100644
--- a/sandbox/linux/sandbox_linux_test_sources.gypi
+++ b/sandbox/linux/sandbox_linux_test_sources.gypi
@@ -8,6 +8,7 @@
'dependencies': [
'sandbox',
'../base/base.gyp:base',
+ '../base/base.gyp:test_support_base',
'../testing/gtest.gyp:gtest',
],
'include_dirs': [
diff --git a/sandbox/linux/services/scoped_process_unittest.cc b/sandbox/linux/services/scoped_process_unittest.cc
index 2800bd7..382c7fb 100644
--- a/sandbox/linux/services/scoped_process_unittest.cc
+++ b/sandbox/linux/services/scoped_process_unittest.cc
@@ -55,6 +55,7 @@ TEST(ScopedProcess, ScopedProcessNormalExit) {
// Disable this test on Android, SIGABRT is funky there.
TEST(ScopedProcess, DISABLE_ON_ANDROID(ScopedProcessAbort)) {
+ PCHECK(SIG_ERR != signal(SIGABRT, SIG_DFL));
ScopedProcess process(base::Bind(&RaiseAndExit, SIGABRT));
bool got_signaled = false;
int exit_code = process.WaitForExit(&got_signaled);
diff --git a/sandbox/linux/tests/main.cc b/sandbox/linux/tests/main.cc
index b07718e..9ee384d 100644
--- a/sandbox/linux/tests/main.cc
+++ b/sandbox/linux/tests/main.cc
@@ -4,6 +4,7 @@
#include "base/at_exit.h"
#include "base/logging.h"
+#include "base/test/test_suite.h"
#include "sandbox/linux/tests/test_utils.h"
#include "sandbox/linux/tests/unit_tests.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -23,15 +24,21 @@ void RunPostTestsChecks() {
} // namespace sandbox
int main(int argc, char* argv[]) {
+#if defined(OS_ANDROID)
// The use of Callbacks requires an AtExitManager.
base::AtExitManager exit_manager;
testing::InitGoogleTest(&argc, argv);
+#endif
// Always go through re-execution for death tests.
// This makes gtest only marginally slower for us and has the
// additional side effect of getting rid of gtest warnings about fork()
// safety.
::testing::FLAGS_gtest_death_test_style = "threadsafe";
+#if defined(OS_ANDROID)
int tests_result = RUN_ALL_TESTS();
+#else
+ int tests_result = base::RunUnitTestsUsingBaseTestSuite(argc, argv);
+#endif
sandbox::RunPostTestsChecks();
return tests_result;
diff --git a/sandbox/linux/tests/unit_tests_unittest.cc b/sandbox/linux/tests/unit_tests_unittest.cc
index 78a3645..8d8b28e 100644
--- a/sandbox/linux/tests/unit_tests_unittest.cc
+++ b/sandbox/linux/tests/unit_tests_unittest.cc
@@ -23,7 +23,7 @@ const int kExpectedExitCode = 100;
SANDBOX_DEATH_TEST(UnitTests,
DeathExitCode,
DEATH_EXIT_CODE(kExpectedExitCode)) {
- exit(kExpectedExitCode);
+ _exit(kExpectedExitCode);
}
const int kExpectedSignalNumber = SIGKILL;
@@ -38,23 +38,6 @@ SANDBOX_TEST_ALLOW_NOISE(UnitTests, NoisyTest) {
LOG(ERROR) << "The cow says moo!";
}
-// Test that a subprocess can be forked() and can use exit(3) instead of
-// _exit(2).
-TEST(UnitTests, SubProcessCanExit) {
- pid_t child = fork();
- ASSERT_NE(-1, child);
-
- if (!child) {
- exit(kExpectedExitCode);
- }
-
- int status = 0;
- pid_t waitpid_ret = HANDLE_EINTR(waitpid(child, &status, 0));
- EXPECT_EQ(child, waitpid_ret);
- EXPECT_TRUE(WIFEXITED(status));
- EXPECT_EQ(kExpectedExitCode, WEXITSTATUS(status));
-}
-
} // namespace
} // namespace sandbox