mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-05 00:35:27 +08:00
qt 6.5.1 original
This commit is contained in:
17
tests/auto/network/socket/qtcpserver/BLACKLIST
Normal file
17
tests/auto/network/socket/qtcpserver/BLACKLIST
Normal file
@ -0,0 +1,17 @@
|
||||
[listenWhileListening:WithSocks5Proxy]
|
||||
linux
|
||||
windows
|
||||
[ipv6Server]
|
||||
windows-7sp1
|
||||
windows-10 msvc-2017
|
||||
[ipv6Server:WithoutProxy]
|
||||
windows
|
||||
osx
|
||||
[serverAddress]
|
||||
# QTBUG-103056
|
||||
qnx
|
||||
windows-7sp1
|
||||
windows-10
|
||||
|
||||
[linkLocal]
|
||||
macos arm
|
5
tests/auto/network/socket/qtcpserver/CMakeLists.txt
Normal file
5
tests/auto/network/socket/qtcpserver/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
add_subdirectory(crashingServer)
|
||||
add_subdirectory(test)
|
@ -0,0 +1,17 @@
|
||||
# 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
|
||||
LIBRARIES
|
||||
Qt::Network
|
||||
)
|
||||
|
||||
## Scopes:
|
||||
#####################################################################
|
58
tests/auto/network/socket/qtcpserver/crashingServer/main.cpp
Normal file
58
tests/auto/network/socket/qtcpserver/crashingServer/main.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
// Copyright (C) 2016 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
|
||||
#include <QtCore>
|
||||
#include <QtNetwork>
|
||||
#if defined(Q_OS_WIN) && defined(Q_CC_MSVC)
|
||||
# include <crtdbg.h>
|
||||
#endif
|
||||
#ifdef Q_OS_UNIX
|
||||
# include <sys/resource.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if defined(Q_OS_WIN) && defined(Q_CC_MSVC)
|
||||
// Windows: Suppress crash notification dialog.
|
||||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);
|
||||
#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
|
||||
|
||||
QCoreApplication app(argc, argv);
|
||||
if (argc < 1) {
|
||||
fprintf(stderr, "Need a port number\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int port = QByteArrayView(argv[1]).toInt();
|
||||
QTcpServer server;
|
||||
if (!server.listen(QHostAddress::LocalHost, port)) {
|
||||
fprintf(stderr, "Failed to listen: %s\n", server.errorString().toLatin1().constData());
|
||||
if (server.serverError() == QTcpSocket::AddressInUseError) {
|
||||
// let's see if we can find the process that would be holding this
|
||||
// still open
|
||||
#ifdef Q_OS_LINUX
|
||||
static const char *ss_args[] = {
|
||||
"ss", "-nap", "sport", "=", argv[1], nullptr
|
||||
};
|
||||
dup2(STDERR_FILENO, STDOUT_FILENO);
|
||||
execvp(ss_args[0], const_cast<char **>(ss_args));
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Listening\n");
|
||||
fflush(stdout);
|
||||
|
||||
server.waitForNewConnection(5000);
|
||||
qFatal("Crash");
|
||||
return 0;
|
||||
}
|
27
tests/auto/network/socket/qtcpserver/test/CMakeLists.txt
Normal file
27
tests/auto/network/socket/qtcpserver/test/CMakeLists.txt
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#####################################################################
|
||||
## tst_qtcpserver Test:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_add_test(tst_qtcpserver
|
||||
OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../"
|
||||
SOURCES
|
||||
../tst_qtcpserver.cpp
|
||||
LIBRARIES
|
||||
Qt::Network
|
||||
QT_TEST_SERVER_LIST "danted" "cyrus" "squid" "ftp-proxy"
|
||||
)
|
||||
|
||||
add_dependencies(tst_qtcpserver
|
||||
crashingServer
|
||||
)
|
||||
|
||||
## Scopes:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_extend_target(tst_qtcpserver CONDITION WIN32
|
||||
LIBRARIES
|
||||
ws2_32
|
||||
)
|
1151
tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
Normal file
1151
tests/auto/network/socket/qtcpserver/tst_qtcpserver.cpp
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user