diff options
author | hidehiko <hidehiko@chromium.org> | 2015-06-08 19:50:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-09 02:51:34 +0000 |
commit | 8fc7c823b9dd2b7890c96438f347383aa713c1d6 (patch) | |
tree | ceeaed6a3be8aac576fd337b45c9d12a47d956fd /components/nacl | |
parent | 92478e96a57d4f52032a9be47132e9455d9dd160 (diff) | |
download | chromium_src-8fc7c823b9dd2b7890c96438f347383aa713c1d6.zip chromium_src-8fc7c823b9dd2b7890c96438f347383aa713c1d6.tar.gz chromium_src-8fc7c823b9dd2b7890c96438f347383aa713c1d6.tar.bz2 |
Non-SFI mode: Implement test launcher for nacl_helper_nonsfi_unittests.
This CL implements a test launcher customized for nacl_helper_nonsfi_unittests.
- Existing nacl_helper_nonsfi_unittests is renamed to nacl_helper_nonsfi_unittests_main.
- The new test launcher is built with a toolchain for the target architecture rather than PNaCl toolchain.
- XmlUnitTestResultPrinter is now extracted into a separate file.
TEST=Ran bots (with and without editing testing/buildbots scripts). Run locally.
BUG=358465
Review URL: https://codereview.chromium.org/1154313003
Cr-Commit-Position: refs/heads/master@{#333430}
Diffstat (limited to 'components/nacl')
3 files changed, 34 insertions, 8 deletions
diff --git a/components/nacl/loader/nonsfi/nacl_helper_nonsfi_unittests.cc b/components/nacl/loader/nonsfi/nacl_helper_nonsfi_unittests.cc new file mode 100644 index 0000000..dbca0a6 --- /dev/null +++ b/components/nacl/loader/nonsfi/nacl_helper_nonsfi_unittests.cc @@ -0,0 +1,13 @@ +// 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 "base/at_exit.h" +#include "base/command_line.h" +#include "base/test/launcher/test_launcher_nacl_nonsfi.h" + +int main(int argc, char* argv[]) { + base::AtExitManager at_exit; + base::CommandLine::Init(argc, argv); + return base::TestLauncherNonSfiMain("nacl_helper_nonsfi_unittests_main"); +} diff --git a/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc b/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc index acfc127..4338fb6 100644 --- a/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc +++ b/components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc @@ -488,14 +488,6 @@ BPF_DEATH_TEST_C(NaClNonSfiSandboxTest, BPF_TEST_C(NaClNonSfiSandboxTest, StartingAndJoiningThreadWorks, nacl::nonsfi::NaClNonSfiBPFSandboxPolicy) { -#if defined(OS_NACL_NONSFI) - // base::Thread internally uses LazyInstance, which registers a callback to - // AtExitManager. However, in PNaCl toolchain build, it is not instantiated - // by the test runner, unlike host toolchain build (nacl_loader_unittests). - // Hence, declare it here so that the LazyInstance will work properly. - base::AtExitManager at_exit; -#endif - base::Thread thread("sandbox_tests"); BPF_ASSERT(thread.Start()); // |thread|'s destructor will join the thread. diff --git a/components/nacl/loader/nonsfi/run_all_unittests.cc b/components/nacl/loader/nonsfi/run_all_unittests.cc new file mode 100644 index 0000000..7abc257 --- /dev/null +++ b/components/nacl/loader/nonsfi/run_all_unittests.cc @@ -0,0 +1,21 @@ +// 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 "base/at_exit.h" +#include "base/test/launcher/unit_test_launcher.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +int RunAllTestsImpl() { + return RUN_ALL_TESTS(); +} + +} // namespace + +int main(int argc, char** argv) { + base::AtExitManager at_exit; + testing::InitGoogleTest(&argc, argv); + return base::LaunchUnitTests(argc, argv, base::Bind(&RunAllTestsImpl)); +} |