summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qfile
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-11-15 11:36:18 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-18 01:51:57 +0100
commita8fd0c3654f8352773638633778cd8003680cbc7 (patch)
tree4815cca9daf879b96a92a3de95621b56ac5ba868 /tests/auto/corelib/io/qfile
parentd90d57bb8b995c7a66e7f9b7b2515447fbe11de0 (diff)
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: 924d810dbdcd5b5b0fa860922b2487ea9062d002 8aaff6751038b88d17e23be6fcee945771297c5b 338d3f11973412047c2c9cd41cbd0c961d738ef3 a55034062ba2bf73a9f1ed3d9cf31745b38149e3 253497b7446c7d723aa3bdd7152e25d6852f2604 7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 9d2ff58f3642828e494e7e9b2df7dbb8e2cd408f 0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/corelib/io/qfile')
-rw-r--r--tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp9
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp74
2 files changed, 42 insertions, 41 deletions
diff --git a/tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp b/tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp
index 8f3b33dcf0..ce7b829738 100644
--- a/tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp
+++ b/tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp
@@ -121,9 +121,7 @@ private slots:
// Map/unmap large file
void mapFile();
-#ifndef Q_OS_MAC
void mapOffsetOverflow();
-#endif
void closeFile() { largeFile.close(); }
@@ -512,10 +510,12 @@ void tst_LargeFile::mapFile()
QVERIFY( largeFile.unmap( baseAddress ) );
}
-// mmap'ping beyond EOF may succeed; generate bus error on access.
-#ifndef Q_OS_MAC
void tst_LargeFile::mapOffsetOverflow()
{
+#if defined(Q_OS_MAC)
+ QSKIP("mmap'ping beyond EOF may succeed; generate bus error on access");
+#endif
+
// Out-of-range mappings should fail, and not silently clip the offset
for (int i = 50; i < 63; ++i) {
uchar *address = 0;
@@ -530,7 +530,6 @@ void tst_LargeFile::mapOffsetOverflow()
QVERIFY( !address );
}
}
-#endif
QTEST_APPLESS_MAIN(tst_LargeFile)
#include "tst_largefile.moc"
diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp
index 7c095f329a..8268b46538 100644
--- a/tests/auto/corelib/io/qfile/tst_qfile.cpp
+++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp
@@ -122,11 +122,9 @@ private slots:
void readAll_data();
void readAll();
void readAllBuffer();
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void readAllStdin();
void readLineStdin();
void readLineStdin_lineByLine();
-#endif
void text();
void missingEndOfLine();
void readBlock();
@@ -151,18 +149,14 @@ private slots:
void readTextFile2();
void writeTextFile_data();
void writeTextFile();
-#ifndef Q_OS_SOLARIS
/* void largeFileSupport(); */
-#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
void largeUncFileSupport();
#endif
void tailFile();
void flush();
void bufferedRead();
-#ifdef Q_OS_UNIX
void isSequential();
-#endif
void encodeName();
void truncate();
void seekToPos();
@@ -235,12 +229,8 @@ private:
NumberOfFileTypes
};
-#ifndef Q_WS_WINCE
void openStandardStreamsFileDescriptors();
-#endif
-#ifdef Q_OS_UNIX
void openStandardStreamsBufferedStreams();
-#endif
bool openFd(QFile &file, QIODevice::OpenMode mode, QFile::FileHandleFlags handleFlags)
{
@@ -830,10 +820,14 @@ void tst_QFile::readAllBuffer()
QFile::remove(fileName);
}
-// Currently no stdin/out supported for Windows CE.
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void tst_QFile::readAllStdin()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Currently no stdin/out supported for Windows CE");
+#endif
+#if defined(QT_NO_PROCESS)
+ QSKIP("Qt was compiled with QT_NO_PROCESS");
+#else
QByteArray lotsOfData(1024, '@'); // 10 megs
QProcess process;
@@ -850,13 +844,18 @@ void tst_QFile::readAllStdin()
process.closeWriteChannel();
process.waitForFinished();
QCOMPARE(process.readAll().size(), lotsOfData.size() * 5);
-}
#endif
+}
-// Currently no stdin/out supported for Windows CE.
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void tst_QFile::readLineStdin()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Currently no stdin/out supported for Windows CE");
+#endif
+#if defined(QT_NO_PROCESS)
+ QSKIP("Qt was compiled with QT_NO_PROCESS");
+#else
+
QByteArray lotsOfData(1024, '@'); // 10 megs
for (int i = 0; i < lotsOfData.size(); ++i) {
if ((i % 32) == 31)
@@ -888,13 +887,17 @@ void tst_QFile::readLineStdin()
QCOMPARE(char(array[i]), char('0' + i % 32));
}
}
-}
#endif
+}
-// Currently no stdin/out supported for Windows CE.
-#if !defined(Q_OS_WINCE) && !defined(QT_NO_PROCESS)
void tst_QFile::readLineStdin_lineByLine()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Currently no stdin/out supported for Windows CE");
+#endif
+#if defined(QT_NO_PROCESS)
+ QSKIP("Qt was compiled with QT_NO_PROCESS");
+#else
for (int i = 0; i < 2; ++i) {
QProcess process;
process.start(QString("stdinprocess/stdinprocess line %1").arg(i), QIODevice::Text | QIODevice::ReadWrite);
@@ -912,8 +915,8 @@ void tst_QFile::readLineStdin_lineByLine()
process.closeWriteChannel();
QVERIFY(process.waitForFinished(5000));
}
-}
#endif
+}
void tst_QFile::text()
{
@@ -1551,14 +1554,15 @@ void tst_QFile::bufferedRead()
fclose(stdFile);
}
-#ifdef Q_OS_UNIX
void tst_QFile::isSequential()
{
+#ifndef Q_OS_UNIX
+ QSKIP("Unix only test.");
+#endif
QFile zero("/dev/null");
QVERIFY(zero.open(QFile::ReadOnly));
QVERIFY(zero.isSequential());
}
-#endif
void tst_QFile::encodeName()
{
@@ -1760,11 +1764,11 @@ void tst_QFile::FILEReadWrite()
#include <qglobal.h>
#define BUFFSIZE 1
#define FILESIZE 0x10000000f
-
-// Solaris does not support statfs.
-#ifndef Q_OS_SOLARIS
void tst_QFile::largeFileSupport()
{
+#ifdef Q_OS_SOLARIS
+ QSKIP("Solaris does not support statfs");
+#else
qlonglong sizeNeeded = 2147483647;
sizeNeeded *= 2;
sizeNeeded += 1024;
@@ -1819,8 +1823,8 @@ void tst_QFile::largeFileSupport()
} else {
QFAIL("Could not determin disk space");
}
-}
#endif
+}
*/
void tst_QFile::i18nFileName_data()
@@ -2959,12 +2963,14 @@ void tst_QFile::openDirectory()
f1.close();
}
-// Although Windows CE (not mobile!) has functions that allow redirecting
-// the standard file descriptors to a file (see SetStdioPathW/GetStdioPathW)
-// it does not have functions to simply open them like below.
-#ifndef Q_WS_WINCE
void tst_QFile::openStandardStreamsFileDescriptors()
{
+#ifdef Q_OS_WINCE
+ //allthough Windows CE (not mobile!) has functions that allow redirecting
+ //the standard file descriptors to a file (see SetStdioPathW/GetStdioPathW)
+ //it does not have functions to simply open them like below .
+ QSKIP("Opening standard streams on Windows CE via descriptor not implemented");
+#endif
// Using file descriptors
{
QFile in;
@@ -2990,11 +2996,12 @@ void tst_QFile::openStandardStreamsFileDescriptors()
QVERIFY( err.isSequential() );
}
}
-#endif
-#ifdef Q_OS_UNIX
void tst_QFile::openStandardStreamsBufferedStreams()
{
+#ifndef Q_OS_UNIX
+ QSKIP("Unix only test.");
+#endif
// Using streams
{
QFile in;
@@ -3020,16 +3027,11 @@ void tst_QFile::openStandardStreamsBufferedStreams()
QVERIFY( err.isSequential() );
}
}
-#endif
void tst_QFile::openStandardStreams()
{
-#ifndef Q_WS_WINCE
openStandardStreamsFileDescriptors();
-#endif
-#ifdef Q_OS_UNIX
openStandardStreamsBufferedStreams();
-#endif
}
void tst_QFile::writeNothing()