Bug 1316437 - Convert TestSTLWrappers to a gtest. r=bsmedberg

MozReview-Commit-ID: HRmnWvxyNP

--HG--
rename : xpcom/tests/TestSTLWrappers.cpp => xpcom/tests/gtest/TestSTLWrappers.cpp
This commit is contained in:
Eric Rahm 2016-11-10 13:04:06 -08:00
Родитель 59b65be14f
Коммит a79e2262d5
3 изменённых файлов: 41 добавлений и 8 удалений

Просмотреть файл

@ -10,6 +10,12 @@
# error "failed to wrap <vector>"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsCOMPtr.h"
#include "nsICrashReporter.h"
#include "nsServiceManagerUtils.h"
#endif
// gcc errors out if we |try ... catch| with -fno-exceptions, but we
// can still test on windows
#ifdef _MSC_VER
@ -23,7 +29,25 @@
# define CATCH(e) if (0)
#endif
int main() {
#if defined(XP_UNIX)
extern unsigned int _gdb_sleep_duration;
#endif
void ShouldAbort()
{
#if defined(XP_UNIX)
_gdb_sleep_duration = 0;
#endif
#ifdef MOZ_CRASHREPORTER
nsCOMPtr<nsICrashReporter> crashreporter =
do_GetService("@mozilla.org/toolkit/crash-reporter;1");
if (crashreporter) {
crashreporter->SetEnabled(false);
}
#endif
std::vector<int> v;
int rv = 1;
@ -36,10 +60,19 @@ int main() {
} CATCH(const std::out_of_range&) {
fputs("TEST-FAIL | TestSTLWrappers.cpp | caught an exception?\n",
stderr);
return 1;
return;
}
fputs("TEST-FAIL | TestSTLWrappers.cpp | didn't abort()?\n",
stderr);
return rv;
return;
}
#ifdef XP_WIN
TEST(STLWrapper, DISABLED_ShouldAbortDeathTest)
#else
TEST(STLWrapper, ShouldAbortDeathTest)
#endif
{
ASSERT_DEATH(ShouldAbort(), "terminate called after throwing an instance of 'std::out_of_range'|vector::_M_range_check");
}

Просмотреть файл

@ -56,6 +56,11 @@ if CONFIG['MOZ_DEBUG'] and CONFIG['OS_ARCH'] not in ('WINNT') and CONFIG['OS_TAR
'TestDeadlockDetectorScalability.cpp',
]
if CONFIG['WRAP_STL_INCLUDES'] and not CONFIG['CLANG_CL']:
UNIFIED_SOURCES += [
'TestSTLWrappers.cpp',
]
# Compile TestAllocReplacement separately so Windows headers don't pollute
# the global namespace for other files.
SOURCES += [

Просмотреть файл

@ -27,11 +27,6 @@ SimplePrograms([
'TestUnicodeArguments',
])
if CONFIG['WRAP_STL_INCLUDES'] and not CONFIG['CLANG_CL']:
GeckoSimplePrograms([
'TestSTLWrappers',
])
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
# FIXME: bug 577500 TestStaticAtoms fails when run in dist/bin