Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Unified Diff: base/test/launcher/test_launcher.cc

Issue 292973006: Mod a hash of test names to determine a shard, rather than the test index. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cast Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/launcher/test_launcher.cc
diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc
index 9c01a406b61b8ecb760ec512e063d8cca330ae11..dca272037cc86c3be3a5863e25a0fe026718f2eb 100644
--- a/base/test/launcher/test_launcher.cc
+++ b/base/test/launcher/test_launcher.cc
@@ -16,6 +16,7 @@
#include "base/files/file_path.h"
#include "base/files/scoped_file.h"
#include "base/format_macros.h"
+#include "base/hash.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -755,8 +756,6 @@ bool TestLauncher::Init() {
void TestLauncher::RunTests() {
testing::UnitTest* const unit_test = testing::UnitTest::GetInstance();
- int num_runnable_tests = 0;
-
std::vector<std::string> test_names;
for (int i = 0; i < unit_test->total_test_case_count(); ++i) {
@@ -804,8 +803,10 @@ void TestLauncher::RunTests() {
if (!launcher_delegate_->ShouldRunTest(test_case, test_info))
continue;
- if (num_runnable_tests++ % total_shards_ != shard_index_)
+ if (base::Hash(test_name) % total_shards_ !=
+ static_cast<uint32>(shard_index_)) {
continue;
+ }
test_names.push_back(test_name);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698