summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-25 17:23:03 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-25 17:23:03 +0000
commit7f41b585edcd979cfc61f5a01bb8fda0cdfe85ce (patch)
tree11bfced192e35358fea1dcb888929adf35dbe717
parent50bedcd6b687bb9e7edda46ab9054d846e2a7d07 (diff)
downloadchromium_src-7f41b585edcd979cfc61f5a01bb8fda0cdfe85ce.zip
chromium_src-7f41b585edcd979cfc61f5a01bb8fda0cdfe85ce.tar.gz
chromium_src-7f41b585edcd979cfc61f5a01bb8fda0cdfe85ce.tar.bz2
GTTF: make sharding_supervisor.py use --brave-new-test-launcher
BUG=236893 R=maruel@chromium.org Review URL: https://codereview.chromium.org/39213002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231046 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/base_unittests.isolate4
-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.cc26
-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
17 files changed, 140 insertions, 120 deletions
diff --git a/base/base_unittests.isolate b/base/base_unittests.isolate
index 0b140dd..dd9e6b8 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/chrome/browser_tests.isolate b/chrome/browser_tests.isolate
index 40c98f6..550de8b 100644
--- a/chrome/browser_tests.isolate
+++ b/chrome/browser_tests.isolate
@@ -8,8 +8,6 @@
'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': [
@@ -128,8 +126,6 @@
'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 6ab2550..5982df8 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -74,6 +74,24 @@
],
'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': [
@@ -151,6 +169,7 @@
'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
@@ -178,7 +197,6 @@
],
'defines': [
'HAS_OUT_OF_PROC_TEST_RUNNER',
- 'INTERACTIVE_TESTS',
],
'variables': {
'win_use_external_manifest': 1,
@@ -266,7 +284,6 @@
'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',
@@ -275,6 +292,7 @@
'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',
@@ -922,6 +940,7 @@
'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',
@@ -1539,9 +1558,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',
@@ -1995,6 +2014,7 @@
'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',
@@ -2031,9 +2051,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',
@@ -2262,6 +2282,7 @@
'common',
'common/extensions/api/api.gyp:api',
'renderer',
+ 'test_support_chrome',
'test_support_common',
'../net/net.gyp:net',
'../printing/printing.gyp:printing',
@@ -2290,7 +2311,7 @@
'app/chrome_dll.rc',
'app/chrome_dll_resource.h',
'app/chrome_version.rc.version',
- 'test/base/chrome_test_launcher.cc',
+ 'test/base/browser_tests_main.cc',
'test/data/resource.rc',
'browser/sync/test/integration/apps_helper.cc',
'browser/sync/test/integration/apps_helper.h',
@@ -2442,6 +2463,7 @@
'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',
@@ -2493,7 +2515,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/chrome_test_launcher.cc',
+ 'test/base/browser_tests_main.cc',
'test/data/resource.rc',
],
'conditions': [
diff --git a/chrome/interactive_ui_tests.isolate b/chrome/interactive_ui_tests.isolate
index 057e0b9..7f9fc0e 100644
--- a/chrome/interactive_ui_tests.isolate
+++ b/chrome/interactive_ui_tests.isolate
@@ -8,8 +8,6 @@
'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': [
@@ -67,8 +65,6 @@
'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 5aa2463..3861306 100644
--- a/chrome/sync_integration_tests.isolate
+++ b/chrome/sync_integration_tests.isolate
@@ -8,7 +8,6 @@
'command': [
'../testing/xvfb.py',
'<(PRODUCT_DIR)',
- '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/sync_integration_tests<(EXECUTABLE_SUFFIX)',
],
'isolate_dependency_tracked': [
@@ -52,7 +51,6 @@
['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
new file mode 100644
index 0000000..cb2acce
--- /dev/null
+++ b/chrome/test/base/browser_tests_main.cc
@@ -0,0 +1,11 @@
+// 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 345f504..f14ace3 100644
--- a/chrome/test/base/chrome_test_launcher.cc
+++ b/chrome/test/base/chrome_test_launcher.cc
@@ -55,6 +55,8 @@
#include "chrome/app/chrome_breakpad_client.h"
#endif
+namespace {
+
class ChromeTestLauncherDelegate : public content::TestLauncherDelegate {
public:
ChromeTestLauncherDelegate() {}
@@ -126,31 +128,13 @@ class ChromeTestLauncherDelegate : public content::TestLauncherDelegate {
DISALLOW_COPY_AND_ASSIGN(ChromeTestLauncherDelegate);
};
-int main(int argc, char** argv) {
+} // namespace
+
+int LaunchChromeTests(int default_jobs, 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.
@@ -161,5 +145,5 @@ int main(int argc, char** argv) {
#endif
ChromeTestLauncherDelegate launcher_delegate;
- return content::LaunchTests(&launcher_delegate, argc, argv);
+ return content::LaunchTests(&launcher_delegate, default_jobs, argc, argv);
}
diff --git a/chrome/test/base/chrome_test_launcher.h b/chrome/test/base/chrome_test_launcher.h
new file mode 100644
index 0000000..b9254d3
--- /dev/null
+++ b/chrome/test/base/chrome_test_launcher.h
@@ -0,0 +1,13 @@
+// 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
new file mode 100644
index 0000000..3104341
--- /dev/null
+++ b/chrome/test/base/interactive_ui_tests_main.cc
@@ -0,0 +1,41 @@
+// 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 71bab21..3f077d6 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 7312750..975c39e 100644
--- a/content/content_browsertests.isolate
+++ b/content/content_browsertests.isolate
@@ -26,7 +26,6 @@
'command': [
'../testing/xvfb.py',
'<(PRODUCT_DIR)',
- '../tools/swarm_client/googletest/run_test_cases.py',
'<(PRODUCT_DIR)/content_browsertests<(EXECUTABLE_SUFFIX)',
],
'isolate_dependency_tracked': [
@@ -76,7 +75,6 @@
'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 780aefb..92a448b 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 31dbef2..c48aee4 100644
--- a/content/public/test/test_launcher.cc
+++ b/content/public/test/test_launcher.cc
@@ -367,10 +367,7 @@ void WrapperTestLauncherDelegate::GTestCallback(
result.elapsed_time = elapsed_time;
- // 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);
+ result.output_snippet = GetTestOutputSnippet(result, output);
if (ContainsKey(dependent_test_map_, test_name))
RunDependentTest(test_launcher, dependent_test_map_[test_name], result);
@@ -439,6 +436,7 @@ int RunContentMain(int argc, char** argv,
}
int LaunchTests(TestLauncherDelegate* launcher_delegate,
+ int default_jobs,
int argc,
char** argv) {
DCHECK(!g_launcher_delegate);
@@ -470,23 +468,23 @@ int LaunchTests(TestLauncherDelegate* launcher_delegate,
if (ShouldRunContentMain())
return RunContentMain(argc, argv, launcher_delegate);
- fprintf(stdout,
- "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");
-
base::AtExitManager at_exit;
testing::InitGoogleTest(&argc, argv);
TestTimeouts::Initialize();
- int jobs = 1; // TODO(phajdan.jr): Default to half the number of CPU cores.
+ int jobs = default_jobs;
if (!GetSwitchValueAsInt(switches::kTestLauncherJobs, &jobs))
return 1;
+ fprintf(stdout,
+ "Starting tests (using %d parallel jobs)...\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);
+
base::MessageLoopForIO message_loop;
WrapperTestLauncherDelegate delegate(launcher_delegate, jobs);
diff --git a/content/public/test/test_launcher.h b/content/public/test/test_launcher.h
index df3f56c..268eab5 100644
--- a/content/public/test/test_launcher.h
+++ b/content/public/test/test_launcher.h
@@ -43,7 +43,11 @@ 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 9a229a9..fae46c8 100644
--- a/content/test/content_test_launcher.cc
+++ b/content/test/content_test_launcher.cc
@@ -8,6 +8,7 @@
#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"
@@ -127,6 +128,7 @@ 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, argc, argv);
+ return LaunchTests(&launcher_delegate, default_jobs, argc, argv);
}
diff --git a/net/net_unittests.isolate b/net/net_unittests.isolate
index 61b8c47..2d120bf 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 9967071..20d7db7 100755
--- a/tools/sharding_supervisor/sharding_supervisor.py
+++ b/tools/sharding_supervisor/sharding_supervisor.py
@@ -3,49 +3,13 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Defer to run_test_cases.py."""
+"""Defer to --brave-new-test-launcher."""
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()
@@ -68,34 +32,27 @@ 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()
- 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)
+ env = os.environ
+ env['GTEST_TOTAL_SHARDS'] = str(options.total_slaves)
+ env['GTEST_SHARD_INDEX'] = str(options.slave_index)
- run_test_cases_extra_args, rest = pop_known_arguments(args)
+ if options.jobs:
+ args.append('--test-launcher-jobs=%d' % options.jobs)
- import run_test_cases # pylint: disable=F0401
+ if options.clusters:
+ args.append('--test-launcher-batch-limit=%d' % options.clusters)
- return run_test_cases.main(cmd + run_test_cases_extra_args + ['--'] + rest)
+ return subprocess.Popen(args + ['--brave-new-test-launcher'], env=env).wait()
if __name__ == '__main__':