-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
De-duplicate the disabling of crash dialogs in our unit tests
The code was duplicated in multiple places. Pick-to: 6.5 6.8 6.9 Change-Id: If2ab30b7afbf6d2f99c9fffd999218802b734d5e Reviewed-by: Ahmad Samir <[email protected]>
- Loading branch information
1 parent
bec4914
commit b119fee
Showing
11 changed files
with
64 additions
and
83 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
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
7 changes: 1 addition & 6 deletions
7
tests/auto/network/socket/qtcpserver/crashingServer/CMakeLists.txt
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 |
---|---|---|
@@ -1,17 +1,12 @@ | ||
# Copyright (C) 2022 The Qt Company Ltd. | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
##################################################################### | ||
## crashingServer Binary: | ||
##################################################################### | ||
|
||
qt_internal_add_executable(crashingServer | ||
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" | ||
SOURCES | ||
main.cpp | ||
../../../../../shared/disablecoredumps.cpp | ||
LIBRARIES | ||
Qt::Network | ||
) | ||
|
||
## Scopes: | ||
##################################################################### |
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
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,41 @@ | ||
// Copyright (C) 2025 Intel Corporation. | ||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only | ||
|
||
// This file is added to some test helpers that don't link to Qt, so don't | ||
// use Qt #includes here. | ||
|
||
#ifdef _WIN32 | ||
# include <windows.h> | ||
#else | ||
# include <unistd.h> | ||
#endif | ||
#if __has_include(<sys/resource.h>) | ||
# include <sys/resource.h> | ||
#endif | ||
#ifdef _MSC_VER | ||
# include <crtdbg.h> | ||
#endif | ||
|
||
static void disableCoreDumps() | ||
{ | ||
#ifdef _WIN32 | ||
// Windows: suppress the OS error dialog box. | ||
SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); | ||
# ifdef _MSC_VER | ||
// MSVC: Suppress runtime's crash notification dialog. | ||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG); | ||
# endif | ||
#elif defined(RLIMIT_CORE) | ||
// Unix: set our core dump limit to zero to request no dialogs. | ||
if (struct rlimit rlim; getrlimit(RLIMIT_CORE, &rlim) == 0) { | ||
rlim.rlim_cur = 0; | ||
setrlimit(RLIMIT_CORE, &rlim); | ||
} | ||
#endif | ||
} | ||
|
||
struct DisableCoreDumps | ||
{ | ||
DisableCoreDumps() { disableCoreDumps(); } | ||
}; | ||
[[maybe_unused]] DisableCoreDumps disableCoreDumpsConstructorFunction; |