qt5base-lts/tests
Timur Pocheptsov 0f3c9782e6 tst_QNetworkReply::ioHttpRedirectErrors - fix a flaky test
This test became a real pain recently. A close look at the test shows
several problems (strangely enough, the failure can never be
reproduced on real machines, only on VM - Ubuntu and RHEL 6.6).
There are several asserts that are firing from time to time here and
there. They show that the logic in test is broken/incorrect. QNAM can
open several connections to a host, our test then incorrectly resets
its 'client' data-member and bad things can later happen after
'bytesWrittenSlot' executed (and deleted a socket). For example,
I can reproduce this scenario in every second run:

1. incoming connection -> client = socket(descriptor), connect to
   client's readyRead (s1)
2. incoming connection -> client = socket(descriptor), connect to
   client's readyRead (s2)
QNAM sends a request on s1. We reply on s2 (which is already wrong)
and call client->deleteLater(), which resets client to nullptr.
If QNAM sends something else on s1, we hit assert(!client.isNull()).

To avoid this, whenever 'sender' in any slot is different from the
'client', we use the actual 'sender' to reply. Another problem is this
weird and rather cryptic waitForFinish which is not needed in this
particular test since we wait for reply error, not 'finished'.

As it happened before - it's not clear if these two problems
were the cause of guaranteed fails on CI - an integration failed
~10 times in a row in the same test (not happening anymore though).

Task-number: QTBUG-64569
Change-Id: Id9aa091290350c61fadf1c3c001e7c2e1b5ac8f4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2017-11-22 13:47:30 +00:00
..
auto tst_QNetworkReply::ioHttpRedirectErrors - fix a flaky test 2017-11-22 13:47:30 +00:00
baselineserver tests: Add Q_FALLTHROUGH to unmarked fallthroughs seen by GCC 7 2017-06-28 17:57:35 +00:00
benchmarks Restore compatibility with pre-5.9 Keccak calculation 2017-09-21 03:21:58 +00:00
global tst_bic: Add linux-gcc-ia32 bic data for QtXml 2013-01-16 08:25:28 +01:00
manual Menurama: Fix custom application class constructor signature 2017-11-17 13:30:40 +00:00
shared Fix largefile tests on ARM and QEMU targets 2017-03-28 06:55:32 +00:00
README Doc: Fix references to Qt Test 2013-01-30 01:35:06 +01:00
tests.pro Build examples and tests only if their requirements are met 2017-03-22 15:55:55 +00:00

This directory contains autotests and benchmarks based on Qt Test. In order
to run the autotests reliably, you need to configure a desktop to match the
test environment that these tests are written for.

Linux X11:

   * The user must be logged in to an active desktop; you can't run the
     autotests without a valid DISPLAY that allows X11 connections.

   * The tests are run against a KDE3 or KDE4 desktop.

   * Window manager uses "click to focus", and not "focus follows mouse". Many
     tests move the mouse cursor around and expect this to not affect focus
     and activation.

   * Disable "click to activate", i.e., when a window is opened, the window
     manager should automatically activate it (give it input focus) and not
     wait for the user to click the window.