summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorhidehiko <hidehiko@chromium.org>2015-06-08 19:50:57 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-09 02:51:34 +0000
commit8fc7c823b9dd2b7890c96438f347383aa713c1d6 (patch)
treeceeaed6a3be8aac576fd337b45c9d12a47d956fd /components
parent92478e96a57d4f52032a9be47132e9455d9dd160 (diff)
downloadchromium_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')
-rw-r--r--components/nacl.gyp16
-rw-r--r--components/nacl/loader/nonsfi/nacl_helper_nonsfi_unittests.cc13
-rw-r--r--components/nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc8
-rw-r--r--components/nacl/loader/nonsfi/run_all_unittests.cc21
-rw-r--r--components/nacl_helper_nonsfi_unittests.isolate1
-rw-r--r--components/nacl_nonsfi.gyp17
6 files changed, 60 insertions, 16 deletions
diff --git a/components/nacl.gyp b/components/nacl.gyp
index cc733fd..d4f23c7 100644
--- a/components/nacl.gyp
+++ b/components/nacl.gyp
@@ -451,6 +451,22 @@
},
],
}],
+ ['disable_nacl==0 and disable_nacl_untrusted==0 and enable_nacl_nonsfi_test==1', {
+ 'targets': [
+ {
+ 'target_name': 'nacl_helper_nonsfi_unittests',
+ 'type': '<(gtest_target_type)',
+ 'sources': [
+ 'nacl/loader/nonsfi/nacl_helper_nonsfi_unittests.cc',
+ ],
+ 'dependencies': [
+ '../base/base.gyp:base',
+ '../base/base.gyp:test_launcher_nacl_nonsfi',
+ 'nacl_nonsfi.gyp:nacl_helper_nonsfi_unittests_main',
+ ],
+ },
+ ],
+ }],
],
'targets': [
{
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));
+}
diff --git a/components/nacl_helper_nonsfi_unittests.isolate b/components/nacl_helper_nonsfi_unittests.isolate
index 8de0893..b7973b9 100644
--- a/components/nacl_helper_nonsfi_unittests.isolate
+++ b/components/nacl_helper_nonsfi_unittests.isolate
@@ -10,6 +10,7 @@
],
'files': [
'<(PRODUCT_DIR)/nacl_helper_nonsfi_unittests',
+ '<(PRODUCT_DIR)/nacl_helper_nonsfi_unittests_main',
],
'read_only': 1,
},
diff --git a/components/nacl_nonsfi.gyp b/components/nacl_nonsfi.gyp
index aeead0d..7af17e8 100644
--- a/components/nacl_nonsfi.gyp
+++ b/components/nacl_nonsfi.gyp
@@ -178,7 +178,7 @@
['disable_nacl==0 and disable_nacl_untrusted==0 and enable_nacl_nonsfi_test==1', {
'targets': [
{
- 'target_name': 'nacl_helper_nonsfi_unittests',
+ 'target_name': 'nacl_helper_nonsfi_unittests_main',
'type': 'none',
'variables': {
'nacl_untrusted_build': 1,
@@ -186,8 +186,8 @@
# Rename the output binary file to nacl_helper_nonsfi_unittests
# and put it directly under out/{Debug,Release}/, so that this is
# in the standard location, for running on the buildbots.
- 'out_newlib32_nonsfi': '<(PRODUCT_DIR)/nacl_helper_nonsfi_unittests',
- 'out_newlib_arm_nonsfi': '<(PRODUCT_DIR)/nacl_helper_nonsfi_unitttests',
+ 'out_newlib32_nonsfi': '<(PRODUCT_DIR)/nacl_helper_nonsfi_unittests_main',
+ 'out_newlib_arm_nonsfi': '<(PRODUCT_DIR)/nacl_helper_nonsfi_unitttests_main',
'build_glibc': 0,
'build_newlib': 0,
@@ -198,6 +198,7 @@
'sources': [
'nacl/loader/nonsfi/nonsfi_sandbox_sigsys_unittest.cc',
'nacl/loader/nonsfi/nonsfi_sandbox_unittest.cc',
+ 'nacl/loader/nonsfi/run_all_unittests.cc',
],
'link_flags': [
@@ -205,12 +206,12 @@
'-lcontent_common_nacl_nonsfi',
'-levent_nacl_nonsfi',
'-lgio',
- '-lgtest_main_nacl',
'-lgtest_nacl',
'-lnacl_helper_nonsfi_sandbox',
'-lplatform',
'-lsandbox_linux_nacl_nonsfi',
'-lsandbox_linux_test_utils_nacl_nonsfi',
+ '-ltest_support_base_nacl_nonsfi',
],
'conditions': [
@@ -220,12 +221,12 @@
'>(tc_lib_dir_nonsfi_helper32)/libcontent_common_nacl_nonsfi.a',
'>(tc_lib_dir_nonsfi_helper32)/libevent_nacl_nonsfi.a',
'>(tc_lib_dir_nonsfi_helper32)/libgio.a',
- '>(tc_lib_dir_nonsfi_helper32)/libgtest_main_nacl.a',
'>(tc_lib_dir_nonsfi_helper32)/libgtest_nacl.a',
'>(tc_lib_dir_nonsfi_helper32)/libnacl_helper_nonsfi_sandbox.a',
'>(tc_lib_dir_nonsfi_helper32)/libplatform.a',
'>(tc_lib_dir_nonsfi_helper32)/libsandbox_linux_nacl_nonsfi.a',
'>(tc_lib_dir_nonsfi_helper32)/libsandbox_linux_test_utils_nacl_nonsfi.a',
+ '>(tc_lib_dir_nonsfi_helper32)/libtest_support_base_nacl_nonsfi.a',
],
}],
['target_arch=="arm"', {
@@ -234,12 +235,12 @@
'>(tc_lib_dir_nonsfi_helper_arm)/libcontent_common_nacl_nonsfi.a',
'>(tc_lib_dir_nonsfi_helper_arm)/libevent_nacl_nonsfi.a',
'>(tc_lib_dir_nonsfi_helper_arm)/libgio.a',
- '>(tc_lib_dir_nonsfi_helper_arm)/libgtest_main_nacl.a',
'>(tc_lib_dir_nonsfi_helper_arm)/libgtest_nacl.a',
'>(tc_lib_dir_nonsfi_helper_arm)/libnacl_helper_nonsfi_sandbox.a',
'>(tc_lib_dir_nonsfi_helper_arm)/libplatform.a',
'>(tc_lib_dir_nonsfi_helper_arm)/libsandbox_linux_nacl_nonsfi.a',
'>(tc_lib_dir_nonsfi_helper_arm)/libsandbox_linux_test_utils_nacl_nonsfi.a',
+ '>(tc_lib_dir_nonsfi_helper_arm)/libtest_support_base_nacl_nonsfi.a',
],
}],
],
@@ -247,12 +248,12 @@
'dependencies': [
'../base/base_nacl.gyp:base_nacl_nonsfi',
+ '../base/base_nacl.gyp:test_support_base_nacl_nonsfi',
'../content/content_nacl_nonsfi.gyp:content_common_nacl_nonsfi',
'../native_client/src/nonsfi/irt/irt.gyp:nacl_sys_private',
'../native_client/src/untrusted/nacl/nacl.gyp:nacl_lib_newlib',
'../sandbox/linux/sandbox_linux_nacl_nonsfi.gyp:sandbox_linux_nacl_nonsfi',
'../sandbox/linux/sandbox_linux_nacl_nonsfi.gyp:sandbox_linux_test_utils_nacl_nonsfi',
- '../testing/gtest_nacl.gyp:gtest_main_nacl',
'../testing/gtest_nacl.gyp:gtest_nacl',
'nacl_helper_nonsfi_sandbox',
],
@@ -266,7 +267,7 @@
'target_name': 'nacl_helper_nonsfi_unittests_run',
'type': 'none',
'dependencies': [
- 'nacl_helper_nonsfi_unittests',
+ 'nacl.gyp:nacl_helper_nonsfi_unittests',
],
'includes': [
'../build/isolate.gypi',