forked from microsoft/STL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Avoid dialog boxes, prevent stdout from being lost (microsoft#906
) Fixes microsoftGH-781 (dialogs) and fixes microsoftGH-789 (stdout).
- Loading branch information
1 parent
9e74913
commit 1a7d698
Showing
10 changed files
with
97 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#pragma once | ||
|
||
#ifndef NO_TEST_ENVIRONMENT_PREPARER | ||
|
||
#include <crtdbg.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
struct TestEnvironmentPreparer { | ||
TestEnvironmentPreparer() noexcept { | ||
// avoid assertion dialog boxes; see GH-781 | ||
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); | ||
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); | ||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); | ||
_CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); | ||
_set_abort_behavior(0, _CALL_REPORTFAULT); | ||
|
||
// set stdout to be unbuffered; see GH-789 | ||
setvbuf(stdout, nullptr, _IONBF, 0); | ||
} | ||
}; | ||
|
||
const TestEnvironmentPreparer test_environment_preparer{}; | ||
|
||
#endif // NO_TEST_ENVIRONMENT_PREPARER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.