crashpad/doc/generated/doxygen/gtest__death_8h.html
2018-08-01 13:34:49 -04:00

242 lines
19 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Crashpad: test/gtest_death.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="crashpad_doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Crashpad
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_13e138d54eb8818da29c3992edef070a.html">test</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> </div>
<div class="headertitle">
<div class="title">gtest_death.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;base/logging.h&quot;</code><br />
<code>#include &quot;build/build_config.h&quot;</code><br />
<code>#include &quot;gtest/gtest.h&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a415e40b4d538d7421e1b0a43ddd3f83e"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gtest__death_8h.html#a415e40b4d538d7421e1b0a43ddd3f83e">ASSERT_DEATH_CRASH</a>(statement, regex)</td></tr>
<tr class="memdesc:a415e40b4d538d7421e1b0a43ddd3f83e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wraps the gtest <code>ASSERT_DEATH_IF_SUPPORTED()</code> macro to make assertions about death caused by crashes. <a href="#a415e40b4d538d7421e1b0a43ddd3f83e">More...</a><br /></td></tr>
<tr class="separator:a415e40b4d538d7421e1b0a43ddd3f83e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a496cb27779b2120a1854e81375e9ae5f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gtest__death_8h.html#a496cb27779b2120a1854e81375e9ae5f">EXPECT_DEATH_CRASH</a>(statement, regex)</td></tr>
<tr class="memdesc:a496cb27779b2120a1854e81375e9ae5f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wraps the gtest <code>EXPECT_DEATH_IF_SUPPORTED()</code> macro to make assertions about death caused by crashes. <a href="#a496cb27779b2120a1854e81375e9ae5f">More...</a><br /></td></tr>
<tr class="separator:a496cb27779b2120a1854e81375e9ae5f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a11ab1a718cd7a7ed56b7e2fbd2c36f74"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gtest__death_8h.html#a11ab1a718cd7a7ed56b7e2fbd2c36f74">ASSERT_DEATH_CHECK</a>(statement, regex)&#160;&#160;&#160;<a class="el" href="gtest__death_8h.html#a415e40b4d538d7421e1b0a43ddd3f83e">ASSERT_DEATH_CRASH</a>(statement, regex)</td></tr>
<tr class="memdesc:a11ab1a718cd7a7ed56b7e2fbd2c36f74"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wraps the <a class="el" href="gtest__death_8h.html#a415e40b4d538d7421e1b0a43ddd3f83e" title="Wraps the gtest ASSERT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">ASSERT_DEATH_CRASH()</a> macro to make assertions about death caused by <code>CHECK()</code> failures. <a href="#a11ab1a718cd7a7ed56b7e2fbd2c36f74">More...</a><br /></td></tr>
<tr class="separator:a11ab1a718cd7a7ed56b7e2fbd2c36f74"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa4bd7e1dbfc8862448a4b0fb66790e50"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="gtest__death_8h.html#aa4bd7e1dbfc8862448a4b0fb66790e50">EXPECT_DEATH_CHECK</a>(statement, regex)&#160;&#160;&#160;<a class="el" href="gtest__death_8h.html#a496cb27779b2120a1854e81375e9ae5f">EXPECT_DEATH_CRASH</a>(statement, regex)</td></tr>
<tr class="memdesc:aa4bd7e1dbfc8862448a4b0fb66790e50"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wraps the <a class="el" href="gtest__death_8h.html#a496cb27779b2120a1854e81375e9ae5f" title="Wraps the gtest EXPECT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">EXPECT_DEATH_CRASH()</a> macro to make assertions about death caused by <code>CHECK()</code> failures. <a href="#aa4bd7e1dbfc8862448a4b0fb66790e50">More...</a><br /></td></tr>
<tr class="separator:aa4bd7e1dbfc8862448a4b0fb66790e50"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a11ab1a718cd7a7ed56b7e2fbd2c36f74"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a11ab1a718cd7a7ed56b7e2fbd2c36f74">&#9670;&nbsp;</a></span>ASSERT_DEATH_CHECK</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define ASSERT_DEATH_CHECK</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">statement, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">regex&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td>&#160;&#160;&#160;<a class="el" href="gtest__death_8h.html#a415e40b4d538d7421e1b0a43ddd3f83e">ASSERT_DEATH_CRASH</a>(statement, regex)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Wraps the <a class="el" href="gtest__death_8h.html#a415e40b4d538d7421e1b0a43ddd3f83e" title="Wraps the gtest ASSERT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">ASSERT_DEATH_CRASH()</a> macro to make assertions about death caused by <code>CHECK()</code> failures. </p>
<p>In an in-Chromium build in the official configuration, <code>CHECK()</code> does not print its condition or streamed messages. In that case, this macro uses an empty <em>regex</em> pattern when calling <a class="el" href="gtest__death_8h.html#a415e40b4d538d7421e1b0a43ddd3f83e" title="Wraps the gtest ASSERT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">ASSERT_DEATH_CRASH()</a> to avoid looking for any particular output on the standard error stream. In other build configurations, the <em>regex</em> pattern is left intact.</p>
<p>On macOS, <code>CHECK()</code> failures normally show up as crashes to the systems crash reporter, but it is undesirable for intentional <a class="el" href="gtest__death_8h.html#a11ab1a718cd7a7ed56b7e2fbd2c36f74" title="Wraps the ASSERT_DEATH_CRASH() macro to make assertions about death caused by CHECK() failures...">ASSERT_DEATH_CHECK()</a> crashes to be handled by any crash reporter, so this is implemented in terms of <a class="el" href="gtest__death_8h.html#a415e40b4d538d7421e1b0a43ddd3f83e" title="Wraps the gtest ASSERT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">ASSERT_DEATH_CRASH()</a> instead of <code>ASSERT_DEATH()</code>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="gtest__death_8h.html#aa4bd7e1dbfc8862448a4b0fb66790e50" title="Wraps the EXPECT_DEATH_CRASH() macro to make assertions about death caused by CHECK() failures...">EXPECT_DEATH_CHECK()</a> </dd></dl>
</div>
</div>
<a id="a415e40b4d538d7421e1b0a43ddd3f83e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a415e40b4d538d7421e1b0a43ddd3f83e">&#9670;&nbsp;</a></span>ASSERT_DEATH_CRASH</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define ASSERT_DEATH_CRASH</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">statement, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">regex&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"><span class="keywordflow">do</span> { \</div><div class="line"> crashpad::test::ExceptionSwallower exception_swallower; \</div><div class="line"> ASSERT_DEATH_IF_SUPPORTED( \</div><div class="line"> <a class="code" href="classcrashpad_1_1test_1_1ExceptionSwallower.html#af7fdf8f0dca2bb2a34397d58283d3676">crashpad::test::ExceptionSwallower::SwallowExceptions</a>(); \</div><div class="line"> { statement; }, regex); \</div><div class="line"> } <span class="keywordflow">while</span> (<span class="keyword">false</span>)</div><div class="ttc" id="classcrashpad_1_1test_1_1ExceptionSwallower_html_af7fdf8f0dca2bb2a34397d58283d3676"><div class="ttname"><a href="classcrashpad_1_1test_1_1ExceptionSwallower.html#af7fdf8f0dca2bb2a34397d58283d3676">crashpad::test::ExceptionSwallower::SwallowExceptions</a></div><div class="ttdeci">static void SwallowExceptions()</div><div class="ttdoc">In a test child process, arranges to swallow EXC_CRASH and EXC_CORPSE_NOTIFY exceptions. </div><div class="ttdef"><b>Definition:</b> exception_swallower.cc:152</div></div>
</div><!-- fragment -->
<p>Wraps the gtest <code>ASSERT_DEATH_IF_SUPPORTED()</code> macro to make assertions about death caused by crashes. </p>
<p>On macOS, this macro prevents the systems crash reporter from handling crashes that occur in <em>statement</em>. Crashes are normally visible to the systems crash reporter, but it is undesirable for intentional <a class="el" href="gtest__death_8h.html#a415e40b4d538d7421e1b0a43ddd3f83e" title="Wraps the gtest ASSERT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">ASSERT_DEATH_CRASH()</a> crashes to be handled by any crash reporter.</p>
<p><code>ASSERT_DEATH_IF_SUPPORTED()</code> is used instead of <code>ASSERT_DEATH()</code> to support platforms where death tests are not implemented by gtest (e.g. Fuchsia). On platforms where death tests are not implemented, a warning will be logged and the remainder of the test body skipped.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="gtest__death_8h.html#a11ab1a718cd7a7ed56b7e2fbd2c36f74" title="Wraps the ASSERT_DEATH_CRASH() macro to make assertions about death caused by CHECK() failures...">ASSERT_DEATH_CHECK()</a> </dd>
<dd>
<a class="el" href="gtest__death_8h.html#a496cb27779b2120a1854e81375e9ae5f" title="Wraps the gtest EXPECT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">EXPECT_DEATH_CRASH()</a> </dd></dl>
</div>
</div>
<a id="aa4bd7e1dbfc8862448a4b0fb66790e50"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa4bd7e1dbfc8862448a4b0fb66790e50">&#9670;&nbsp;</a></span>EXPECT_DEATH_CHECK</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define EXPECT_DEATH_CHECK</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">statement, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">regex&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td>&#160;&#160;&#160;<a class="el" href="gtest__death_8h.html#a496cb27779b2120a1854e81375e9ae5f">EXPECT_DEATH_CRASH</a>(statement, regex)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Wraps the <a class="el" href="gtest__death_8h.html#a496cb27779b2120a1854e81375e9ae5f" title="Wraps the gtest EXPECT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">EXPECT_DEATH_CRASH()</a> macro to make assertions about death caused by <code>CHECK()</code> failures. </p>
<p>In an in-Chromium build in the official configuration, <code>CHECK()</code> does not print its condition or streamed messages. In that case, this macro uses an empty <em>regex</em> pattern when calling <a class="el" href="gtest__death_8h.html#a496cb27779b2120a1854e81375e9ae5f" title="Wraps the gtest EXPECT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">EXPECT_DEATH_CRASH()</a> to avoid looking for any particular output on the standard error stream. In other build configurations, the <em>regex</em> pattern is left intact.</p>
<p>On macOS, <code>CHECK()</code> failures normally show up as crashes to the systems crash reporter, but it is undesirable for intentional <a class="el" href="gtest__death_8h.html#aa4bd7e1dbfc8862448a4b0fb66790e50" title="Wraps the EXPECT_DEATH_CRASH() macro to make assertions about death caused by CHECK() failures...">EXPECT_DEATH_CHECK()</a> crashes to be handled by any crash reporter, so this is implemented in terms of <a class="el" href="gtest__death_8h.html#a496cb27779b2120a1854e81375e9ae5f" title="Wraps the gtest EXPECT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">EXPECT_DEATH_CRASH()</a> instead of <code>EXPECT_DEATH()</code>.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="gtest__death_8h.html#a11ab1a718cd7a7ed56b7e2fbd2c36f74" title="Wraps the ASSERT_DEATH_CRASH() macro to make assertions about death caused by CHECK() failures...">ASSERT_DEATH_CHECK()</a> </dd></dl>
</div>
</div>
<a id="a496cb27779b2120a1854e81375e9ae5f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a496cb27779b2120a1854e81375e9ae5f">&#9670;&nbsp;</a></span>EXPECT_DEATH_CRASH</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define EXPECT_DEATH_CRASH</td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname">statement, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname">regex&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line"><span class="keywordflow">do</span> { \</div><div class="line"> crashpad::test::ExceptionSwallower exception_swallower; \</div><div class="line"> EXPECT_DEATH(<a class="code" href="classcrashpad_1_1test_1_1ExceptionSwallower.html#af7fdf8f0dca2bb2a34397d58283d3676">crashpad::test::ExceptionSwallower::SwallowExceptions</a>(); \</div><div class="line"> { statement; }, \</div><div class="line"> regex); \</div><div class="line"> } <span class="keywordflow">while</span> (<span class="keyword">false</span>)</div><div class="ttc" id="classcrashpad_1_1test_1_1ExceptionSwallower_html_af7fdf8f0dca2bb2a34397d58283d3676"><div class="ttname"><a href="classcrashpad_1_1test_1_1ExceptionSwallower.html#af7fdf8f0dca2bb2a34397d58283d3676">crashpad::test::ExceptionSwallower::SwallowExceptions</a></div><div class="ttdeci">static void SwallowExceptions()</div><div class="ttdoc">In a test child process, arranges to swallow EXC_CRASH and EXC_CORPSE_NOTIFY exceptions. </div><div class="ttdef"><b>Definition:</b> exception_swallower.cc:152</div></div>
</div><!-- fragment -->
<p>Wraps the gtest <code>EXPECT_DEATH_IF_SUPPORTED()</code> macro to make assertions about death caused by crashes. </p>
<p>On macOS, this macro prevents the systems crash reporter from handling crashes that occur in <em>statement</em>. Crashes are normally visible to the systems crash reporter, but it is undesirable for intentional <a class="el" href="gtest__death_8h.html#a496cb27779b2120a1854e81375e9ae5f" title="Wraps the gtest EXPECT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">EXPECT_DEATH_CRASH()</a> crashes to be handled by any crash reporter.</p>
<p><code>EXPECT_DEATH_IF_SUPPORTED()</code> is used instead of <code>EXPECT_DEATH()</code> to support platforms where death tests are not implemented by gtest (e.g. Fuchsia). On platforms where death tests are not implemented, a warning will be logged and the remainder of the test body skipped.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="gtest__death_8h.html#aa4bd7e1dbfc8862448a4b0fb66790e50" title="Wraps the EXPECT_DEATH_CRASH() macro to make assertions about death caused by CHECK() failures...">EXPECT_DEATH_CHECK()</a> </dd>
<dd>
<a class="el" href="gtest__death_8h.html#a415e40b4d538d7421e1b0a43ddd3f83e" title="Wraps the gtest ASSERT_DEATH_IF_SUPPORTED() macro to make assertions about death caused by crashes...">ASSERT_DEATH_CRASH()</a> </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>