Commit Graph

78 Commits

Author SHA1 Message Date
Bradley T. Hughes
55b432b24c Update .gitignore for tests/auto/corelib/io/qresourceengine
The test generates the runtime_resource.rcc data file at build time. Add
this to .gitignore.

Change-Id: Ief4057072b28499049147b86f166523b71afe269
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-12 12:51:02 +01:00
João Abecasis
d8374aebc6 Fixes for tst_QTemporary(File|Dir)::nonWritableCurrentDir
- Check path/fileName is empty upon failure, variable was unused
- Use /home instead of /, as / is writable by admins on Mac

Change-Id: I705471fda8b73843e98b30eb52aa0a73634ec075
Reviewed-by: David Faure <faure@kde.org>
2011-12-09 14:15:37 +01:00
Friedemann Kleint
e8efad1b22 QProcess-test: Fix executable location on Windows.
The executable needs to be in the test directory
as it expects it sub-executables from there.

Breakage introduced by 3385fb91e1

Change-Id: Ic1f3db70851f65e2f12041c3a16cb8f0b7bdf35e
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2011-12-09 12:25:14 +01:00
João Abecasis
12dffdae75 Promote openStandardStreams sub-tests to top level
Commit a72468e820c2922540737c053eef27d033c2e77b split the test into two
functions, but kept them combined in a single slot for QTest to invoke.

That being the case, we might as well have them as test functions of
their own right. Should work nicer with test failures, skips and such.

Change-Id: I62c1fc7777c08b3e87a5903632d73dc1e1d97e1a
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2011-12-09 10:17:55 +01:00
Friedemann Kleint
2509a5b5a4 QFile-test: Do not fail when run with redirected stdout/stderr.
Check whether stdout/stderr is sequential.

Change-Id: Ia6311e265f0da03dce5b05d78a2058e0c2098bbf
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-09 08:23:53 +01:00
Friedemann Kleint
04cac41e58 QProcess-Test: Improve error handling.
In case a subprocess fails to start.

Change-Id: I1372c07de8f3580a8e7aadd6874da15bf273ac53
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-12-09 08:23:27 +01:00
Joerg Bornemann
f7d11b216a testProcessSpacesArgs fixed
Target names with spaces must be quoted.

Change-Id: I913ef386353fc75991c8db4e3205ab511fc1f1a9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-12-09 01:01:01 +01:00
David Faure
5cb05091d2 Improve/cleanup qtemporarydir (and qtemporaryfile) unit tests
To follow the comments in the review by João Abecasis.

Change-Id: Ie566705d3b4071b8628d269246aadcde4866f34f
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2011-12-08 21:12:57 +01:00
David Faure
ca1af75fb2 Fix QTemporaryDir unittest on Mac OS X
mkdtemp(10*X) replaces all 10 chars on Mac, while on linux it only
replaces the last 6. Adjusted the too-strict tests to allow for
both possibilities.

Change-Id: Ie6d57bd4947254ad7a39e75ac0e8881cebeaa428
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2011-12-08 16:00:53 +01:00
Jason McDonald
e3640d1bdd Remove TESTED_CLASS/TESTED_FILES comments from tests.
These comments were mostly empty or inaccurate.  Appropriate naming of
tests and appropriate placement of tests within the directory tree
provide more reliable indicators of what is being tested.

Change-Id: Ib6bf373d9e79917e4ab1417ee5c1264a2c2d7027
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-12-06 02:19:25 +01:00
David Faure
e999c543a0 New class QTemporaryDir.
As discussed on qt5-feedback / development lists.

Change-Id: If1733369d12daa29054776ec2cbd78e63679768e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-12-02 21:04:34 +01:00
David Faure
1bb51cb8b1 Implement QDir::removeRecursively
Task-number: QTBUG-4592
Change-Id: I363e2c24d1c0ada975b8b927d7c6e776b8aae579
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2011-12-02 15:59:58 +01:00
Friedemann Kleint
f0942bd8cb Windows: Fix qabstractfilenengine-test.
The test fails if the repository is checked out with
Windows line endings. Try to work around.

Basically, ensure that common developers can conveniently
run the test.

Change-Id: I91f31b830ba7ba305deea782737d4e07a89420eb
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2011-12-01 22:37:31 +01:00
Friedemann Kleint
5abf5b1f7c Windows: Fix compilation of qdir test.
Introduced by 3385fb91e1.

Change-Id: If47a9874cccb7b64840e77b1f654ba8e1cf372e0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2011-12-01 14:45:45 +01:00
Rohan McGovern
4eedb335c6 Mark tst_qfilesystementry as private test on Windows.
On Windows (only), this test depends on some Q_AUTOTEST_EXPORT symbols.

Change-Id: I3b2ef8dcd56b8860f02fc28f45823b889e794909
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2011-12-01 09:18:57 +01:00
Rohan McGovern
3385fb91e1 Fixed installation of corelib tests
In .pro files, removed wince/symbian-specific DEPLOYMENT cases and
replaced them with TESTDATA where appropriate.

In .cpp files, removed SRCDIR and relative paths to testdata and
replaced them with the QFINDTESTDATA macro where appropriate.

Modified test helper apps/libs to install themselves under the test
they relate to.

This change allows corelib tests to be correctly installed, along with
their testdata, via `make install'.

Change-Id: I5e202e2f3b577af7e39072d5c9fe13e0ca125304
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2011-12-01 09:12:52 +01:00
Jason McDonald
75b66dc8b0 Cleanup corelib autotests
Remove references to the old bug tracker.  The data from the old bug
tracker is no longer accessible, so these markers are meaningless.

Change-Id: Ib9d029d52b70fd0a512b9532d65f03763eabfe57
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-30 07:49:32 +01:00
Friedemann Kleint
ae768911ee Fix linking of autotests on Windows.
Partial revert of 94fc875079. All dependent
modules need to be specified in the QT variable, except core and gui, which
are there by default.

Change-Id: Ie8ffed56de03a37da191772fa321ed162e44a50d
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2011-11-29 12:28:30 +01:00
Jason McDonald
c5b55d4403 Cleanup corelib autotests
Don't name test functions using task identifiers from obsolete bug
trackers.

Change-Id: Iba6ae8ad3b39e365c5510ed5c86749a167572829
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-29 05:16:52 +01:00
Jason McDonald
e15548d3e4 Fix sanity check of network test server
Some of Qt's autotests depend on access to a test server.  For each test
that used the test server, tests/auto/network-settings.h created a
global object to verify at startup that host lookups to the test server
will succeed (and abort the test otherwise).

There are two problems with that approach:

First, the sanity check happens before main(), and thus before the test
framework has started logging test results.  This means that if the
sanity check aborts the test, the failure message will not be visible in
the test output if logging to a file or will cause the output to be
malformed if logging to the console in XML format.

Second, since Qt 4.7, the host lookup uses a class that connects to the
QCoreApplication instance, which doesn't exist before main(), and this
caused all tests that included network-settings.h to output an error
message from QObject::connect() at the beginning of the test.

Both of these problems are solved by removing the global object from
network-settings.h and instead performing the sanity check in the
initTestCase() function of each test.

Task-number: QTBUG-22876
Change-Id: Id49c1826906327bf571686cc11527f0265e5af44
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-28 08:13:41 +01:00
Jason McDonald
cbcdb5f4cf Correct usage of network-settings.h.
Four of the modified files only use functions from network-settings.h
on Windows, and the other three files don't use anything from that
header.

Change-Id: Ifa4b0319d14367735b859e538921fa0eeeccce1a
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-28 08:13:41 +01:00
Jason McDonald
e08410ab8d Cleanup corelib autotests
Bug trackers come and go, so using bug identifiers in function and test
case names will ensure that those names eventually become meaningless.
It is better to choose a meaningful name and provide explanatory
comments where appropriate.

Change-Id: I67c27782ef21b5d4eaab4854079a043c8ef6957b
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-25 07:56:16 +01:00
Jason McDonald
d1e7294cd2 Remove misleading comment.
In the QProcess test, QHostInfo is used as a quick and easy way to
create a background thread, and so is not (entirely) unnecessary.

Change-Id: I7204f113e7bc8a4b312d5a20f0a6ee076c56b35d
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-23 07:06:24 +01:00
Jason McDonald
0097d2daba Removed commented test data from QUrl test.
The removed test data is invalid for the toString() test function --
QUrl::toString() won't eliminate relative paths from URL's, you need to
call QUrl::resolved() to do that.  Add this test data to the test for
QUrl::resolved(), as the existing tests don't seem to cover the case of
a complete URL containing a relative path.

Change-Id: Idb0f4eac9cc75258a8e17f10fa95ddb75f01d470
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-21 18:47:58 +01:00
Bradley T. Hughes
84f0add9b3 Re-enable the corelib autotests on Mac OS X
This is the first change to re-enable the autotests for the individual
qtbase modules. This means adding subdir.CONFIG=no_check_target for each
module (except corelib) in tests/auto/auto.pro instead of in
tests/tests.pro

QFileSystemWatcher, QIODeice, QSettings, QTextStream, QSocketNotifier,
QVariant, QPluginLoader, QLocale: These tests currently fail, which
will block any changes that attempt to re-enable the autotests. Ignore
the failures for now by marking them as insignificant.

QAbstractItemModel: This test currently crashes, which can
destabilize the CI system when attempting to re-enable the autotests.
Skip this test for now by disabling the check target for it.

Change-Id: Ie5147d5c5cfae5e7d0a495d5c4788ce92fe2e6d8
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2011-11-21 11:31:35 +01:00
Jason McDonald
397fd4735a Fix typo in QUrl autotest.
Change-Id: Id85ad5c16e3a5b7a1614affa041d19f5062073fd
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-18 08:58:09 +01:00
Jason McDonald
1a6f2a3d3b Remove obsolete test data from QFile test.
The removed data relied on the test's own source file having no write
permissions, but that is not a valid assumption -- in a source package
the file wouldn't have had write permissions, in Perforce it would have
depended on whether the file had been checked-out for editing and in git
the file would always have write permission.

Change-Id: I3b6100429120137095a210189961c8b97f06e50a
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-18 07:27:53 +01:00
Jason McDonald
d125e84d6a Remove obsolete test data from QFileInfo test.
The removed data relied on the test's own source file having no write
permissions, but that is not a valid assumption -- in a source package
the file wouldn't have had write permissions, in Perforce it would have
depended on whether the file had been checked-out for editing and in git
the file would always have write permission.

Change-Id: I000596f122f2765f97a09a08074938c90e2e9f95
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-18 07:27:48 +01:00
Jason McDonald
97cd812d65 Remove obsolete comment from QDataStream test.
The removed comment was introduced before the tests were imported into
the Qt repository in 2006 and seems to relate to a test failure that no
longer occurs.

Change-Id: I01f372f6a4f48110711f4f2a86e73acfb7134e24
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-18 04:51:09 +01:00
Jason McDonald
40b5b34d0b Remove obsolete comment from QDataStream test.
The removed comment was introduced before the tests were imported into
the Qt repository in 2006 and seems to relate to code that no longer
exists.

Change-Id: Ic21e46fe0157adf5be9dc62de098517b7b27c310
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-18 04:51:09 +01:00
Jason McDonald
93d2519d99 Improve QBuffer autotest.
This commit fixes several issues found in the readLineBoundaries() test
function.

First, the test performed some test actions but did not perform any
verification steps to check that the outcome of those actions was
acceptable.

Second, the test didn't need to write the buffered data to a file to
verify line-by-line reading.

Third, the get/unget action was unrelated to the readLineBoundaries()
test and has been moved to a separate test function.  That test function
now tests that get/unget works at every position in a buffer, not just
at position 0.

Change-Id: Icad52ed598e94b6e05a194b9ab301d099bfc094c
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-18 04:51:09 +01:00
Jason McDonald
a8fd0c3654 Don't depend on moc to disable test functions.
The moc tool is not aware of all defines (particularly those that are
compiler builtins) and does not correctly evaluate others that depend
on compiler builtins, such as Q_OS_FOO.

This commit reverts parts of the following commits, but is not a
complete fix as there were many instances of this problem in the tests
prior to those commits:
    924d810dbd
    8aaff67510
    338d3f1197
    a55034062b
    253497b744
    7cfad460c5
    9d2ff58f36
    0cf6baa2d6

Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-18 01:51:57 +01:00
Jason McDonald
6382d27abd Remove commented code from QBuffer autotest.
The removed code was commented-out before the tests were imported into
the Qt repository in June 2006.  This code is no longer valid as the
warning messages it relates to are not produced by any code in qtbase.

Change-Id: Iac63b27387b51a71c567386ca61faf5fb00c3364
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-17 07:21:11 +01:00
Jason McDonald
578e6d6834 Cleanup corelib autotests
Remove various disabled and/or non-helpful debugging code.

Any test diagnostics that are useful should be part of the regular test
output, as the CI system cannot switch on commented-out code when there
is a test failure.  Diagnostics should also be informative -- simply
printing the value of a variable with no other information about what is
being printed (or why it is being printed) is not informative.

Change-Id: I21a6c2121be86001bb57e80f426507b6e619ee9e
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-14 07:33:57 +01:00
Jason McDonald
94fc875079 Cleanup corelib autotests
Tidy the autotest .pro files.  Most autotest .pro files should look like
this:

CONFIG += testcase
TARGET = tst_something
QT = core testlib
SOURCES = tst_something.cpp

Change-Id: I877c2194e9fa9dd13478d117895e1e255a948ad7
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-11 02:45:05 +01:00
Jason McDonald
8e11f7c93a Cleanup corelib autotests
Remove literal tabs.

Change-Id: I210a0259773cceb20d35ebc80b889e3ebb88b540
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-10 04:42:45 +01:00
Jason McDonald
2cd4710715 Remove redundant #define
Change-Id: I27a47653d2c41741f39ee1fea6a1fed063279994
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-10 04:42:23 +01:00
Aurindam Jana
124044613d QGlobal: Define a default message handler
Currently, qInstallMsgHandler() does not return the
handle to the default message handler. This patch defines
a default message handler. This is returned by
qInstallMsgHandler() when called for the first time. A call
to qInstallMsgHandler(0) will restore the default message
handler as was the case previously.

Change-Id: I42f06654d45fb0e633f3c6d912fc8f05c23249aa
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-08 17:20:39 +01:00
David Faure
5e26608ae2 Add Q_DECLARE_PRIVATE equivalent for QDir, to be able to subclass it
Apply the same solution to QFileInfo (no public detach(), but a
non-inline d_func instead).

Change-Id: I31c4c759f44a0649b97f7884b078b174c9c00f22
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-08 12:09:06 +01:00
Jason McDonald
e8f7fccf22 Cleanup corelib autotests
Remove redundant empty constructors, destructors and test functions.

Change-Id: Idb51368895e67ec3fc0345a9a5d33d77730c051b
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-07 13:26:41 +01:00
David Faure
272d20ce27 QStandardPaths: add DownloadLocation.
Only properly implemented on unix (XDG), falls back to Document location
on Mac and Windows, because not easily available with the current API
being used by either one.

Change-Id: Id269f0e3c4e3a68e19205de96c0b39980fde80ff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-04 10:54:54 +01:00
David Faure
ae6e7e3d59 Fix tst_qstandardpaths: Mac OSX is a unix, but doesn't use XDG.
Change-Id: I2b4552a162dc9f993e0587ace6e7e3fb4f96571e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2011-11-04 10:53:41 +01:00
Jason McDonald
a7b1f30d57 Remove disabled test data from QUrl autotest
The removed test data was for obex URLs, which are not supported by
QUrl.

Change-Id: I166130ae936342d415165e46b7943d198de8986b
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-11-02 05:43:49 +01:00
Jason McDonald
a13b24eac0 Improve QBuffer autotest
The documentation of QIODevice::pos() states: "For sequential devices or
closed devices, where there is no concept of a "current position", 0 is
returned".  The test had a disabled check for a position of -1 before
the device is opened.  Make the test agree with the documentation.

Change-Id: Ide5729bfc825cdb84caf4851574a57d3ef42ccb2
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-31 06:58:15 +01:00
Jason McDonald
be16b833a5 Remove debugging code from QFileSystemWatcher test
Any test diagnostics that are useful should be part of the regular test
output, as the CI system cannot switch on commented-out code when there
is a test failure.

Change-Id: I201ba754df26ffc30997bead8b822f97913db2b6
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-31 05:27:56 +01:00
Jason McDonald
31e3f78336 Remove disabled tests from QUrl test.
Some tests were copied in from KDE's KURL sometime prior to Qt's tests
being added to the Qt repository in June 2006.  This was presumably
done with the intention of making the tests work for QUrl, but that
never happened and the copied tests have never been enabled.

This commit removes the copied material.

Change-Id: Ic35526f0018900bd60d7905646b24c62317b5e47
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-31 05:27:48 +01:00
Jo Asplin
b5ef53df45 Re-enabled tst_LargeFile
tst_LargeFile currently seems to pass in a stable way in CI

It does have an issue on 64-bit Linux (see QTBUG-21175), so
that test function is still disabled (QEXPECT_FAIL'ed) on that platform.

Change-Id: I818046f84f2db5eb2155ae1f51f69581029bfaee
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
2011-10-29 19:56:37 +02:00
Jason McDonald
238c304613 Remove obsolete MSVC workarounds from autotests.
Qt5 doesn't support MSVC versions before 2008, so workarounds for
earlier versions are no longer required.

Change-Id: I429feff99fe61d286637b960d92fd58962f8aefa
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-27 06:12:09 +02:00
Jason McDonald
eeaf051558 Replace QSKIP with QFAIL in qputenv test
If qputenv fails, the test should fail rather than skip, particularly as
the test is supposed to be testing qputenv.

Change-Id: Iabe13d360cabaeffda46fab19f1dd0d4ed8e1eee
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-27 03:15:09 +02:00
Jo Asplin
1b345e8655 Re-enabled tests
This commit re-enables tests that are assumed to be ok by now, since they:
- Have been passing in CI for a long time recently (more precisely, not failed once in pulse run range 730-829).
- Did not have any known issues associated with them.

Note that not all of these tests were disabled as a result of QTBUG-21402.

Task-number: QTBUG-21402
Change-Id: I80bbf8b351bd9165aa968e98f4dc17e8be6bc7c3
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
2011-10-26 02:58:36 +02:00