diff options
author | jln@chromium.org <jln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-03 02:18:25 +0000 |
---|---|---|
committer | jln@chromium.org <jln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-03 02:18:25 +0000 |
commit | a6c38b5825fad232626ef8169404e9b09dc1f56e (patch) | |
tree | 39ef07bba5aefe95387b72b841d249557f8a1c7a /sandbox | |
parent | 9b1e333bf63c964827c99966d6a3dbfe63a20549 (diff) | |
download | chromium_src-a6c38b5825fad232626ef8169404e9b09dc1f56e.zip chromium_src-a6c38b5825fad232626ef8169404e9b09dc1f56e.tar.gz chromium_src-a6c38b5825fad232626ef8169404e9b09dc1f56e.tar.bz2 |
Linux Sandbox: assert monothreaded in tests
When we start a new test that requires fork(), assert that we are not
currently multi-threaded.
BUG=225809
NOTRY=true
Review URL: https://codereview.chromium.org/13430016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191957 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox')
-rw-r--r-- | sandbox/linux/tests/unit_tests.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sandbox/linux/tests/unit_tests.cc b/sandbox/linux/tests/unit_tests.cc index 3d049ab..63fbb2b 100644 --- a/sandbox/linux/tests/unit_tests.cc +++ b/sandbox/linux/tests/unit_tests.cc @@ -83,13 +83,11 @@ static void SetProcessTimeout(int time_in_seconds) { // insecure manner. void UnitTests::RunTestInProcess(UnitTests::Test test, void *arg, DeathCheck death, const void *death_aux) { - if (CountThreads() != 1) { - // We need to use fork(), so we can't be multi-threaded. - // TODO(jln): change this to a fatal error once we can launch - // Android tests with --exe. - fprintf(stderr, "WARNING: running sandbox tests with multiple threads" - " is not supported and will make the tests flaky.\n"); - } + // We need to fork(), so we can't be multi-threaded, as threads could hold + // locks. + ASSERT_EQ(1, CountThreads()) << "Running sandbox tests with multiple threads " + << "is not supported and will make the tests " + << "flaky.\n"; int fds[2]; ASSERT_EQ(0, pipe(fds)); // Check that our pipe is not on one of the standard file descriptor. |