- Timestamp:
- Aug 3, 2016 1:59:43 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/mangling.h
r62473 r62915 1981 1981 # define RTTestCreateEx RT_MANGLER(RTTestCreateEx) 1982 1982 # define RTTestDestroy RT_MANGLER(RTTestDestroy) 1983 # define RTTestDisableAssertions RT_MANGLER(RTTestDisableAssertions) 1983 1984 # define RTTestErrorCount RT_MANGLER(RTTestErrorCount) 1984 1985 # define RTTestErrorInc RT_MANGLER(RTTestErrorInc) … … 1991 1992 # define RTTestGuardedAllocTail RT_MANGLER(RTTestGuardedAllocTail) 1992 1993 # define RTTestGuardedFree RT_MANGLER(RTTestGuardedFree) 1994 # define RTTestIDisableAssertions RT_MANGLER(RTTestIDisableAssertions) 1993 1995 # define RTTestIErrorCount RT_MANGLER(RTTestIErrorCount) 1994 1996 # define RTTestIErrorInc RT_MANGLER(RTTestIErrorInc) … … 2005 2007 # define RTTestIPrintf RT_MANGLER(RTTestIPrintf) 2006 2008 # define RTTestIPrintfV RT_MANGLER(RTTestIPrintfV) 2009 # define RTTestIRestoreAssertions RT_MANGLER(RTTestIRestoreAssertions) 2007 2010 # define RTTestISub RT_MANGLER(RTTestISub) 2008 2011 # define RTTestISubDone RT_MANGLER(RTTestISubDone) … … 2018 2021 # define RTTestPrintfNlV RT_MANGLER(RTTestPrintfNlV) 2019 2022 # define RTTestPrintfV RT_MANGLER(RTTestPrintfV) 2023 # define RTTestRestoreAssertions RT_MANGLER(RTTestRestoreAssertions) 2020 2024 # define RTTestSetDefault RT_MANGLER(RTTestSetDefault) 2021 2025 # define RTTestSkipAndDestroy RT_MANGLER(RTTestSkipAndDestroy) -
trunk/include/iprt/test.h
r62473 r62915 636 636 RTR3DECL(int) RTTestFailureDetails(RTTEST hTest, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3); 637 637 638 /** 639 * Disables and shuts up assertions. 640 * 641 * Max 8 nestings. 642 * 643 * @returns IPRT status code. 644 * @param hTest The test handle. If NIL_RTTEST we'll use the one 645 * associated with the calling thread. 646 * @sa RTAssertSetMayPanic, RTAssertSetQuiet. 647 */ 648 RTR3DECL(int) RTTestDisableAssertions(RTTEST hTest); 649 650 /** 651 * Restores the previous call to RTTestDisableAssertions. 652 * 653 * @returns IPRT status code. 654 * @param hTest The test handle. If NIL_RTTEST we'll use the one 655 * associated with the calling thread. 656 */ 657 RTR3DECL(int) RTTestRestoreAssertions(RTTEST hTest); 658 638 659 639 660 /** @def RTTEST_CHECK … … 1092 1113 */ 1093 1114 RTR3DECL(int) RTTestIFailureDetails(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2); 1115 1116 /** 1117 * Disables and shuts up assertions. 1118 * 1119 * Max 8 nestings. 1120 * 1121 * @returns IPRT status code. 1122 * @sa RTAssertSetMayPanic, RTAssertSetQuiet. 1123 */ 1124 RTR3DECL(int) RTTestIDisableAssertions(void); 1125 1126 /** 1127 * Restores the previous call to RTTestDisableAssertions. 1128 * 1129 * @returns IPRT status code. 1130 */ 1131 RTR3DECL(int) RTTestIRestoreAssertions(void); 1094 1132 1095 1133 -
trunk/src/VBox/Runtime/r3/test.cpp
r62477 r62915 145 145 /** XML element stack. */ 146 146 const char *apszXmlElements[10]; 147 148 /** Number of times assertions has been disabled and quieted. */ 149 uint32_t volatile cAssertionsDisabledAndQuieted; 150 /** Saved RTAssertSetQuiet return code. */ 151 bool fAssertSavedQuiet; 152 /** Saved RTAssertSetMayPanic return code. */ 153 bool fAssertSavedMayPanic; 147 154 } RTTESTINT; 148 155 /** Pointer to a test instance. */ … … 269 276 pTest->hXmlFile = NIL_RTFILE; 270 277 pTest->cXmlElements = 0; 278 pTest->cAssertionsDisabledAndQuieted = 0; 279 pTest->fAssertSavedMayPanic = true; 280 pTest->fAssertSavedQuiet = false; 271 281 272 282 rc = RTCritSectInit(&pTest->Lock); … … 1761 1771 } 1762 1772 1773 1774 RTR3DECL(int) RTTestDisableAssertions(RTTEST hTest) 1775 { 1776 PRTTESTINT pTest = hTest; 1777 RTTEST_GET_VALID_RETURN(pTest); 1778 1779 uint32_t cTimes = ASMAtomicIncU32(&pTest->cAssertionsDisabledAndQuieted); 1780 if (cTimes >= 2 && cTimes <= 8) 1781 return VINF_SUCCESS; 1782 if (cTimes > 8) 1783 { 1784 RTAssertSetMayPanic(pTest->fAssertSavedMayPanic); 1785 RTAssertSetQuiet(pTest->fAssertSavedQuiet); 1786 Assert(cTimes <= 8); 1787 } 1788 pTest->fAssertSavedMayPanic = RTAssertSetMayPanic(false); 1789 pTest->fAssertSavedQuiet = RTAssertSetQuiet(true); 1790 return VINF_SUCCESS; 1791 } 1792 1793 1794 RTR3DECL(int) RTTestRestoreAssertions(RTTEST hTest) 1795 { 1796 PRTTESTINT pTest = hTest; 1797 RTTEST_GET_VALID_RETURN(pTest); 1798 1799 uint32_t cTimes = ASMAtomicDecU32(&pTest->cAssertionsDisabledAndQuieted); 1800 if (cTimes == 0) 1801 { 1802 RTAssertSetMayPanic(pTest->fAssertSavedMayPanic); 1803 RTAssertSetQuiet(pTest->fAssertSavedQuiet); 1804 } 1805 else 1806 AssertStmt(cTimes < UINT32_MAX / 2, ASMAtomicIncU32(&pTest->cAssertionsDisabledAndQuieted)); 1807 return VINF_SUCCESS; 1808 } 1809 -
trunk/src/VBox/Runtime/r3/testi.cpp
r62477 r62915 175 175 } 176 176 177 178 RTR3DECL(int) RTTestIDisableAssertions(void) 179 { 180 return RTTestDisableAssertions(NIL_RTTEST); 181 } 182 183 184 RTR3DECL(int) RTTestIRestoreAssertions(void) 185 { 186 return RTTestRestoreAssertions(NIL_RTTEST); 187 } 188
Note:
See TracChangeset
for help on using the changeset viewer.