Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: util/test/multiprocess.h

Issue 1000653002: test::Multiprocess: exit cleanly from children with _exit() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | util/test/multiprocess_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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,
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 private: 157 private:
158 //! \brief Runs the parent side of the test. 158 //! \brief Runs the parent side of the test.
159 //! 159 //!
160 //! This method establishes the parent’s environment and calls 160 //! This method establishes the parent’s environment and calls
161 //! MultiprocessParent(). 161 //! MultiprocessParent().
162 void RunParent(); 162 void RunParent();
163 163
164 //! \brief Runs the child side of the test. 164 //! \brief Runs the child side of the test.
165 //! 165 //!
166 //! This method establishes the child’s environment, calls 166 //! This method establishes the child’s environment, calls
167 //! MultiprocessChild(), and exits cleanly. However, if any failure (via fatal 167 //! MultiprocessChild(), and exits cleanly by calling `_exit(0)`. However, if
168 //! or nonfatal gtest assertion) is detected, the child will exit with a 168 //! any failure (via fatal or nonfatal gtest assertion) is detected, the child
169 //! failure status. 169 //! will exit with a failure status.
170 void RunChild(); 170 void RunChild();
171 171
172 //! \brief The subclass-provided parent routine. 172 //! \brief The subclass-provided parent routine.
173 //! 173 //!
174 //! Test failures should be reported via gtest: `EXPECT_*()`, `ASSERT_*()`, 174 //! Test failures should be reported via gtest: `EXPECT_*()`, `ASSERT_*()`,
175 //! `FAIL()`, etc. 175 //! `FAIL()`, etc.
176 //! 176 //!
177 //! This method must not use a `wait()`-family system call to wait for the 177 //! This method must not use a `wait()`-family system call to wait for the
178 //! child process to exit, as this is handled by this class. 178 //! child process to exit, as this is handled by this class.
179 //! 179 //!
180 //! Subclasses must implement this method to define how the parent operates. 180 //! Subclasses must implement this method to define how the parent operates.
181 virtual void MultiprocessParent() = 0; 181 virtual void MultiprocessParent() = 0;
182 182
183 //! \brief The subclass-provided child routine. 183 //! \brief The subclass-provided child routine.
184 //! 184 //!
185 //! Test failures should be reported via gtest: `EXPECT_*()`, `ASSERT_*()`, 185 //! Test failures should be reported via gtest: `EXPECT_*()`, `ASSERT_*()`,
186 //! `FAIL()`, etc. 186 //! `FAIL()`, etc.
187 //! 187 //!
188 //! Subclasses must implement this method to define how the child operates. 188 //! Subclasses must implement this method to define how the child operates.
189 //! Subclasses may exit with a failure status by using `LOG(FATAL)`,
190 //! `abort()`, or similar. They may exit cleanly by returning from this method
191 //! or by calling `_exit(0)`. Under no circumstances may `exit()` be called
192 //! by the child without having the child process `exec()`. Use
193 //! MultiprocessExec if the child should call `exec()`.
189 virtual void MultiprocessChild() = 0; 194 virtual void MultiprocessChild() = 0;
190 195
191 internal::MultiprocessInfo* info_; 196 internal::MultiprocessInfo* info_;
192 int code_; 197 int code_;
193 TerminationReason reason_; 198 TerminationReason reason_;
194 199
195 DISALLOW_COPY_AND_ASSIGN(Multiprocess); 200 DISALLOW_COPY_AND_ASSIGN(Multiprocess);
196 }; 201 };
197 202
198 } // namespace test 203 } // namespace test
199 } // namespace crashpad 204 } // namespace crashpad
200 205
201 #endif // CRASHPAD_UTIL_TEST_MULTIPROCESS_H_ 206 #endif // CRASHPAD_UTIL_TEST_MULTIPROCESS_H_
OLDNEW
« no previous file with comments | « no previous file | util/test/multiprocess_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698