| 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/test/launcher/test_launcher.h" | 5 #include "base/test/launcher/test_launcher.h" |
| 6 | 6 |
| 7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 std::string GetTestOutputSnippet(const TestResult& result, | 748 std::string GetTestOutputSnippet(const TestResult& result, |
| 749 const std::string& full_output) { | 749 const std::string& full_output) { |
| 750 size_t run_pos = full_output.find(std::string("[ RUN ] ") + | 750 size_t run_pos = full_output.find(std::string("[ RUN ] ") + |
| 751 result.full_name); | 751 result.full_name); |
| 752 if (run_pos == std::string::npos) | 752 if (run_pos == std::string::npos) |
| 753 return std::string(); | 753 return std::string(); |
| 754 | 754 |
| 755 size_t end_pos = full_output.find(std::string("[ FAILED ] ") + | 755 size_t end_pos = full_output.find(std::string("[ FAILED ] ") + |
| 756 result.full_name, | 756 result.full_name, |
| 757 run_pos); | 757 run_pos); |
| 758 if (end_pos == std::string::npos) { | 758 // Only clip the snippet to the "OK" message if the test really |
| 759 // succeeded. It still might have e.g. crashed after printing it. |
| 760 if (end_pos == std::string::npos && |
| 761 result.status == TestResult::TEST_SUCCESS) { |
| 759 end_pos = full_output.find(std::string("[ OK ] ") + | 762 end_pos = full_output.find(std::string("[ OK ] ") + |
| 760 result.full_name, | 763 result.full_name, |
| 761 run_pos); | 764 run_pos); |
| 762 } | 765 } |
| 763 if (end_pos != std::string::npos) { | 766 if (end_pos != std::string::npos) { |
| 764 size_t newline_pos = full_output.find("\n", end_pos); | 767 size_t newline_pos = full_output.find("\n", end_pos); |
| 765 if (newline_pos != std::string::npos) | 768 if (newline_pos != std::string::npos) |
| 766 end_pos = newline_pos + 1; | 769 end_pos = newline_pos + 1; |
| 767 } | 770 } |
| 768 | 771 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 | 899 |
| 897 g_live_processes.Get().erase(process_handle); | 900 g_live_processes.Get().erase(process_handle); |
| 898 } | 901 } |
| 899 | 902 |
| 900 base::CloseProcessHandle(process_handle); | 903 base::CloseProcessHandle(process_handle); |
| 901 | 904 |
| 902 return exit_code; | 905 return exit_code; |
| 903 } | 906 } |
| 904 | 907 |
| 905 } // namespace base | 908 } // namespace base |
| OLD | NEW |