| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. | 13 // limitations under the License. |
| 14 | 14 |
| 15 #include "util/test/multiprocess.h" | 15 #include "util/test/multiprocess.h" |
| 16 | 16 |
| 17 #include <signal.h> | 17 #include <signal.h> |
| 18 #include <stdlib.h> | 18 #include <stdlib.h> |
| 19 #include <sys/wait.h> | 19 #include <sys/wait.h> |
| 20 | 20 |
| 21 #include <string> | 21 #include <string> |
| 22 | 22 |
| 23 #include "base/auto_reset.h" | 23 #include "base/auto_reset.h" |
| 24 #include "base/files/scoped_file.h" | 24 #include "base/files/scoped_file.h" |
| 25 #include "base/memory/scoped_ptr.h" | 25 #include "base/memory/scoped_ptr.h" |
| 26 #include "base/posix/eintr_wrapper.h" |
| 26 #include "base/strings/stringprintf.h" | 27 #include "base/strings/stringprintf.h" |
| 27 #include "gtest/gtest.h" | 28 #include "gtest/gtest.h" |
| 28 #include "util/misc/scoped_forbid_return.h" | 29 #include "util/misc/scoped_forbid_return.h" |
| 29 #include "util/test/errors.h" | 30 #include "util/test/errors.h" |
| 30 | 31 |
| 31 namespace crashpad { | 32 namespace crashpad { |
| 32 namespace test { | 33 namespace test { |
| 33 | 34 |
| 34 using namespace testing; | 35 using namespace testing; |
| 35 | 36 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // This will make the parent hang up on the child as much as would be | 84 // This will make the parent hang up on the child as much as would be |
| 84 // visible from the child’s perspective. The child’s side of the pipe will | 85 // visible from the child’s perspective. The child’s side of the pipe will |
| 85 // be broken, the child’s remote port will become a dead name, and an | 86 // be broken, the child’s remote port will become a dead name, and an |
| 86 // attempt by the child to look up the service will fail. If this weren’t | 87 // attempt by the child to look up the service will fail. If this weren’t |
| 87 // done, the child might hang while waiting for a parent that has already | 88 // done, the child might hang while waiting for a parent that has already |
| 88 // triggered a fatal assertion failure to do something. | 89 // triggered a fatal assertion failure to do something. |
| 89 info.reset(); | 90 info.reset(); |
| 90 info_ = NULL; | 91 info_ = NULL; |
| 91 | 92 |
| 92 int status; | 93 int status; |
| 93 pid_t wait_pid = waitpid(pid, &status, 0); | 94 pid_t wait_pid = HANDLE_EINTR(waitpid(pid, &status, 0)); |
| 94 ASSERT_EQ(pid, wait_pid) << ErrnoMessage("waitpid"); | 95 ASSERT_EQ(pid, wait_pid) << ErrnoMessage("waitpid"); |
| 95 | 96 |
| 96 TerminationReason reason; | 97 TerminationReason reason; |
| 97 int code; | 98 int code; |
| 98 std::string message; | 99 std::string message; |
| 99 if (WIFEXITED(status)) { | 100 if (WIFEXITED(status)) { |
| 100 reason = kTerminationNormal; | 101 reason = kTerminationNormal; |
| 101 code = WEXITSTATUS(status); | 102 code = WEXITSTATUS(status); |
| 102 message = base::StringPrintf("Child exited with code %d, expected", code); | 103 message = base::StringPrintf("Child exited with code %d, expected", code); |
| 103 } else if (WIFSIGNALED(status)) { | 104 } else if (WIFSIGNALED(status)) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 if (Test::HasFailure()) { | 197 if (Test::HasFailure()) { |
| 197 // Trigger the ScopedForbidReturn destructor. | 198 // Trigger the ScopedForbidReturn destructor. |
| 198 return; | 199 return; |
| 199 } | 200 } |
| 200 | 201 |
| 201 exit(0); | 202 exit(0); |
| 202 } | 203 } |
| 203 | 204 |
| 204 } // namespace test | 205 } // namespace test |
| 205 } // namespace crashpad | 206 } // namespace crashpad |
| OLD | NEW |