OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 is a simple application that stress-tests the crash recovery of the disk | 5 // This is a simple application that stress-tests the crash recovery of the disk |
6 // cache. The main application starts a copy of itself on a loop, checking the | 6 // cache. The main application starts a copy of itself on a loop, checking the |
7 // exit code of the child process. When the child dies in an unexpected way, | 7 // exit code of the child process. When the child dies in an unexpected way, |
8 // the main application quits. | 8 // the main application quits. |
9 | 9 |
10 // The child application has two threads: one to exercise the cache in an | 10 // The child application has two threads: one to exercise the cache in an |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 // Starts a new process. | 53 // Starts a new process. |
54 int RunSlave(int iteration) { | 54 int RunSlave(int iteration) { |
55 FilePath exe; | 55 FilePath exe; |
56 PathService::Get(base::FILE_EXE, &exe); | 56 PathService::Get(base::FILE_EXE, &exe); |
57 | 57 |
58 CommandLine cmdline(exe); | 58 CommandLine cmdline(exe); |
59 cmdline.AppendArg(base::IntToString(iteration)); | 59 cmdline.AppendArg(base::IntToString(iteration)); |
60 | 60 |
61 base::ProcessHandle handle; | 61 base::ProcessHandle handle; |
62 base::LaunchOptions options; | 62 if (!base::LaunchProcess(cmdline, base::LaunchOptions(), &handle)) { |
63 options.process_handle = &handle; | |
64 if (!base::LaunchProcess(cmdline, options)) { | |
65 printf("Unable to run test\n"); | 63 printf("Unable to run test\n"); |
66 return kError; | 64 return kError; |
67 } | 65 } |
68 | 66 |
69 int exit_code; | 67 int exit_code; |
70 if (!base::WaitForExitCode(handle, &exit_code)) { | 68 if (!base::WaitForExitCode(handle, &exit_code)) { |
71 printf("Unable to get return code\n"); | 69 printf("Unable to get return code\n"); |
72 return kError; | 70 return kError; |
73 } | 71 } |
74 return exit_code; | 72 return exit_code; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 long int iteration = strtol(argv[1], &end, 0); | 235 long int iteration = strtol(argv[1], &end, 0); |
238 | 236 |
239 if (!StartCrashThread()) { | 237 if (!StartCrashThread()) { |
240 printf("failed to start thread\n"); | 238 printf("failed to start thread\n"); |
241 return kError; | 239 return kError; |
242 } | 240 } |
243 | 241 |
244 StressTheCache(iteration); | 242 StressTheCache(iteration); |
245 return 0; | 243 return 0; |
246 } | 244 } |
OLD | NEW |