OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/environment.h" | 5 #include "base/environment.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/process/launch.h" | 8 #include "base/process/launch.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 compare_command.AppendArg("--yuv_frame_width"); | 276 compare_command.AppendArg("--yuv_frame_width"); |
277 compare_command.AppendArg(base::StringPrintf("%d", width)); | 277 compare_command.AppendArg(base::StringPrintf("%d", width)); |
278 compare_command.AppendArg("--yuv_frame_height"); | 278 compare_command.AppendArg("--yuv_frame_height"); |
279 compare_command.AppendArg(base::StringPrintf("%d", height)); | 279 compare_command.AppendArg(base::StringPrintf("%d", height)); |
280 compare_command.AppendArg("--stats_file"); | 280 compare_command.AppendArg("--stats_file"); |
281 compare_command.AppendArgPath(stats_file); | 281 compare_command.AppendArgPath(stats_file); |
282 | 282 |
283 VLOG(0) << "Running " << compare_command.GetCommandLineString(); | 283 VLOG(0) << "Running " << compare_command.GetCommandLineString(); |
284 std::string output; | 284 std::string output; |
285 bool ok = base::GetAppOutput(compare_command, &output); | 285 bool ok = base::GetAppOutput(compare_command, &output); |
| 286 |
| 287 size_t first_result_line_pos = output.find("RESULT"); |
| 288 if (first_result_line_pos == std::string::npos) { |
| 289 LOG(ERROR) << "Got unexpected output from compare_videos.py:" |
| 290 << output; |
| 291 return false; |
| 292 } |
| 293 |
286 // Print to stdout to ensure the perf numbers are parsed properly by the | 294 // Print to stdout to ensure the perf numbers are parsed properly by the |
287 // buildbot step. | 295 // buildbot step. Only print the result lines to ensure we write all of |
288 printf("Output was:\n\n%s\n", output.c_str()); | 296 // it before we hit some os buffer limit and give other processes the |
| 297 // chance to write to Chrome's stdout. |
| 298 std::string result_lines = output.substr(first_result_line_pos); |
| 299 printf("Output was:\n\n%s\n", result_lines.c_str()); |
289 return ok; | 300 return ok; |
290 } | 301 } |
291 | 302 |
292 base::FilePath GetWorkingDir() { | 303 base::FilePath GetWorkingDir() { |
293 std::string home_dir; | 304 std::string home_dir; |
294 environment_->GetVar(kHomeEnvName, &home_dir); | 305 environment_->GetVar(kHomeEnvName, &home_dir); |
295 base::FilePath::StringType native_home_dir(home_dir.begin(), | 306 base::FilePath::StringType native_home_dir(home_dir.begin(), |
296 home_dir.end()); | 307 home_dir.end()); |
297 return base::FilePath(native_home_dir).Append(kWorkingDirName); | 308 return base::FilePath(native_home_dir).Append(kWorkingDirName); |
298 } | 309 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 377 |
367 RunARGBtoI420Converter( | 378 RunARGBtoI420Converter( |
368 kVgaWidth, kVgaHeight, GetWorkingDir().Append(kCapturedYuvFileName)); | 379 kVgaWidth, kVgaHeight, GetWorkingDir().Append(kCapturedYuvFileName)); |
369 ASSERT_TRUE( | 380 ASSERT_TRUE( |
370 CompareVideosAndPrintResult(kVgaWidth, | 381 CompareVideosAndPrintResult(kVgaWidth, |
371 kVgaHeight, | 382 kVgaHeight, |
372 GetWorkingDir().Append(kCapturedYuvFileName), | 383 GetWorkingDir().Append(kCapturedYuvFileName), |
373 GetWorkingDir().Append(kReferenceYuvFileName), | 384 GetWorkingDir().Append(kReferenceYuvFileName), |
374 GetWorkingDir().Append(kStatsFileName))); | 385 GetWorkingDir().Append(kStatsFileName))); |
375 } | 386 } |
OLD | NEW |