| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This class sets up the environment for running the native tests inside an | 5 // This class sets up the environment for running the native tests inside an |
| 6 // android application. It outputs (to a fifo) markers identifying the | 6 // android application. It outputs (to a fifo) markers identifying the |
| 7 // START/PASSED/CRASH of the test suite, FAILURE/SUCCESS of individual tests, | 7 // START/PASSED/CRASH of the test suite, FAILURE/SUCCESS of individual tests, |
| 8 // etc. | 8 // etc. |
| 9 // These markers are read by the test runner script to generate test results. | 9 // These markers are read by the test runner script to generate test results. |
| 10 // It installs signal handlers to detect crashes. | 10 // It installs signal handlers to detect crashes. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 AndroidLog(ANDROID_LOG_ERROR, "Failed to redirect stream to file: %s: %s\n", | 118 AndroidLog(ANDROID_LOG_ERROR, "Failed to redirect stream to file: %s: %s\n", |
| 119 stdout_file_path.value().c_str(), strerror(errno)); | 119 stdout_file_path.value().c_str(), strerror(errno)); |
| 120 exit(EXIT_FAILURE); | 120 exit(EXIT_FAILURE); |
| 121 } | 121 } |
| 122 dup2(STDOUT_FILENO, STDERR_FILENO); | 122 dup2(STDOUT_FILENO, STDERR_FILENO); |
| 123 | 123 |
| 124 if (command_line.HasSwitch(switches::kWaitForDebugger)) { | 124 if (command_line.HasSwitch(switches::kWaitForDebugger)) { |
| 125 AndroidLog(ANDROID_LOG_VERBOSE, | 125 AndroidLog(ANDROID_LOG_VERBOSE, |
| 126 "Native test waiting for GDB because flag %s was supplied", | 126 "Native test waiting for GDB because flag %s was supplied", |
| 127 switches::kWaitForDebugger); | 127 switches::kWaitForDebugger); |
| 128 base::debug::WaitForDebugger(24 * 60 * 60, false); | 128 base::debug::WaitForDebugger(24 * 60 * 60, true); |
| 129 } | 129 } |
| 130 | 130 |
| 131 base::FilePath test_data_dir( | 131 base::FilePath test_data_dir( |
| 132 base::android::ConvertJavaStringToUTF8(env, jtest_data_dir)); | 132 base::android::ConvertJavaStringToUTF8(env, jtest_data_dir)); |
| 133 base::InitAndroidTestPaths(test_data_dir); | 133 base::InitAndroidTestPaths(test_data_dir); |
| 134 | 134 |
| 135 ScopedMainEntryLogger scoped_main_entry_logger; | 135 ScopedMainEntryLogger scoped_main_entry_logger; |
| 136 main(argc, &argv[0]); | 136 main(argc, &argv[0]); |
| 137 } | 137 } |
| 138 | 138 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 152 sa.sa_sigaction = SignalHandler; | 152 sa.sa_sigaction = SignalHandler; |
| 153 sa.sa_flags = SA_SIGINFO; | 153 sa.sa_flags = SA_SIGINFO; |
| 154 | 154 |
| 155 for (unsigned int i = 0; kExceptionSignals[i] != -1; ++i) { | 155 for (unsigned int i = 0; kExceptionSignals[i] != -1; ++i) { |
| 156 sigaction(kExceptionSignals[i], &sa, &g_old_sa[kExceptionSignals[i]]); | 156 sigaction(kExceptionSignals[i], &sa, &g_old_sa[kExceptionSignals[i]]); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace android | 160 } // namespace android |
| 161 } // namespace testing | 161 } // namespace testing |
| OLD | NEW |