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

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

Issue 1262693002: test launcher: print test file names and lines in summary results (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 5 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 | « base/test/launcher/test_results_tracker.h ('k') | base/test/launcher/unit_test_launcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/launcher/test_results_tracker.cc
diff --git a/base/test/launcher/test_results_tracker.cc b/base/test/launcher/test_results_tracker.cc
index c4cb233e3b0f8b653f2d0a5619f9f7dacfb59bfa..92ee04a4ee3c10de9542611517610c6f699c0aa9 100644
--- a/base/test/launcher/test_results_tracker.cc
+++ b/base/test/launcher/test_results_tracker.cc
@@ -25,26 +25,6 @@ namespace {
const FilePath::CharType kDefaultOutputFile[] = FILE_PATH_LITERAL(
"test_detail.xml");
-// Utility function to print a list of test names. Uses iterator to be
-// compatible with different containers, like vector and set.
-template<typename InputIterator>
-void PrintTests(InputIterator first,
- InputIterator last,
- const std::string& description) {
- size_t count = std::distance(first, last);
- if (count == 0)
- return;
-
- fprintf(stdout,
- "%" PRIuS " test%s %s:\n",
- count,
- count != 1 ? "s" : "",
- description.c_str());
- for (InputIterator i = first; i != last; ++i)
- fprintf(stdout, " %s\n", (*i).c_str());
- fflush(stdout);
-}
-
std::string TestNameWithoutDisabledPrefix(const std::string& test_name) {
std::string test_name_no_disabled(test_name);
ReplaceSubstringsAfterOffset(&test_name_no_disabled, 0, "DISABLED_", "");
@@ -159,10 +139,14 @@ void TestResultsTracker::OnTestIterationStarting() {
per_iteration_data_.push_back(PerIterationData());
}
-void TestResultsTracker::AddTest(const std::string& test_name) {
+void TestResultsTracker::AddTest(
+ const std::string& test_name, const std::string& file, int line) {
// Record disabled test names without DISABLED_ prefix so that they are easy
// to compare with regular test names, e.g. before or after disabling.
all_tests_.insert(TestNameWithoutDisabledPrefix(test_name));
+
+ test_locations_.insert(std::make_pair(
+ TestNameWithoutDisabledPrefix(test_name), CodeLocation(file, line)));
}
void TestResultsTracker::AddDisabledTest(const std::string& test_name) {
@@ -338,6 +322,32 @@ void TestResultsTracker::GetTestStatusForIteration(
}
}
+// Utility function to print a list of test names. Uses iterator to be
+// compatible with different containers, like vector and set.
+template<typename InputIterator>
+void TestResultsTracker::PrintTests(InputIterator first,
+ InputIterator last,
+ const std::string& description) const {
+ size_t count = std::distance(first, last);
+ if (count == 0)
+ return;
+
+ fprintf(stdout,
+ "%" PRIuS " test%s %s:\n",
+ count,
+ count != 1 ? "s" : "",
+ description.c_str());
+ for (InputIterator i = first; i != last; ++i) {
+ fprintf(stdout,
+ " %s (%s:%d)\n",
+ (*i).c_str(),
+ test_locations_.at(*i).file.c_str(),
+ test_locations_.at(*i).line);
+ }
+ fflush(stdout);
+}
+
+
TestResultsTracker::AggregateTestResult::AggregateTestResult() {
}
« no previous file with comments | « base/test/launcher/test_results_tracker.h ('k') | base/test/launcher/unit_test_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698