Skip to content

Commit 3aa0339

Browse files
authored
Generate test failure output on abnormal termination (#1011)
1 parent 0a0062a commit 3aa0339

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*.c
88
*.nupkg
99
test*.xml
10+
test*_results.txt
1011
build
1112
packages
1213
Debug

run_tests.cmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ goto :eof
2020

2121
:run_test
2222
if not "%target_version%"=="" set args=-o %1-%target_version%.xml -r junit
23-
_build\%target_platform%\%target_configuration%\%1.exe %args%
23+
rem Buffer output and redirect to stdout/stderr depending whether the test executable exits successfully. Pipeline will fail if there's any output to stderr.
24+
_build\%target_platform%\%target_configuration%\%1.exe %args% > %1_results.txt && type %1_results.txt || type %1_results.txt >&2
2425
goto :eof

test/old_tests/UnitTests/Main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ int main(int argc, char * argv[])
88
using namespace winrt;
99

1010
init_apartment();
11-
std::set_terminate([]{ ExitProcess(1); });
11+
std::set_terminate([]{ reportFatal("Abnormal termination"); ExitProcess(1); });
1212
int const result = Catch::Session().run(argc, argv);
1313

1414
// Completely unnecessary in an app, but useful for testing clear_factory_cache behavior.

test/test/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using namespace winrt;
77
int main(int const argc, char** argv)
88
{
99
init_apartment();
10-
std::set_terminate([] { ExitProcess(1); });
10+
std::set_terminate([] { reportFatal("Abnormal termination"); ExitProcess(1); });
1111
return Catch::Session().run(argc, argv);
1212
}
1313

test/test_win7/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using namespace winrt;
77
int main(int const argc, char** argv)
88
{
99
init_apartment();
10-
std::set_terminate([] { ExitProcess(1); });
10+
std::set_terminate([] { reportFatal("Abnormal termination"); ExitProcess(1); });
1111
return Catch::Session().run(argc, argv);
1212
}
1313

0 commit comments

Comments
 (0)