summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrmsousa@chromium.org <rmsousa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-28 19:23:04 +0000
committerrmsousa@chromium.org <rmsousa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-28 19:23:04 +0000
commitb3f9f40be7b0dc7c94dd23625a6577af328c8f55 (patch)
treede41347f7d9e6eeaeeb8dc2637ed89ce906b4720
parent44d0930a6cae869bd86819eeec60bd3d683c4a31 (diff)
downloadchromium_src-b3f9f40be7b0dc7c94dd23625a6577af328c8f55.zip
chromium_src-b3f9f40be7b0dc7c94dd23625a6577af328c8f55.tar.gz
chromium_src-b3f9f40be7b0dc7c94dd23625a6577af328c8f55.tar.bz2
Revert 231359 "GTTF: make sharding_supervisor.py use --brave-new..."
This broke Mac interactive_ui_tests > GTTF: make sharding_supervisor.py use --brave-new-test-launcher > > - browser tests use parallel jobs by default (except interactive_ui_tests) > - sharding + PRE_ tests are handled correctly > - .isolate files updated > > BUG=236893 > R=maruel@chromium.org, sky@chromium.org > > Review URL: https://codereview.chromium.org/46023003 TBR=phajdan.jr@chromium.org Review URL: https://codereview.chromium.org/48113008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231371 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/base_unittests.isolate4
-rw-r--r--base/test/launcher/test_launcher.cc3
-rw-r--r--base/test/launcher/test_launcher.h10
-rw-r--r--base/test/launcher/unit_test_launcher.cc6
-rw-r--r--chrome/browser_tests.isolate4
-rw-r--r--chrome/chrome_tests.gypi34
-rw-r--r--chrome/interactive_ui_tests.isolate4
-rw-r--r--chrome/sync_integration_tests.isolate2
-rw-r--r--chrome/test/base/browser_tests_main.cc11
-rw-r--r--chrome/test/base/chrome_test_launcher.cc28
-rw-r--r--chrome/test/base/chrome_test_launcher.h13
-rw-r--r--chrome/test/base/interactive_ui_tests_main.cc41
-rw-r--r--chrome/unit_tests.isolate4
-rw-r--r--content/content_browsertests.isolate2
-rw-r--r--content/content_unittests.isolate6
-rw-r--r--content/public/test/test_launcher.cc106
-rw-r--r--content/public/test/test_launcher.h4
-rw-r--r--content/test/content_test_launcher.cc4
-rw-r--r--net/net_unittests.isolate2
-rwxr-xr-xtools/sharding_supervisor/sharding_supervisor.py71
20 files changed, 155 insertions, 204 deletions
diff --git a/base/base_unittests.isolate b/base/base_unittests.isolate
index dd9e6b8..0b140dd 100644
--- a/base/base_unittests.isolate
+++ b/base/base_unittests.isolate
@@ -16,8 +16,8 @@
'command': [
'../testing/xvfb.py',
'<(PRODUCT_DIR)',
+ '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/base_unittests<(EXECUTABLE_SUFFIX)',
- '--brave-new-test-launcher',
],
'isolate_dependency_tracked': [
'../testing/xvfb.py',
@@ -40,8 +40,8 @@
'variables': {
'command': [
'../testing/test_env.py',
+ '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/base_unittests<(EXECUTABLE_SUFFIX)',
- '--brave-new-test-launcher',
],
},
}],
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index 9c06a1a..f2766a7 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -461,7 +461,8 @@ void TestLauncher::RunTests() {
}
}
- test_started_count_ = launcher_delegate_->RunTests(this, test_names);
+ test_started_count_ = test_names.size();
+ launcher_delegate_->RunTests(this, test_names);
if (test_started_count_ == 0) {
fprintf(stdout, "0 tests run\n");
diff --git a/base/test/launcher/test_launcher.h b/base/test/launcher/test_launcher.h
index eee9851..10bb266 100644
--- a/base/test/launcher/test_launcher.h
+++ b/base/test/launcher/test_launcher.h
@@ -58,12 +58,10 @@ class TestLauncherDelegate {
const testing::TestInfo* test_info) = 0;
// Called to make the delegate run the specified tests. The delegate must
- // return the number of actual tests it's going to run (can be smaller,
- // equal to, or larger than size of |test_names|). It must also call
- // |test_launcher|'s OnTestFinished method once per every run test,
- // regardless of its success.
- virtual size_t RunTests(TestLauncher* test_launcher,
- const std::vector<std::string>& test_names) = 0;
+ // call |test_launcher|'s OnTestFinished method once per every test in
+ // |test_names|, regardless of its success.
+ virtual void RunTests(TestLauncher* test_launcher,
+ const std::vector<std::string>& test_names) = 0;
// Called to make the delegate retry the specified tests. The delegate must
// return the number of actual tests it's going to retry (can be smaller,
diff --git a/base/test/launcher/unit_test_launcher.cc b/base/test/launcher/unit_test_launcher.cc
index 63c64c9..7db94bf 100644
--- a/base/test/launcher/unit_test_launcher.cc
+++ b/base/test/launcher/unit_test_launcher.cc
@@ -115,8 +115,8 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
return true;
}
- virtual size_t RunTests(TestLauncher* test_launcher,
- const std::vector<std::string>& test_names) OVERRIDE {
+ virtual void RunTests(TestLauncher* test_launcher,
+ const std::vector<std::string>& test_names) OVERRIDE {
DCHECK(thread_checker_.CalledOnValidThread());
std::vector<std::string> batch;
@@ -130,8 +130,6 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate {
}
RunBatch(test_launcher, batch);
-
- return test_names.size();
}
virtual size_t RetryTests(
diff --git a/chrome/browser_tests.isolate b/chrome/browser_tests.isolate
index 150f018..f6978b4 100644
--- a/chrome/browser_tests.isolate
+++ b/chrome/browser_tests.isolate
@@ -8,6 +8,8 @@
'command': [
'../testing/xvfb.py',
'<(PRODUCT_DIR)',
+ '../tools/swarm_client/googletest/run_test_cases.py',
+ '--use-less-jobs',
'<(PRODUCT_DIR)/browser_tests<(EXECUTABLE_SUFFIX)',
],
'isolate_dependency_tracked': [
@@ -127,6 +129,8 @@
'variables': {
'command': [
'../testing/test_env.py',
+ '../tools/swarm_client/googletest/run_test_cases.py',
+ '--use-less-jobs',
'<(PRODUCT_DIR)/browser_tests<(EXECUTABLE_SUFFIX)',
],
},
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 6936edd..0497476 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -74,24 +74,6 @@
],
'targets': [
{
- 'target_name': 'test_support_chrome',
- 'type': 'static_library',
- 'dependencies': [
- 'test_support_common',
- '../testing/gtest.gyp:gtest',
- ],
- 'export_dependent_settings': [
- 'test_support_common',
- ],
- 'include_dirs': [
- '..',
- ],
- 'sources': [
- 'test/base/chrome_test_launcher.cc',
- 'test/base/chrome_test_launcher.h',
- ],
- },
- {
'target_name': 'test_support_ui_runner',
'type': 'static_library',
'dependencies': [
@@ -169,7 +151,6 @@
'common/extensions/api/api.gyp:api',
'debugger',
'renderer',
- 'test_support_chrome',
'test_support_common',
# NOTE: don't add test_support_ui, no more UITests. See
# http://crbug.com/137365
@@ -197,6 +178,7 @@
],
'defines': [
'HAS_OUT_OF_PROC_TEST_RUNNER',
+ 'INTERACTIVE_TESTS',
],
'variables': {
'win_use_external_manifest': 1,
@@ -284,6 +266,7 @@
'browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc',
'browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h',
'browser/ui/views/tabs/tab_drag_controller_interactive_uitest_win.cc',
+ 'test/base/chrome_test_launcher.cc',
'test/base/interactive_test_utils.cc',
'test/base/interactive_test_utils.h',
'test/base/interactive_test_utils_aura.cc',
@@ -292,7 +275,6 @@
'test/base/interactive_test_utils_mac.mm',
'test/base/interactive_test_utils_views.cc',
'test/base/interactive_test_utils_win.cc',
- 'test/base/interactive_ui_tests_main.cc',
'test/base/view_event_test_base.cc',
'test/base/view_event_test_base.h',
'test/ppapi/ppapi_interactive_browsertest.cc',
@@ -940,7 +922,6 @@
'common/extensions/api/api.gyp:api',
'renderer',
'test/perf/perf_test.gyp:*',
- 'test_support_chrome',
'test_support_common',
'test_support_unit',
'../base/base.gyp:base',
@@ -1560,9 +1541,9 @@
'renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc',
'renderer/translate/translate_helper_browsertest.cc',
'renderer/translate/translate_script_browsertest.cc',
- 'test/base/browser_tests_main.cc',
'test/base/chrome_render_view_test.cc',
'test/base/chrome_render_view_test.h',
+ 'test/base/chrome_test_launcher.cc',
'test/base/web_ui_browsertest.cc',
'test/base/web_ui_browsertest.h',
'test/base/in_process_browser_test_browsertest.cc',
@@ -2019,7 +2000,6 @@
'chrome_resources.gyp:packed_resources',
'renderer',
'test/perf/perf_test.gyp:*',
- 'test_support_chrome',
'test_support_common',
'../base/base.gyp:base',
'../base/base.gyp:base_i18n',
@@ -2056,9 +2036,9 @@
'browser/extensions/extension_apitest.cc',
'browser/extensions/extension_browsertest.cc',
'browser/extensions/extension_test_notification_observer.cc',
- 'test/base/browser_tests_main.cc',
'test/base/chrome_render_view_test.cc',
'test/base/chrome_render_view_test.h',
+ 'test/base/chrome_test_launcher.cc',
'test/perf/browser_perf_test.cc',
'test/perf/browser_perf_test.h',
'test/perf/rendering/throughput_tests.cc',
@@ -2287,7 +2267,6 @@
'common',
'common/extensions/api/api.gyp:api',
'renderer',
- 'test_support_chrome',
'test_support_common',
'../net/net.gyp:net',
'../printing/printing.gyp:printing',
@@ -2316,7 +2295,7 @@
'app/chrome_dll.rc',
'app/chrome_dll_resource.h',
'app/chrome_version.rc.version',
- 'test/base/browser_tests_main.cc',
+ 'test/base/chrome_test_launcher.cc',
'test/data/resource.rc',
'browser/sync/test/integration/apps_helper.cc',
'browser/sync/test/integration/apps_helper.h',
@@ -2468,7 +2447,6 @@
'chrome',
'common/extensions/api/api.gyp:api',
'test/perf/perf_test.gyp:*',
- 'test_support_chrome',
'test_support_common',
'../skia/skia.gyp:skia',
'../sync/sync.gyp:sync',
@@ -2520,7 +2498,7 @@
'browser/sync/test/integration/sync_test.h',
'browser/sync/test/integration/typed_urls_helper.cc',
'browser/sync/test/integration/typed_urls_helper.h',
- 'test/base/browser_tests_main.cc',
+ 'test/base/chrome_test_launcher.cc',
'test/data/resource.rc',
],
'conditions': [
diff --git a/chrome/interactive_ui_tests.isolate b/chrome/interactive_ui_tests.isolate
index 7f9fc0e..057e0b9 100644
--- a/chrome/interactive_ui_tests.isolate
+++ b/chrome/interactive_ui_tests.isolate
@@ -8,6 +8,8 @@
'command': [
'../testing/xvfb.py',
'<(PRODUCT_DIR)',
+ '../tools/swarm_client/googletest/run_test_cases.py',
+ '-j1',
'<(PRODUCT_DIR)/interactive_ui_tests<(EXECUTABLE_SUFFIX)',
],
'isolate_dependency_tracked': [
@@ -65,6 +67,8 @@
'variables': {
'command': [
'../testing/test_env.py',
+ '../tools/swarm_client/googletest/run_test_cases.py',
+ '-j1',
'<(PRODUCT_DIR)/interactive_ui_tests<(EXECUTABLE_SUFFIX)',
],
},
diff --git a/chrome/sync_integration_tests.isolate b/chrome/sync_integration_tests.isolate
index 3861306..5aa2463 100644
--- a/chrome/sync_integration_tests.isolate
+++ b/chrome/sync_integration_tests.isolate
@@ -8,6 +8,7 @@
'command': [
'../testing/xvfb.py',
'<(PRODUCT_DIR)',
+ '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/sync_integration_tests<(EXECUTABLE_SUFFIX)',
],
'isolate_dependency_tracked': [
@@ -51,6 +52,7 @@
['OS=="mac"', {
'variables': {
'command': [
+ '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/sync_integration_tests<(EXECUTABLE_SUFFIX)',
],
'isolate_dependency_tracked': [
diff --git a/chrome/test/base/browser_tests_main.cc b/chrome/test/base/browser_tests_main.cc
deleted file mode 100644
index cb2acce..0000000
--- a/chrome/test/base/browser_tests_main.cc
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2013 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/sys_info.h"
-#include "chrome/test/base/chrome_test_launcher.h"
-
-int main(int argc, char** argv) {
- int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2);
- return LaunchChromeTests(default_jobs, argc, argv);
-}
diff --git a/chrome/test/base/chrome_test_launcher.cc b/chrome/test/base/chrome_test_launcher.cc
index f14ace3..345f504 100644
--- a/chrome/test/base/chrome_test_launcher.cc
+++ b/chrome/test/base/chrome_test_launcher.cc
@@ -55,8 +55,6 @@
#include "chrome/app/chrome_breakpad_client.h"
#endif
-namespace {
-
class ChromeTestLauncherDelegate : public content::TestLauncherDelegate {
public:
ChromeTestLauncherDelegate() {}
@@ -128,13 +126,31 @@ class ChromeTestLauncherDelegate : public content::TestLauncherDelegate {
DISALLOW_COPY_AND_ASSIGN(ChromeTestLauncherDelegate);
};
-} // namespace
-
-int LaunchChromeTests(int default_jobs, int argc, char** argv) {
+int main(int argc, char** argv) {
#if defined(OS_MACOSX)
chrome_browser_application_mac::RegisterBrowserCrApp();
#endif
+// Only allow ui_controls to be used in interactive_ui_tests, since they depend
+// on focus and can't be sharded.
+#if defined(INTERACTIVE_TESTS)
+ ui_controls::EnableUIControls();
+
+#if defined(OS_CHROMEOS)
+ ui_controls::InstallUIControlsAura(ash::test::CreateAshUIControls());
+#elif defined(USE_AURA)
+
+#if defined(OS_LINUX)
+ ui_controls::InstallUIControlsAura(
+ views::test::CreateUIControlsDesktopAura());
+#else
+ // TODO(win_ash): when running interactive_ui_tests for Win Ash, use above.
+ ui_controls::InstallUIControlsAura(aura::test::CreateUIControlsAura(NULL));
+#endif
+#endif
+
+#endif
+
#if defined(OS_LINUX) || defined(OS_ANDROID)
// We leak this pointer intentionally. The breakpad client needs to outlive
// all other code.
@@ -145,5 +161,5 @@ int LaunchChromeTests(int default_jobs, int argc, char** argv) {
#endif
ChromeTestLauncherDelegate launcher_delegate;
- return content::LaunchTests(&launcher_delegate, default_jobs, argc, argv);
+ return content::LaunchTests(&launcher_delegate, argc, argv);
}
diff --git a/chrome/test/base/chrome_test_launcher.h b/chrome/test/base/chrome_test_launcher.h
deleted file mode 100644
index b9254d3..0000000
--- a/chrome/test/base/chrome_test_launcher.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2013 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.
-
-#ifndef CHROME_TEST_BASE_CHROME_TEST_LAUNCHER_H_
-#define CHROME_TEST_BASE_CHROME_TEST_LAUNCHER_H_
-
-// Launches Chrome tests using |launcher_delegate|. |default_jobs| is number
-// of test jobs to be run in parallel, unless overridden from the command line.
-// Returns exit code.
-int LaunchChromeTests(int default_jobs, int argc, char** argv);
-
-#endif // CHROME_TEST_BASE_CHROME_TEST_LAUNCHER_H_
diff --git a/chrome/test/base/interactive_ui_tests_main.cc b/chrome/test/base/interactive_ui_tests_main.cc
deleted file mode 100644
index 8de925a..0000000
--- a/chrome/test/base/interactive_ui_tests_main.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2013 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 "chrome/test/base/chrome_test_launcher.h"
-
-#include "ui/base/test/ui_controls.h"
-
-#if defined(USE_AURA)
-#include "ui/aura/test/ui_controls_factory_aura.h"
-#include "ui/base/test/ui_controls_aura.h"
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
-#include "ui/views/test/ui_controls_factory_desktop_aurax11.h"
-#endif
-#endif
-
-#if defined(OS_CHROMEOS)
-#include "ash/test/ui_controls_factory_ash.h"
-#endif
-
-int main(int argc, char** argv) {
- // Only allow ui_controls to be used in interactive_ui_tests, since they
- // depend on focus and can't be sharded.
- ui_controls::EnableUIControls();
-
-#if defined(OS_CHROMEOS)
- ui_controls::InstallUIControlsAura(ash::test::CreateAshUIControls());
-#elif defined(USE_AURA)
-
-#if defined(OS_LINUX)
- ui_controls::InstallUIControlsAura(
- views::test::CreateUIControlsDesktopAura());
-#else
- // TODO(win_ash): when running interactive_ui_tests for Win Ash, use above.
- ui_controls::InstallUIControlsAura(aura::test::CreateUIControlsAura(NULL));
-#endif
-#endif
-
- // Run interactive_ui_tests serially, they do not support running in parallel.
- return LaunchChromeTests(1, argc, argv);
-}
diff --git a/chrome/unit_tests.isolate b/chrome/unit_tests.isolate
index 3f077d6..71bab21 100644
--- a/chrome/unit_tests.isolate
+++ b/chrome/unit_tests.isolate
@@ -41,8 +41,8 @@
'command': [
'../testing/xvfb.py',
'<(PRODUCT_DIR)',
+ '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/unit_tests<(EXECUTABLE_SUFFIX)',
- '--brave-new-test-launcher',
],
'isolate_dependency_tracked': [
'../testing/xvfb.py',
@@ -86,8 +86,8 @@
'variables': {
'command': [
'../testing/test_env.py',
+ '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/unit_tests<(EXECUTABLE_SUFFIX)',
- '--brave-new-test-launcher',
],
'isolate_dependency_untracked': [
'<(PRODUCT_DIR)/test_data/chrome/browser/resources/google_now/',
diff --git a/content/content_browsertests.isolate b/content/content_browsertests.isolate
index 975c39e..7312750 100644
--- a/content/content_browsertests.isolate
+++ b/content/content_browsertests.isolate
@@ -26,6 +26,7 @@
'command': [
'../testing/xvfb.py',
'<(PRODUCT_DIR)',
+ '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/content_browsertests<(EXECUTABLE_SUFFIX)',
],
'isolate_dependency_tracked': [
@@ -75,6 +76,7 @@
'variables': {
'command': [
'../testing/test_env.py',
+ '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/content_browsertests<(EXECUTABLE_SUFFIX)',
],
},
diff --git a/content/content_unittests.isolate b/content/content_unittests.isolate
index 92a448b..780aefb 100644
--- a/content/content_unittests.isolate
+++ b/content/content_unittests.isolate
@@ -35,8 +35,8 @@
'command': [
'../testing/xvfb.py',
'<(PRODUCT_DIR)',
+ '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/content_unittests<(EXECUTABLE_SUFFIX)',
- '--brave-new-test-launcher',
],
'isolate_dependency_tracked': [
'../testing/xvfb.py',
@@ -49,8 +49,8 @@
'variables': {
'command': [
'../testing/test_env.py',
+ '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/content_unittests<(EXECUTABLE_SUFFIX)',
- '--brave-new-test-launcher',
],
'isolate_dependency_tracked': [
'<(PRODUCT_DIR)/ffmpegsumo.so',
@@ -61,8 +61,8 @@
'variables': {
'command': [
'../testing/test_env.py',
+ '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/content_unittests<(EXECUTABLE_SUFFIX)',
- '--brave-new-test-launcher',
],
'isolate_dependency_tracked': [
'<(PRODUCT_DIR)/aura_test_support_resources.pak',
diff --git a/content/public/test/test_launcher.cc b/content/public/test/test_launcher.cc
index 6e643ec..31dbef2 100644
--- a/content/public/test/test_launcher.cc
+++ b/content/public/test/test_launcher.cc
@@ -103,8 +103,8 @@ class WrapperTestLauncherDelegate : public base::TestLauncherDelegate {
const testing::TestInfo* test_info) OVERRIDE;
virtual bool ShouldRunTest(const testing::TestCase* test_case,
const testing::TestInfo* test_info) OVERRIDE;
- virtual size_t RunTests(base::TestLauncher* test_launcher,
- const std::vector<std::string>& test_names) OVERRIDE;
+ virtual void RunTests(base::TestLauncher* test_launcher,
+ const std::vector<std::string>& test_names) OVERRIDE;
virtual size_t RetryTests(
base::TestLauncher* test_launcher,
const std::vector<std::string>& test_names) OVERRIDE;
@@ -153,9 +153,6 @@ class WrapperTestLauncherDelegate : public base::TestLauncherDelegate {
typedef std::map<std::string, base::FilePath> UserDataDirMap;
UserDataDirMap user_data_dir_map_;
- // Store names of all seen tests to properly handle PRE_ tests.
- std::set<std::string> all_test_names_;
-
// Temporary directory for user data directories.
base::ScopedTempDir temp_dir_;
@@ -177,20 +174,11 @@ std::string WrapperTestLauncherDelegate::GetTestNameForFiltering(
bool WrapperTestLauncherDelegate::ShouldRunTest(
const testing::TestCase* test_case,
const testing::TestInfo* test_info) {
- all_test_names_.insert(
- std::string(test_case->name()) + "." + test_info->name());
-
if (StartsWithASCII(test_info->name(), kManualTestPrefix, true) &&
!CommandLine::ForCurrentProcess()->HasSwitch(kRunManualTestsFlag)) {
return false;
}
- if (StartsWithASCII(test_info->name(), kPreTestPrefix, true)) {
- // We will actually run PRE_ tests, but to ensure they run on the same shard
- // as dependent tests, handle all these details internally.
- return false;
- }
-
// Stop test execution after too many timeouts.
if (timeout_count_ > 5) {
if (!printed_timeout_message_) {
@@ -203,60 +191,46 @@ bool WrapperTestLauncherDelegate::ShouldRunTest(
return true;
}
-std::string GetPreTestName(const std::string& full_name) {
- size_t dot_pos = full_name.find('.');
- CHECK_NE(dot_pos, std::string::npos);
- std::string test_case_name = full_name.substr(0, dot_pos);
- std::string test_name = full_name.substr(dot_pos + 1);
- return test_case_name + "." + kPreTestPrefix + test_name;
-}
-
-size_t WrapperTestLauncherDelegate::RunTests(
+void WrapperTestLauncherDelegate::RunTests(
base::TestLauncher* test_launcher,
const std::vector<std::string>& test_names) {
- // Number of additional tests to run because of dependencies.
- size_t additional_tests_to_run_count = 0;
-
- // Compute dependencies of tests to be run.
- for (size_t i = 0; i < test_names.size(); i++) {
- std::string full_name(test_names[i]);
- std::string pre_test_name(GetPreTestName(full_name));
-
- while (ContainsKey(all_test_names_, pre_test_name)) {
- additional_tests_to_run_count++;
-
- DCHECK(!ContainsKey(dependent_test_map_, pre_test_name));
- dependent_test_map_[pre_test_name] = full_name;
-
- DCHECK(!ContainsKey(reverse_dependent_test_map_, full_name));
- reverse_dependent_test_map_[full_name] = pre_test_name;
+ // List of tests we can kick off right now, depending on no other tests.
+ std::vector<std::string> tests_to_run_now;
- full_name = pre_test_name;
- pre_test_name = GetPreTestName(pre_test_name);
- }
- }
+ std::set<std::string> test_names_set(test_names.begin(), test_names.end());
for (size_t i = 0; i < test_names.size(); i++) {
std::string full_name(test_names[i]);
- // Make sure no PRE_ tests were requested explicitly.
- DCHECK_EQ(full_name, RemoveAnyPrePrefixes(full_name));
-
- if (!ContainsKey(user_data_dir_map_, full_name)) {
+ // Make sure PRE_ tests and tests that depend on them share the same
+ // data directory - based it on the test name without prefixes.
+ std::string test_name_no_pre(RemoveAnyPrePrefixes(full_name));
+ if (!ContainsKey(user_data_dir_map_, test_name_no_pre)) {
base::FilePath temp_dir;
CHECK(file_util::CreateTemporaryDirInDir(
temp_dir_.path(), FILE_PATH_LITERAL("d"), &temp_dir));
- user_data_dir_map_[full_name] = temp_dir;
+ user_data_dir_map_[test_name_no_pre] = temp_dir;
}
- // If the test has any dependencies, get to the root and start with that.
- while (ContainsKey(reverse_dependent_test_map_, full_name))
- full_name = GetPreTestName(full_name);
+ size_t dot_pos = full_name.find('.');
+ CHECK_NE(dot_pos, std::string::npos);
+ std::string test_case_name = full_name.substr(0, dot_pos);
+ std::string test_name = full_name.substr(dot_pos + 1);
+ std::string pre_test_name(
+ test_case_name + "." + kPreTestPrefix + test_name);
+ if (ContainsKey(test_names_set, pre_test_name)) {
+ DCHECK(!ContainsKey(dependent_test_map_, pre_test_name));
+ dependent_test_map_[pre_test_name] = full_name;
- DoRunTest(test_launcher, full_name);
+ DCHECK(!ContainsKey(reverse_dependent_test_map_, full_name));
+ reverse_dependent_test_map_[full_name] = pre_test_name;
+ } else {
+ tests_to_run_now.push_back(full_name);
+ }
}
- return test_names.size() + additional_tests_to_run_count;
+ for (size_t i = 0; i < tests_to_run_now.size(); i++)
+ DoRunTest(test_launcher, tests_to_run_now[i]);
}
size_t WrapperTestLauncherDelegate::RetryTests(
@@ -393,7 +367,10 @@ void WrapperTestLauncherDelegate::GTestCallback(
result.elapsed_time = elapsed_time;
- result.output_snippet = GetTestOutputSnippet(result, output);
+ // TODO(phajdan.jr): Use base::PrintTestOutputSnippetOnFailure after migrating
+ // away from run_test_cases.py (http://crbug.com/236893).
+ fprintf(stdout, "%s", output.c_str());
+ fflush(stdout);
if (ContainsKey(dependent_test_map_, test_name))
RunDependentTest(test_launcher, dependent_test_map_[test_name], result);
@@ -462,7 +439,6 @@ int RunContentMain(int argc, char** argv,
}
int LaunchTests(TestLauncherDelegate* launcher_delegate,
- int default_jobs,
int argc,
char** argv) {
DCHECK(!g_launcher_delegate);
@@ -494,22 +470,22 @@ int LaunchTests(TestLauncherDelegate* launcher_delegate,
if (ShouldRunContentMain())
return RunContentMain(argc, argv, launcher_delegate);
- base::AtExitManager at_exit;
- testing::InitGoogleTest(&argc, argv);
- TestTimeouts::Initialize();
-
- int jobs = default_jobs;
- if (!GetSwitchValueAsInt(switches::kTestLauncherJobs, &jobs))
- return 1;
-
fprintf(stdout,
- "Starting tests (using %d parallel jobs)...\n"
+ "Starting tests...\n"
"IMPORTANT DEBUGGING NOTE: each test is run inside its own process.\n"
"For debugging a test inside a debugger, use the\n"
"--gtest_filter=<your_test_name> flag along with either\n"
"--single_process (to run the test in one launcher/browser process) or\n"
"--single-process (to do the above, and also run Chrome in single-"
- "process mode).\n", jobs);
+ "process mode).\n");
+
+ base::AtExitManager at_exit;
+ testing::InitGoogleTest(&argc, argv);
+ TestTimeouts::Initialize();
+
+ int jobs = 1; // TODO(phajdan.jr): Default to half the number of CPU cores.
+ if (!GetSwitchValueAsInt(switches::kTestLauncherJobs, &jobs))
+ return 1;
base::MessageLoopForIO message_loop;
diff --git a/content/public/test/test_launcher.h b/content/public/test/test_launcher.h
index 268eab5..df3f56c 100644
--- a/content/public/test/test_launcher.h
+++ b/content/public/test/test_launcher.h
@@ -43,11 +43,7 @@ class TestLauncherDelegate {
virtual ~TestLauncherDelegate();
};
-// Launches tests using |launcher_delegate|. |default_jobs| is number
-// of test jobs to be run in parallel, unless overridden from the command line.
-// Returns exit code.
int LaunchTests(TestLauncherDelegate* launcher_delegate,
- int default_jobs,
int argc,
char** argv) WARN_UNUSED_RESULT;
diff --git a/content/test/content_test_launcher.cc b/content/test/content_test_launcher.cc
index fae46c8..9a229a9 100644
--- a/content/test/content_test_launcher.cc
+++ b/content/test/content_test_launcher.cc
@@ -8,7 +8,6 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/path_service.h"
-#include "base/sys_info.h"
#include "base/test/test_suite.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/content_test_suite_base.h"
@@ -128,7 +127,6 @@ class ContentTestLauncherDelegate : public TestLauncherDelegate {
} // namespace content
int main(int argc, char** argv) {
- int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2);
content::ContentTestLauncherDelegate launcher_delegate;
- return LaunchTests(&launcher_delegate, default_jobs, argc, argv);
+ return LaunchTests(&launcher_delegate, argc, argv);
}
diff --git a/net/net_unittests.isolate b/net/net_unittests.isolate
index 2d120bf..61b8c47 100644
--- a/net/net_unittests.isolate
+++ b/net/net_unittests.isolate
@@ -20,8 +20,8 @@
'variables': {
'command': [
'../testing/test_env.py',
+ '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/net_unittests<(EXECUTABLE_SUFFIX)',
- '--brave-new-test-launcher',
],
'isolate_dependency_tracked': [
'../testing/test_env.py',
diff --git a/tools/sharding_supervisor/sharding_supervisor.py b/tools/sharding_supervisor/sharding_supervisor.py
index 20d7db7..9967071 100755
--- a/tools/sharding_supervisor/sharding_supervisor.py
+++ b/tools/sharding_supervisor/sharding_supervisor.py
@@ -3,13 +3,49 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Defer to --brave-new-test-launcher."""
+"""Defer to run_test_cases.py."""
import os
import optparse
-import subprocess
import sys
+ROOT_DIR = os.path.dirname(
+ os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+
+def pop_known_arguments(args):
+ """Extracts known arguments from the args if present."""
+ rest = []
+ run_test_cases_extra_args = []
+ for arg in args:
+ if arg.startswith(('--gtest_filter=', '--gtest_output=', '--clusters=')):
+ run_test_cases_extra_args.append(arg)
+ elif arg in ('--run-manual', '--verbose'):
+ run_test_cases_extra_args.append(arg)
+ elif arg == '--gtest_print_time':
+ # Ignore.
+ pass
+ elif 'interactive_ui_tests' in arg:
+ # Run this test in a single thread. It is useful to run it under
+ # run_test_cases so automatic flaky test workaround is still used.
+ run_test_cases_extra_args.append('-j1')
+ rest.append(arg)
+ elif 'browser_tests' in arg:
+ # Test cases in this executable fire up *a lot* of child processes,
+ # causing huge memory bottleneck. So use less than N-cpus jobs.
+ run_test_cases_extra_args.append('--use-less-jobs')
+ rest.append(arg)
+ else:
+ rest.append(arg)
+
+ # Use --jobs arg if exist.
+ for arg in args:
+ if arg.startswith('--jobs='):
+ run_test_cases_extra_args.append(arg)
+ break
+
+ return run_test_cases_extra_args, rest
+
def main():
parser = optparse.OptionParser()
@@ -32,27 +68,34 @@ def main():
group.add_option(
'--retries', type='int', help='Kept as --retries')
group.add_option(
- '-j', '--jobs', type='int', help='Number of parallel jobs')
- group.add_option(
- '--clusters', type='int', help='Maximum number of tests in a batch')
- group.add_option(
'--verbose', action='count', default=0, help='Kept as --verbose')
parser.add_option_group(group)
parser.disable_interspersed_args()
options, args = parser.parse_args()
- env = os.environ
- env['GTEST_TOTAL_SHARDS'] = str(options.total_slaves)
- env['GTEST_SHARD_INDEX'] = str(options.slave_index)
+ swarm_client_dir = os.path.join(
+ ROOT_DIR, 'tools', 'swarm_client', 'googletest')
+ sys.path.insert(0, swarm_client_dir)
+
+ cmd = [
+ '--shards', str(options.total_slaves),
+ '--index', str(options.slave_index),
+ '--no-dump',
+ '--no-cr',
+ ]
+ if options.timeout is not None:
+ cmd.extend(['--timeout', str(options.timeout)])
+ if options.retries is not None:
+ cmd.extend(['--retries', str(options.retries)])
+ if options.verbose is not None:
+ cmd.extend(['--verbose'] * options.verbose)
- if options.jobs:
- args.append('--test-launcher-jobs=%d' % options.jobs)
+ run_test_cases_extra_args, rest = pop_known_arguments(args)
- if options.clusters:
- args.append('--test-launcher-batch-limit=%d' % options.clusters)
+ import run_test_cases # pylint: disable=F0401
- return subprocess.Popen(args + ['--brave-new-test-launcher'], env=env).wait()
+ return run_test_cases.main(cmd + run_test_cases_extra_args + ['--'] + rest)
if __name__ == '__main__':