Commit Graph

986 Commits

Author SHA1 Message Date
Mårten Nordheim
d53b8b77bc tst_qsslsocket: fix racy test
In this threaded setup the server can sometimes have the data before it
calls "waitForReadyRead", what happens then is that we fail the wait and
as a result the test fails overall.

Let's check if we actually got some data after all and then continue if
we did. Since both the client and the server currently wait the same
amount of time (2s) the max timeout for the client was increased by
0.5s so it has some time to notice that the server got the message.

Change-Id: Ib5915958853413047aa5a7574712585bcae28f79
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit e79b1dcdf5)
Reviewed-by: Simo Fält <simo.falt@qt.io>
2019-06-12 11:24:08 +00:00
Timur Pocheptsov
8c87a1402c tst_qnetworkreply - QSKIP/disable tests that deadlock on Windows
We use global object to store errors found by q_X509Callback.
Thus, we also use a lock/mutex. It would appear all tests
involving in-process server and QNAM are prone to intermittent
failures on our Windows VMs - it's always about timeouts due
to the client socket (QNAM) locking and the server socket blocking
main thread while trying to acquire the same lock.

The real fix is to get rid of global variable/locking, we'll
have it later (quite a change and requires a lot of accuracy).

Task-number: QTBUG-76247
Change-Id: Iffc90d9e16783f17f62e836e01c35f22681bdd39
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
 (cherry picked from commit 91ab70d17f)
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2019-06-12 13:52:14 +00:00
Timur Pocheptsov
4b445481c3 tst_http2 - extend 'singleRequest' test case
to test different h2 modes: "h2c" (clear text with protocol upgrade),
"h2" (encrypted, negotiating via ALPN extension), "h2-direct" (encrypted,
no ALPN), "h2c-direct" (plain text, no protocol upgrade). This patch-set
is  an amendment to the recent fix in the protocol handler where we were
crashing in "h2c-direct" mode.

Change-Id: I3ff5ed1396a59b72b59a95f927d404ccd202d0b8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-04-09 04:08:01 +00:00
Volker Hilsheimer
7935d86e7d Populate test data for reverse lookups using system tools
Hardcoding IP addresses and their respective DNS records is fragile.
We care about Qt producing the same result as other DNS querying tools,
so testing that instead.

Running a python script for this is easiest, and assumed to be quite
reliable.

In case where python fails/is not present, fall back to nslookup.
That tool is available on Linux, macOS, and Windows, although the
output it produces varies. This change implements very basic
line-parsing that can interpret the various results encountered
during testing on those platforms.

This also reverts commit bbaceff253fae13d8e56691bc9de7e1981db5118,
which blacklisted the tests that failed due to changes in DNS
records.

Use the opportunity to replace usage of gitorious.org.

Change-Id: I967de226bd603c805df7fe3ed4e871d92d2d0750
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-04-05 05:50:18 +00:00
Volker Hilsheimer
743e883c12 Blacklist the reverse lookup of 8.8.8.8 to unblock integrations
The DNS entry for the host has changed, dig answers with dns.google,
not with google-public-dns-a.google.com. While developing a proper
fix to the test, blacklisting this particular lookup allows
integrations to pass in the meantime.

Change-Id: Id37da6b24554803bf4e2c84be5b949ded40566e8
Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-03-29 13:45:47 +00:00
Mårten Nordheim
9e61cec791 Network cache: Stop treating no-cache like no-store
In the QNetworkAccessManager machinery we would treat "no-cache" as if
it meant "don't cache" while in reality it means "don't return these
cached elements without making sure they're up-to-date"

At the same time as this change is made let's add test data for
"no-store", which replaces the "no-cache" test data.

Fixes: QTBUG-71896
Change-Id: Ieda98f3982884ccc839cac2420c777968c786f6e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
2019-03-22 13:25:54 +00:00
Tony Sarajärvi
912bcf0f0d Expand blacklisting of tst_qsslkey to cover all versions of RHELs
Previous blacklisting 5c4e5032b5 only
covered RHEL 6.6 and RHEL 7.4. The problem however exists in all
6.x and 7.x distros as they have the same openssl.

This however leaves us the problem with future RHEL 8. This will
keep blacklisting these tests there as well. We need a way to blacklist
versions with a wildcard so that we could say RHEL-7.*

Task-number: QTBUG-46203
Change-Id: I2cc52ba2eac949214ecaa02e19d9e623d5befc49
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2019-03-10 14:08:21 +00:00
Timur Pocheptsov
ef5aefb062 Hpack - fix the static lookup
'accept' breaks the order, making the static table unsorted and thus
std::lower_bound cannot find it and we always index it in a dynamic
table. Also, make this static table accessible to auto-test.
Plus fix some warnings quite annoyingly visible in qt-creator.

Fixes: QTBUG-74161
Change-Id: I47410f2ef974ac92797c9804aa55cb5c36a436c4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-03-04 16:18:14 +00:00
Timur Pocheptsov
d3eb9e944a Make tst_QUdpSocket::lincLocalIPv6 less sadistic
It fails on CI (Windows 10). Given our qabstractsocket disables
read notifications/stops emitting readyRead if it already has pending data
(unbuffered, aka UDP socket type) - make sure we do not suffer from this.
The change does not affect the test's logic (unless the logic was to fail),
it just makes it more fail-proof.

Change-Id: I6c9b7ded20478f675260872a2a7032b4f356f197
Fixes: QTBUG-73884
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2019-02-21 11:14:48 +00:00
Timur Pocheptsov
3a1a97dabe tst_http2::earlyResponse - fix a flaky and somewhat broken test
1. Fix erroneous logic, which was triggered in 'h2' mode (non-TLS connection)
- after the initial protocol upgrade/POST request was handled, the server
(on Windows specifically) was erroneously handling upcoming DATA frames by replying
with another redirect response.
2. Make the test less heavy by sending 1 MB of Qt::Uninitialize instead of 10 MB
- theoretically this could cause a timeout before the redirected request finished
successfully.

Task-number: QTBUG-73873
Change-Id: I961e0a5f50252988edd46d0e73baf96ee22eef3f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-02-20 08:43:48 +00:00
Joerg Bornemann
8fe3680193 Add cmdline feature to qmake
[ChangeLog][qmake] A new feature "cmdline" was added that implies
"CONFIG += console" and "CONFIG -= app_bundle".

Task-number: QTBUG-27079
Change-Id: I6e52b07c9341c904bb1424fc717057432f9360e1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2019-02-18 07:12:14 +00:00
Timur Pocheptsov
a90a238b49 tst_qsslsocket - blacklist several test temporarily
For some reason behavior of SecureTransport has changed from 10.12 to 10.13
and then to 10.14. On 10.13 SecureTransport fails upon receiving the server's
certificate with 'Unrecoverable error', before we can do a manual verification
and accept the certificate as trusted. Analysis of available source code
shows that they, apparently, do not like MD5 hash which our server is using.
Until certificate is updated on the server or we switch completely to
the Docker-based solution we have to BLACKLIST tests that connect to our
current network test-server. Oddly enough, on 10.14 SecureTransport is
less mean.

Task-number: QTBUG-69873
Change-Id: I7da1883e0970a2f6ddd8385f193b76116d6983e0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2019-01-24 20:38:14 +00:00
Qt Forward Merge Bot
1b5bbacdb0 Merge remote-tracking branch 'origin/5.11' into 5.12
Change-Id: I12bcee17e349edd0dd4fd08da76361d1ffb1a727
2018-11-27 01:00:09 +01:00
Sami Nurmenniemi
71bd06d516 Make developer build tests pass for boot2qt
Some tests were fixed and others were skipped/blacklisted.

Task-number: QTBUG-63152
Change-Id: Ica7df555f8d152ee589865911130525101d4b941
Reviewed-by: Liang Qi <liang.qi@qt.io>
2018-11-26 07:06:59 +00:00
Liang Qi
41cba737a9 Merge remote-tracking branch 'origin/5.11' into 5.12
Change-Id: I909c9cfa0ce80f512de4b4986e626eae66b63afa
2018-11-21 19:34:18 +01:00
Liang Qi
46076f7333 tst_QNetworkReply: Blacklist getFromHttp:success-external
Task-number: QTBUG-71953
Change-Id: I449ee3be8fa748046895386c9cbff90b30ed80c4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-11-21 16:02:52 +00:00
Liang Qi
37d3bc9ad7 Merge remote-tracking branch 'origin/5.12.0' into 5.12
Change-Id: Ic1dd39044e19f50e1068d4ac70dacaad6440e570
2018-11-16 08:10:15 +01:00
Timur Pocheptsov
d786c55b9e Make tst_qsslsocket::protocolServerSide() less flaky
By accident, when we erroneously tried testing TlsV1_3 on macOS with
SecureTransport (which does not support TLS 1.3) we hit this quite
subtle problem: it can happen that a server-side socket is never
created but a client (after TCP connection was established) fails
in TLS initialization and ... stops the loop preventing
SslServer::incomingConnection() from creating its socket. Then we
dereference nullptr.

Task-number: QTBUG-71638
Change-Id: I8dc5a4c53022a25aafe2c80a6931087517a48441
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-11-07 12:25:12 +00:00
Timur Pocheptsov
b3ae87fe76 Add missing protocol enumerators, report TLS 1.3 if negotiated
1. Remove the conditional inclusion of DTLS versions, they made difficult
and unnecessary ugly adding new protocols (something like TlsV1_2OrLater + 4).

2. OpenSSL 1.1.1 first introduced TLS 1.3 support. OpenSSL 1.1 back-end is
compatible with OpenSSL 1.1.1, but would fail to extract/report protocol
versions and set versions like 'TLS 1.3 only' or 'TLS 1.3 or better' on a
new context.  Given 1.1.1 is deployed/adapted fast by different distros,
and 5.12 is LTS, we fix this issue by introducing QSsl::Tls1_3 and
QSsl::Tls1_3OrLater.

SecureTransport, WinRT and OpenSSL below 1.1.1 will report an error in case
the application requests this protocol (SecureTransport in future will
probably enable TLS 1.3).

Saying all that, TLS 1.3 support is experimental in QSslSocket.

Done-by: Albert Astals Cid <albert.astals.cid@kdab.com>
Done-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Change-Id: I4a97cc789b62763763cf41c44157ef0a9fd6cbec
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2018-11-07 10:32:35 +00:00
Timur Pocheptsov
321f11db53 tst_QLocalSocket::processConnections: remove QSKIP
on macOS, the test seems to be stable nowadays.

Task-number: QTBUG-39986
Change-Id: I18430c3feb27a5bee5474e1eb95f7d89b25f00a9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-10-25 11:51:48 +00:00
Allan Sandfeld Jensen
25830cf912 Fix builds without DTLS
Change-Id: Ic7215c7aa0bf6f7b37ae34649d809f2e1e1ee95b
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-10-09 13:14:42 +00:00
Timur Pocheptsov
8f58e1319c tst_qdtls: add 'invalidConfiguration' test
Test that we don't silently replace an invalid TLS configuration with
the default one (for now, the only thing that is considered to be
non-valid - is having non-DTLS protocol set).

Change-Id: I6f714b009cf1345a085a3f26d638fc31330f1a94
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-08-10 12:18:41 +00:00
Timur Pocheptsov
ab731692e2 QDtls: delay protocol version verification
A weird behavior of the DTLS server example, when linked with 1.0.2,
exposed that client code, requesting an invalid protocol (for example, SSLv3)
can end-up with connection encrypted with DTLS 1.2 (which is not that bad,
but totally surprising). When we check the protocol version early in
setDtlsConfiguration() and find a wrong version, we leave our previous
configuration intact and we will use it later during the handshake.
This is wrong. So now we let our user set whatever wrong configuration they
have and later fail in TLS initialization, saying -
'Unsupported protocol, DTLS was expected'.

Auto-test was reduced - the follow-up patch will introduce a new
'invalidConfiguration' auto-test.

Change-Id: I9be054c6112eea11b7801a1595aaf1d34329e1d2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-08-10 03:55:28 +00:00
Qt Forward Merge Bot
053e7cce79 Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	.qmake.conf
	src/corelib/doc/src/objectmodel/signalsandslots.qdoc
	src/plugins/platforms/cocoa/qcocoamenuloader.mm
	src/plugins/platforms/xcb/qxcbconnection.cpp
	src/plugins/platforms/xcb/qxcbconnection.h
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/plugins/platforms/xcb/qxcbwindow.cpp
	tests/auto/gui/image/qimage/tst_qimage.cpp

Done-with: Gatis Paeglis <gatis.paeglis@qt.io>
Change-Id: I9bd24ee9b00d4f26c8f344ce3970aa6e93935ff5
2018-08-07 17:44:51 +02:00
Timur Pocheptsov
9f2a671560 Extend 'ignoreExpectedErrors' test
with a case when we fail to ignore/pre-set one of possible
verification errors.

Change-Id: I23b06243b61acef1ef3576c51529f3ef6601ba7d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-08-02 04:05:27 +00:00
Mårten Nordheim
2dfa41e0ea Return to eventloop after emitting encrypted
When the connection has been encrypted we will,
in QHttpNetworkConnectionChannel::_q_encrypted, emit 'reply->encrypted'
in which user slots can be called.

In the event that the user calls abort it will, however, not abort until
the next time it goes back to the event loop (which might not happen
until after the request has already been sent).

Task-number: QTBUG-65960
Change-Id: I96865f83c47f89deb9f644c86a71948dbb0ec0d0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-07-31 14:57:02 +00:00
Timur Pocheptsov
5c7d2033e0 QDtls: respect pre-set verification errors
That's actually how ignoreVerificationErrors (and QSslSocket::ignoreSslErrors)
are used to set the expected/known verification errors before handshake.
Auto-test updated too.

Change-Id: I9c700302d81ddb383a4a750fafd594373fb38ace
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-07-31 11:20:53 +00:00
Ryan Chu
3f80783b11 Rework QNetworkReply tests to use docker-based test servers
This change frees the tests of their dependence on the Qt internal test
server (qt-test-server.qt-test-net). It makes the developers run the
tests out of Qt testing infrastructure.

If the user has installed Docker engine on their host, the test servers
will be built up inside separate Docker containers, and then, the test
case goes with the Docker-based test servers. Otherwise, the test case
will keep using the Qt internal test server.

Task-number: QTQAINFRA-1686
Change-Id: I518bc3675bfd658938509744b0e7e0610bc8bf66
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
2018-07-27 17:40:27 +00:00
Timur Pocheptsov
8948491eda QDtls - use conventional names
More Qt-style and more natural, also, shorter names.

Change-Id: I97bd68a8614126d518a3853027661435dc4e080d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-07-27 11:53:28 +00:00
Timur Pocheptsov
056fbf03a5 QDtls - refactor
This patch renames rather awkward 'remote' into more conventional
'peer' (similar to what we have in QAbstractSocket).

Change-Id: Ifc45e538b8adf9cc076bd7aee693277829fd94dc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-07-26 15:13:57 +00:00
Oswald Buddenhagen
99c3ef0789 prune cargo-culted and obsolete winsock deps from autotests
Change-Id: I9666598d34e965d7058aeb2b2e7fb3f59600675c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-07-19 13:31:08 +00:00
Qt Forward Merge Bot
1783fca897 Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/xcb/qxcbintegration.cpp

 Conflicts git missed:
	src/plugins/platforms/qnx/qqnxglcontext.cpp

Change-Id: I0582cdc9e66e43efe79038b9c43d4f9572ac88fc
2018-07-17 10:19:22 +02:00
Timur Pocheptsov
86632bd377 QSslSocketBackendPrivate - avoid recursion while handing errors
The logic seems to be simple - if client code on error signal
tries to close TLS socket and this socket has buffered data,
it calls 'flush' and 'transmit' or even 'startHandshake' as
a result, which in turn will set and emit error again. To auto-
test this, we initiate a handshake with pre-shared key hint
on a server side and both client/server sockets incorrectly
configured (missing PSK signals). We also do early write
into the client socket to make sure it has some data
buffered by the moment we call 'close'.

Task-number: QTBUG-68089
Task-number: QTBUG-56476
Change-Id: I6ba6435bd572ad85d9209c4c81774a397081b34f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-07-12 09:16:25 +00:00
Tuomas Heimonen
8c680ab469 tst_qnetworkinterface: Fix for case of zero interface
Change-Id: I3e43acf2e96635c39fcb366c8d161a9287af01b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2018-07-06 06:39:36 +00:00
Timur Pocheptsov
5bd9f98342 QDtls - handle server-side timeouts
According to RFC 6347 a DTLS server also must retransmit buffered message(s)
if timeouts happen during the handshake phase (so it's not a client only as
I initially understood it).

Conveniently so an auto-test is already in place and needs just a tiny
adjustment - handshakeWithRetransmission covers both sides.

Change-Id: If914ec3052e28ef5bf12a40e5eede45bbc53e8e0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-07-05 13:39:46 +00:00
Liang Qi
e3ed2281c0 Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	src/plugins/platforms/cocoa/qnsview.mm
	src/plugins/platforms/cocoa/qnsview_dragging.mm
	src/plugins/platforms/ios/qiosinputcontext.mm
	src/plugins/platforms/xcb/qxcbconnection.cpp
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/plugins/platforms/xcb/qxcbwindow.cpp
	src/tools/androiddeployqt/main.cpp
		Was moved from qttools into qtbase in 5.11.
		So re-apply 32398e4d here.
	tests/auto/corelib/global/qlogging/test/test.pro
	tests/auto/corelib/global/qlogging/tst_qlogging.cpp
	tests/auto/corelib/io/qfile/tst_qfile.cpp
	tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp
	tests/auto/corelib/thread/qthreadstorage/test/test.pro
	tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
	tests/auto/widgets/kernel/qapplication/test/test.pro

Done-with: Gatis Paeglis <gatis.paeglis@qt.io>
Done-with: Mårten Nordheim <marten.nordheim@qt.io>
Done-with: Oliver Wolff <oliver.wolff@qt.io>
Change-Id: Id970486c5315a1718c540f00deb2633533e8fc7b
2018-07-02 11:23:45 +02:00
Timur Pocheptsov
5ba5a7b5bc DTLS cookie auto-test - do not check the exact UDP socket errors
It was observed on OpenSUSE VM in CI - apparently, even after succesfull
read from UDP socket error was not UnknownSocketError. While it's under
investigation, the DTLS auto-test should limit itself by DTLS things and
barely test IO success (socket-wise) when needed.

Change-Id: I0773a02c591432b0d6c894f4131f70e41dc7ed72
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-06-28 03:28:50 +00:00
Timur Pocheptsov
73b9242d7e tst_QSslSocket::qtbug18498_peek() - fix several problems
It all started from the compiler's warnings about 'this' captured but
not used in lambdas. While fixing this it was noticed that 'client' socket
has a lifetime longer than the test case itself (the socket has a parent,
which is tst_QSslSocket object). The 'server' socket was simply leaked.
So there is no guarantee that some of them (or both) later, after the
test failed in one of QVERIFY, for example, does not emit 'encrypted'
upon receiving more data; this will result: in reading/writing from/to
invalid memory location (captured local 'encryptedCount') and/or probably
exiting event loop when it's not expected to do so.

Change-Id: I51de0493d989a5ba36de2cef58d35526c0e26cda
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-06-28 03:28:38 +00:00
Liang Qi
c3059391fe Make tests compile for Android
This only enables compilation, it doesn't fix any test.

Qt on Android supports process, but not TEST_HELPER_INSTALLS. See also
acdd57cb for winrt.

android-ndk-r10e is used to compile, see
http://doc-snapshots.qt.io/qt5-5.11/androidgs.html .

corelib/io/{qdir,qresourceengine} need to be fixed later.

Done-with: Frederik Gladhorn <frederik.gladhorn@qt.io>
Done-with: Mårten Nordheim <marten.nordheim@qt.io>
Change-Id: I34b924c8ae5d46d6835b8f0a6606450920f4423b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-06-25 08:01:19 +00:00
Timur Pocheptsov
5417949fe2 Add tst_QDtls auto-test
The test is somewhat similar to tst_QSslSocket but is smaller (in scope, will
grow in future), it has no QTcpSocket/QAbstractSocket-specific things and
has more DTLS-specific code. At the moment it does not use our network
test server, all work is done in the same process with two QUdpSockets
and two QDtls objects. We test (both on client/server ends):
 - parameters validation (for all functions that do this) and
   the correctness of error codes/handshake states
 - handshake procedure (with/out certificates and with pre-shared keys)
 - timeouts and re-transmissions during (D)TLS handshake
 - peer verification (and related verification errors)
 - aborted/resumed handshake
 - encrypted I/O
 - DTLS shutdown

For now, this test is OpenSSL-only.

Task-number: QTBUG-67597
Change-Id: I27006bfe3d6c02b89596889e8482a782c630402a
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2018-06-21 17:01:25 +00:00
Timur Pocheptsov
d77d4fc548 QDtlsClientVerifier - add auto-test
This part of DTLS is relatively easy to test: we never do a complete
handshake. Certificates, verification, ciphers,  etc. - do not matter
at this stage (to be tested in tst_QDtls). Errors are mostly insignificant
and can be ignored or handled trivially.

The test is OpenSSL-only: SecureTransport failed to correctly implement/
support server-side DTLS, the problem reported quite some time ago and
no fixes from Apple so far.

Task-number: QTBUG-67597
Change-Id: I21ad4907de444ef95d5d83b50083ffe211a184f8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-06-19 05:31:30 +00:00
Edward Welbourne
4b944f7bc7 De-parameterise tst_QNetworkReply::ignoreSslErrorsList()'s url
It was the same in all test rows, so move it from the _data() to a
fixed value in the test.  Also, don't implicitly coerce C-string
literals to QString.

Change-Id: Ieee4c7ffbf251c4b69b5acd79125dfa93eb51d6e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-06-13 08:18:11 +00:00
Timur Pocheptsov
a217188fe0 tst_Http2 auto-test: stop sending DATA frames if test failed
Unlike QNAM, our toy http2 server sends payload as one big chunk as soon as
it fits in the receive window's size. Internally, 'frame writer' splits this
payload into many DATA frames of the appropriate size (imposed either by the
default value or the one from the client's SETTINGS frame). If some test fails,
we can end up with a server waiting for the writer to send all the DATA frames
though it is not needed anymore - there is nobody to receive them after a failure.
This patch moves such a loop into the test server instead and stops the loop early
if needed.

Change-Id: Iea2dcd718d8f83386fd16004807f6447bf999435
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2018-06-04 13:38:04 +00:00
Liang Qi
f82e508516 Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	mkspecs/features/qt_common.prf
	src/corelib/tools/qstring.cpp
	src/plugins/platforms/windows/qwindowsmousehandler.cpp
	src/widgets/widgets/qmainwindowlayout_p.h

Change-Id: I5df613008f6336f69b257d08e49a133d033a9d65
2018-05-24 16:29:14 +02:00
Liang Qi
7e1b504f31 Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	mkspecs/features/qt_module_headers.prf
	tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
	tests/auto/widgets/kernel/qwidget/BLACKLIST

Change-Id: I2a08952d28d1d0e3d73f521a3d44700ce79ff16c
2018-05-14 14:51:46 +02:00
Andy Shaw
bb6ba17019 Treat the Content-Disposition header as a known header
Change-Id: I307f67b10759d17f603a340b14266ab47d195497
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-05-14 12:36:32 +00:00
Mårten Nordheim
5134ff882a OpenSSL v1.1.1: fix qtbug18498_peek
Previously the test worked because the client was the last party to know
when encryption was established. However, due to changes in the TLSv1.3
handshake the server is now the last one.

In either case, relying on both to be encrypted when one of them is
finished is not great, so now we only quit the event loop when both
client and server have emitted 'encrypted'.

Change-Id: Ic1fc75671206d866f7ea983805fd58a99657aac6
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-05-11 08:42:17 +00:00
Liang Qi
b5a956601f Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
	src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
	tests/auto/corelib/io/qresourceengine/qresourceengine_test.pro

Change-Id: I3169f709cc2a1b75007cb23c02c4c79b74feeb04
2018-05-08 20:43:45 +02:00
Kari Oikarinen
c580644fe9 tests/auto/network: Avoid unconditional qWait()s
Replace with QSignalSpy or QTRY_COMPARE when possible.

Task-number: QTBUG-63992
Change-Id: I18dc8837301424855487a12ee62451a5aeb21bf0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2018-05-08 12:35:40 +00:00
Qt Forward Merge Bot
ba2b7b8e33 Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: Ib58433da04bffb5dfab5486b80f17f39cc4145fa
2018-05-05 01:00:55 +02:00