From 7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 4 Oct 2011 11:51:31 +1000 Subject: Avoid using QSKIP in lieu of compile-time checks QSKIP is intended to be used to skip test functions that are found at run-time to be inapplicable or unsafe. If a test function can be determined to be inapplicable at compile-time, the entire test function should be omitted instead of replacing the body of the test function with a QSKIP, which only serves to slow down test runs and to inflate test run-rates with empty, inapplicable tests. Task-number: QTQAINFRA-278 Change-Id: Ib2025339422749cf216e87ac414a3056250bf8f9 Reviewed-on: http://codereview.qt-project.org/5942 Reviewed-by: Qt Sanity Bot Reviewed-by: Rohan McGovern --- .../corelib/io/qdatastream/tst_qdatastream.cpp | 20 +- tests/auto/corelib/io/qdir/tst_qdir.cpp | 9 +- .../corelib/io/qdiriterator/tst_qdiriterator.cpp | 18 +- .../corelib/io/qfile/largefile/tst_largefile.cpp | 9 +- tests/auto/corelib/io/qfile/tst_qfile.cpp | 75 +++--- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 34 +-- tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp | 18 +- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 298 +++++++++++---------- .../tst_qprocessenvironment.cpp | 9 +- tests/auto/corelib/io/qsettings/tst_qsettings.cpp | 21 +- .../corelib/io/qtextstream/tst_qtextstream.cpp | 32 ++- 11 files changed, 286 insertions(+), 257 deletions(-) (limited to 'tests/auto/corelib/io') diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index cd4f6c7204..786051c53c 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -106,8 +106,10 @@ private slots: void stream_QPen_data(); void stream_QPen(); +#ifndef Q_OS_WINCE void stream_QPixmap_data(); void stream_QPixmap(); +#endif void stream_QPoint_data(); void stream_QPoint(); @@ -139,8 +141,10 @@ private slots: void stream_qint64_data(); void stream_qint64(); +#ifndef Q_OS_WINCE void stream_QIcon_data(); void stream_QIcon(); +#endif void stream_QEasingCurve_data(); void stream_QEasingCurve(); @@ -1597,35 +1601,31 @@ void tst_QDataStream::readQPen(QDataStream *s) // pixmap testing is currently limited to one pixmap only. // +// Test depends on more memory than available on Qt/CE. +#ifndef Q_OS_WINCE void tst_QDataStream::stream_QPixmap_data() { -#ifndef Q_OS_WINCE stream_data(1); -#endif } void tst_QDataStream::stream_QPixmap() { -#ifdef Q_OS_WINCE - QSKIP("Test depends on more memory than available on Qt/CE", SkipAll); -#endif STREAM_IMPL(QPixmap); } +#endif +// Test depends on more memory than available on Qt/CE. +#ifndef Q_OS_WINCE void tst_QDataStream::stream_QIcon_data() { -#ifndef Q_OS_WINCE stream_data(1); -#endif } void tst_QDataStream::stream_QIcon() { -#ifdef Q_OS_WINCE - QSKIP("Test depends on more memory than available on Qt/CE", SkipAll); -#endif STREAM_IMPL(QIcon); } +#endif void tst_QDataStream::writeQPixmap(QDataStream *s) { diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index d61e4316c5..e7595da4d1 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -146,7 +146,9 @@ private slots: void operator_eq(); +#ifndef Q_OS_WINCE void dotAndDotDot(); +#endif void homePath(); void tempPath(); void rootPath(); @@ -1241,18 +1243,17 @@ void tst_QDir::operator_eq() dir1.setPath(".."); } +// WinCE does not have . nor .. +#ifndef Q_OS_WINCE void tst_QDir::dotAndDotDot() { -#if defined(Q_OS_WINCE) - QSKIP("WinCE does not have . nor ..", SkipAll); -#else QDir dir(QString(SRCDIR "testdir/")); QStringList entryList = dir.entryList(QDir::Dirs); QCOMPARE(entryList, QStringList() << QString(".") << QString("..") << QString("dir") << QString("spaces")); entryList = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); QCOMPARE(entryList, QStringList() << QString("dir") << QString("spaces")); -#endif } +#endif void tst_QDir::homePath() { diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp index db8a0223e5..47e432d432 100644 --- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp @@ -121,7 +121,9 @@ private slots: void uncPaths_data(); void uncPaths(); #endif +#if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE) void qtbug15421_hiddenDirs_hiddenFiles(); +#endif }; tst_QDirIterator::tst_QDirIterator() @@ -170,6 +172,7 @@ tst_QDirIterator::tst_QDirIterator() # endif #endif +#if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE) createDirectory("qtbug15421_hiddenDirs_hiddenFiles"); createFile("qtbug15421_hiddenDirs_hiddenFiles/normalFile"); createFile("qtbug15421_hiddenDirs_hiddenFiles/.hiddenFile"); @@ -183,6 +186,7 @@ tst_QDirIterator::tst_QDirIterator() createDirectory("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/.hiddenDirectory"); createDirectory("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/normalDirectory"); createDirectory("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/.hiddenDirectory"); +#endif } tst_QDirIterator::~tst_QDirIterator() @@ -588,15 +592,13 @@ void tst_QDirIterator::uncPaths() } #endif +// In Unix it is easy to create hidden files, but in Windows it requires +// a special call since hidden files need to be "marked" while in Unix +// anything starting by a '.' is a hidden file. +// For that reason this test is not run in Windows. +#if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE) void tst_QDirIterator::qtbug15421_hiddenDirs_hiddenFiles() { - // In Unix it is easy to create hidden files, but in Windows it requires - // a special call since hidden files need to be "marked" while in Unix - // anything starting by a '.' is a hidden file. - // For that reason this test is not run in Windows. -#if defined Q_OS_WIN || Q_OS_WINCE - QSKIP("To create hidden files a special call is required in Windows.", SkipAll); -#else // Only files { int matches = 0; @@ -625,8 +627,8 @@ void tst_QDirIterator::qtbug15421_hiddenDirs_hiddenFiles() QCOMPARE(matches, 6); QCOMPARE(failures, 0); } -#endif // Q_OS_WIN || Q_OS_WINCE } +#endif QTEST_MAIN(tst_QDirIterator) diff --git a/tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp b/tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp index bf6cc688ba..f6321c7f79 100644 --- a/tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp +++ b/tests/auto/corelib/io/qfile/largefile/tst_largefile.cpp @@ -121,7 +121,9 @@ private slots: // Map/unmap large file void mapFile(); +#ifndef Q_OS_MAC void mapOffsetOverflow(); +#endif void closeFile() { largeFile.close(); } @@ -515,12 +517,10 @@ 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", SkipAll); -#endif - // Out-of-range mappings should fail, and not silently clip the offset for (int i = 50; i < 63; ++i) { uchar *address = 0; @@ -532,6 +532,7 @@ 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 9f8a8f7c6a..5d976896d8 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -129,9 +129,11 @@ 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(); @@ -156,14 +158,18 @@ 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(); @@ -236,8 +242,12 @@ 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) { @@ -842,14 +852,10 @@ 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", SkipAll); -#endif -#if defined(QT_NO_PROCESS) - QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll); -#else QByteArray lotsOfData(1024, '@'); // 10 megs QProcess process; @@ -866,18 +872,13 @@ void tst_QFile::readAllStdin() process.closeWriteChannel(); process.waitForFinished(); QCOMPARE(process.readAll().size(), lotsOfData.size() * 5); -#endif } +#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", SkipAll); -#endif -#if defined(QT_NO_PROCESS) - QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll); -#else - QByteArray lotsOfData(1024, '@'); // 10 megs for (int i = 0; i < lotsOfData.size(); ++i) { if ((i % 32) == 31) @@ -909,17 +910,13 @@ void tst_QFile::readLineStdin() QCOMPARE(char(array[i]), char('0' + i % 32)); } } -#endif } +#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", SkipAll); -#endif -#if defined(QT_NO_PROCESS) - QSKIP("Qt was compiled with QT_NO_PROCESS", SkipAll); -#else for (int i = 0; i < 2; ++i) { QProcess process; process.start(QString("stdinprocess/stdinprocess line %1").arg(i), QIODevice::Text | QIODevice::ReadWrite); @@ -937,8 +934,8 @@ void tst_QFile::readLineStdin_lineByLine() process.closeWriteChannel(); QVERIFY(process.waitForFinished(5000)); } -#endif } +#endif void tst_QFile::text() { @@ -1581,16 +1578,14 @@ void tst_QFile::bufferedRead() fclose(stdFile); } +#ifdef Q_OS_UNIX void tst_QFile::isSequential() { -#if defined (Q_OS_WIN) - QSKIP("Unix only test.", SkipAll); -#endif - QFile zero("/dev/null"); QVERIFY(zero.open(QFile::ReadOnly)); QVERIFY(zero.isSequential()); } +#endif void tst_QFile::encodeName() { @@ -1792,11 +1787,11 @@ void tst_QFile::FILEReadWrite() #include #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", SkipAll); -#else qlonglong sizeNeeded = 2147483647; sizeNeeded *= 2; sizeNeeded += 1024; @@ -1851,8 +1846,8 @@ void tst_QFile::largeFileSupport() } else { QFAIL("Could not determin disk space"); } -#endif } +#endif */ void tst_QFile::i18nFileName_data() @@ -2992,14 +2987,12 @@ 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", SkipAll); -#endif // Using file descriptors { QFile in; @@ -3025,12 +3018,11 @@ void tst_QFile::openStandardStreamsFileDescriptors() QVERIFY( err.isSequential() ); } } +#endif +#ifdef Q_OS_UNIX void tst_QFile::openStandardStreamsBufferedStreams() { -#if defined (Q_OS_WIN) - QSKIP("Unix only test.", SkipAll); -#endif // Using streams { QFile in; @@ -3056,11 +3048,16 @@ 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() diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 212c2f9700..76c100163c 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -136,7 +136,9 @@ private slots: void size_data(); void size(); +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) void systemFiles(); +#endif void compare_data(); void compare(); @@ -148,8 +150,10 @@ private slots: void fileTimes(); void fileTimes_oldFile(); +#ifndef Q_NO_SYMLINKS void isSymLink_data(); void isSymLink(); +#endif void isHidden_data(); void isHidden(); @@ -173,8 +177,10 @@ private slots: void isWritable(); void isExecutable(); +#ifdef Q_OS_MAC void testDecomposedUnicodeNames_data(); void testDecomposedUnicodeNames(); +#endif void equalOperator() const; void equalOperatorWithDifferentSlashes() const; @@ -874,16 +880,16 @@ void tst_QFileInfo::size() QTEST(int(fi.size()), "size"); } +// This is a Windows only test. +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) void tst_QFileInfo::systemFiles() { -#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE) - QSKIP("This is a Windows only test", SkipAll); -#endif QFileInfo fi("c:\\pagefile.sys"); QVERIFY(fi.exists()); // task 167099 QVERIFY(fi.size() > 0); // task 189202 QVERIFY(fi.lastModified().isValid()); } +#endif void tst_QFileInfo::compare_data() { @@ -1096,9 +1102,9 @@ void tst_QFileInfo::fileTimes_oldFile() #endif } +#ifndef Q_NO_SYMLINKS void tst_QFileInfo::isSymLink_data() { -#ifndef NO_SYMLINKS QFile::remove("link.lnk"); QFile::remove("brokenlink.lnk"); QFile::remove("dummyfile"); @@ -1118,12 +1124,10 @@ void tst_QFileInfo::isSymLink_data() QTest::newRow("existent file") << SRCDIR "tst_qfileinfo.cpp" << false << ""; QTest::newRow("link") << "link.lnk" << true << QFileInfo(SRCDIR "tst_qfileinfo.cpp").absoluteFilePath(); QTest::newRow("broken link") << "brokenlink.lnk" << true << QFileInfo("dummyfile").absoluteFilePath(); -#endif } void tst_QFileInfo::isSymLink() { -#ifndef NO_SYMLINKS QFETCH(QString, path); QFETCH(bool, isSymLink); QFETCH(QString, linkTarget); @@ -1131,10 +1135,8 @@ void tst_QFileInfo::isSymLink() QFileInfo fi(path); QCOMPARE(fi.isSymLink(), isSymLink); QCOMPARE(fi.symLinkTarget(), linkTarget); -#else - QSKIP("no symbolic link support on this platform", SkipAll); -#endif } +#endif void tst_QFileInfo::isHidden_data() { @@ -1475,6 +1477,8 @@ void tst_QFileInfo::isExecutable() } +// This is a OS X only test (unless you know more about filesystems, then maybe you should try it ;) +#ifdef Q_OS_MAC void tst_QFileInfo::testDecomposedUnicodeNames_data() { QTest::addColumn("filePath"); @@ -1489,32 +1493,21 @@ void tst_QFileInfo::testDecomposedUnicodeNames_data() static void createFileNative(const QString &filePath) { -#ifdef Q_OS_UNIX int fd = open(filePath.normalized(QString::NormalizationForm_D).toUtf8().constData(), O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR); if (fd < 0) { QFAIL("couldn't create file"); } else { close(fd); } -#else - Q_UNUSED(filePath); -#endif } static void removeFileNative(const QString &filePath) { -#ifdef Q_OS_UNIX unlink(filePath.normalized(QString::NormalizationForm_D).toUtf8().constData()); -#else - Q_UNUSED(filePath); -#endif } void tst_QFileInfo::testDecomposedUnicodeNames() { -#ifndef Q_OS_MAC - QSKIP("This is a OS X only test (unless you know more about filesystems, then maybe you should try it ;)", SkipAll); -#endif QFETCH(QString, filePath); createFileNative(filePath); @@ -1523,6 +1516,7 @@ void tst_QFileInfo::testDecomposedUnicodeNames() QTEST(file.exists(), "exists"); removeFileNative(filePath); } +#endif void tst_QFileInfo::equalOperator() const { diff --git a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp index 27e1c7d14b..b087c8fda0 100644 --- a/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp +++ b/tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp @@ -63,10 +63,14 @@ public slots: void cleanup(); private slots: void getSetCheck(); +#if !defined(Q_OS_WINCE) || !defined(WINCE_EMULATOR_TEST) void constructing_QTcpSocket(); +#endif void constructing_QFile(); void read_QByteArray(); +#if !defined(Q_OS_WINCE) || !defined(WINCE_EMULATOR_TEST) void unget(); +#endif void peek(); void peekAndRead(); @@ -113,11 +117,11 @@ void tst_QIODevice::cleanup() } //---------------------------------------------------------------------------------- + +// Networking tests in a WinCE emulator are unstable. +#if !defined(Q_OS_WINCE) || !defined(WINCE_EMULATOR_TEST) void tst_QIODevice::constructing_QTcpSocket() { -#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST) - QSKIP("Networking tests in a WinCE emulator are unstable", SkipAll); -#endif QTcpSocket socket; QIODevice *device = &socket; @@ -157,6 +161,7 @@ void tst_QIODevice::constructing_QTcpSocket() } QCOMPARE(*c1, *c2); } +#endif //---------------------------------------------------------------------------------- void tst_QIODevice::constructing_QFile() @@ -209,11 +214,11 @@ void tst_QIODevice::read_QByteArray() } //-------------------------------------------------------------------- + +// Networking tests in a WinCE emulator are unstable. +#if !defined(Q_OS_WINCE) || !defined(WINCE_EMULATOR_TEST) void tst_QIODevice::unget() { -#if defined(Q_OS_WINCE) && defined(WINCE_EMULATOR_TEST) - QSKIP("Networking tests in a WinCE emulator are unstable", SkipAll); -#endif QBuffer buffer; buffer.open(QBuffer::ReadWrite); buffer.write("ZXCV"); @@ -310,6 +315,7 @@ void tst_QIODevice::unget() socket.close(); } } +#endif //-------------------------------------------------------------------- void tst_QIODevice::peek() diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 73ac067c67..c6a5f39319 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -93,55 +93,72 @@ private slots: void simpleStart(); void execute(); void startDetached(); +#ifndef Q_OS_WIN void crashTest(); void crashTest2(); +#endif +#ifndef Q_OS_WINCE void echoTest_data(); void echoTest(); void echoTest2(); void echoTest_performance(); -#if defined Q_OS_WIN +#endif +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) void echoTestGui(); void batFiles_data(); void batFiles(); #endif void exitStatus_data(); void exitStatus(); +#ifndef Q_OS_WINCE void loopBackTest(); void readTimeoutAndThenCrash(); +#endif void waitForFinished(); +#ifndef Q_OS_WINCE void deadWhileReading(); void restartProcessDeadlock(); void closeWriteChannel(); void closeReadChannel(); void openModes(); void emitReadyReadOnlyWhenNewDataArrives(); +#endif void hardExit(); void softExit(); +#ifndef Q_OS_WINCE void softExitInSlots_data(); void softExitInSlots(); void mergedChannels(); void forwardedChannels(); void atEnd(); void atEnd2(); +#endif void processInAThread(); void processesInMultipleThreads(); +#ifndef Q_OS_WINCE void waitForFinishedWithTimeout(); void waitForReadyReadInAReadyReadSlot(); void waitForBytesWrittenInABytesWrittenSlot(); +#endif void spaceArgsTest_data(); void spaceArgsTest(); #if defined(Q_OS_WIN) void nativeArguments(); #endif void exitCodeTest(); +#ifndef Q_OS_WINCE void setEnvironment_data(); void setEnvironment(); void setProcessEnvironment_data(); void setProcessEnvironment(); +#endif void systemEnvironment(); +#ifndef Q_OS_WINCE void spaceInName(); +#endif void lockupsInStartDetached(); void waitForReadyReadForNonexistantProcess(); +#ifndef Q_OS_WINCE void setStandardInputFile(); void setStandardOutputFile_data(); void setStandardOutputFile(); @@ -149,9 +166,12 @@ private slots: void setStandardOutputProcess(); void removeFileWhileProcessIsRunning(); void fileWriterProcess(); +#endif void detachedWorkingDirectoryAndPid(); +#ifndef Q_OS_WINCE void switchReadChannels(); void setWorkingDirectory(); +#endif void startFinishStartFinish(); void invalidProgramString_data(); void invalidProgramString(); @@ -167,8 +187,10 @@ protected slots: void readFromProcess(); void exitLoopSlot(); void restartProcess(); +#ifndef Q_OS_WINCE void waitForReadyReadInAReadyReadSlotSlot(); void waitForBytesWrittenInABytesWrittenSlotSlot(); +#endif private: QProcess *process; @@ -308,12 +330,12 @@ void tst_QProcess::readFromProcess() } //----------------------------------------------------------------------------- + +// This test opens a crash dialog on Windows. +#ifndef Q_OS_WIN void tst_QProcess::crashTest() { qRegisterMetaType("QProcess::ProcessState"); -#ifdef Q_OS_WIN - QSKIP("This test opens a crash dialog on Windows", SkipSingle); -#endif process = new QProcess; QSignalSpy stateSpy(process, SIGNAL(stateChanged(QProcess::ProcessState))); process->start("testProcessCrash/testProcessCrash"); @@ -343,13 +365,14 @@ void tst_QProcess::crashTest() QCOMPARE(qVariantValue(stateSpy.at(1).at(0)), QProcess::Running); QCOMPARE(qVariantValue(stateSpy.at(2).at(0)), QProcess::NotRunning); } +#endif //----------------------------------------------------------------------------- + +// This test opens a crash dialog on Windows. +#ifndef Q_OS_WIN void tst_QProcess::crashTest2() { -#ifdef Q_OS_WIN - QSKIP("This test opens a crash dialog on Windows", SkipSingle); -#endif process = new QProcess; process->start("testProcessCrash/testProcessCrash"); QVERIFY(process->waitForStarted(5000)); @@ -377,8 +400,12 @@ void tst_QProcess::crashTest2() delete process; process = 0; } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::echoTest_data() { QTest::addColumn("input"); @@ -394,12 +421,9 @@ void tst_QProcess::echoTest_data() } //----------------------------------------------------------------------------- + void tst_QProcess::echoTest() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QFETCH(QByteArray, input); process = new QProcess; @@ -444,6 +468,7 @@ void tst_QProcess::echoTest() delete process; process = 0; } +#endif //----------------------------------------------------------------------------- void tst_QProcess::exitLoopSlot() @@ -452,12 +477,11 @@ void tst_QProcess::exitLoopSlot() } //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::echoTest2() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - process = new QProcess; connect(process, SIGNAL(readyRead()), this, SLOT(exitLoopSlot())); @@ -501,14 +525,14 @@ void tst_QProcess::echoTest2() delete process; process = 0; } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::echoTest_performance() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QProcess process; #ifdef Q_OS_MAC process.start("testProcessLoopback/testProcessLoopback.app"); @@ -554,15 +578,14 @@ void tst_QProcess::echoTest_performance() process.closeWriteChannel(); QVERIFY(process.waitForFinished()); } +#endif -#if defined Q_OS_WIN //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE, and neither are batch files. +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) void tst_QProcess::echoTestGui() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QProcess process; process.start("testProcessEchoGui/testProcessEchoGui"); @@ -589,9 +612,6 @@ void tst_QProcess::batFiles_data() void tst_QProcess::batFiles() { -#if defined(Q_OS_WINCE) - QSKIP("Batch files are not supported on Windows CE", SkipAll); -#endif QFETCH(QString, batFile); QFETCH(QByteArray, output); @@ -605,7 +625,6 @@ void tst_QProcess::batFiles() QVERIFY(proc.readAll().startsWith(output)); } - #endif //----------------------------------------------------------------------------- @@ -657,12 +676,11 @@ void tst_QProcess::exitStatus() process = 0; } //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::loopBackTest() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - process = new QProcess; #ifdef Q_OS_MAC process->start("testProcessEcho/testProcessEcho.app"); @@ -685,14 +703,14 @@ void tst_QProcess::loopBackTest() delete process; process = 0; } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::readTimeoutAndThenCrash() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - process = new QProcess; #ifdef Q_OS_MAC process->start("testProcessEcho/testProcessEcho.app"); @@ -722,6 +740,7 @@ void tst_QProcess::readTimeoutAndThenCrash() delete process; process = 0; } +#endif void tst_QProcess::waitForFinished() { @@ -751,13 +770,10 @@ void tst_QProcess::waitForFinished() QCOMPARE(process.error(), QProcess::FailedToStart); } - +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::deadWhileReading() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QProcess process; #ifdef Q_OS_MAC @@ -775,14 +791,14 @@ void tst_QProcess::deadWhileReading() QCOMPARE(output.count("\n"), 10*1024); process.waitForFinished(); } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::restartProcessDeadlock() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - // The purpose of this test is to detect whether restarting a // process in the finished() connected slot causes a deadlock // because of the way QProcessManager uses its locks. @@ -804,6 +820,7 @@ void tst_QProcess::restartProcessDeadlock() QCOMPARE(process->write("", 1), qlonglong(1)); QVERIFY(process->waitForFinished(5000)); } +#endif void tst_QProcess::restartProcess() { @@ -815,12 +832,11 @@ void tst_QProcess::restartProcess() } //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::closeWriteChannel() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QProcess more; more.start("testProcessEOF/testProcessEOF"); @@ -842,14 +858,14 @@ void tst_QProcess::closeWriteChannel() more.write("q"); QVERIFY(more.waitForFinished(5000)); } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::closeReadChannel() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - for (int i = 0; i < 10; ++i) { QProcess::ProcessChannel channel1 = QProcess::StandardOutput; QProcess::ProcessChannel channel2 = QProcess::StandardError; @@ -879,14 +895,14 @@ void tst_QProcess::closeReadChannel() QVERIFY(proc.waitForFinished(5000)); } } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::openModes() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QProcess proc; QVERIFY(!proc.isOpen()); QVERIFY(proc.openMode() == QProcess::NotOpen); @@ -929,14 +945,14 @@ void tst_QProcess::openModes() QVERIFY(!proc.isWritable()); QCOMPARE(proc.state(), QProcess::NotRunning); } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QProcess proc; connect(&proc, SIGNAL(readyRead()), this, SLOT(exitLoopSlot())); QSignalSpy spy(&proc, SIGNAL(readyRead())); @@ -968,6 +984,7 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives() proc.write("", 1); QVERIFY(proc.waitForFinished(5000)); } +#endif //----------------------------------------------------------------------------- void tst_QProcess::hardExit() @@ -1014,6 +1031,8 @@ void tst_QProcess::softExit() QCOMPARE(int(proc.error()), int(QProcess::UnknownError)); } +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE class SoftExitProcess : public QProcess { Q_OBJECT @@ -1080,6 +1099,7 @@ private: }; //----------------------------------------------------------------------------- + void tst_QProcess::softExitInSlots_data() { QTest::addColumn("appName"); @@ -1097,12 +1117,9 @@ void tst_QProcess::softExitInSlots_data() } //----------------------------------------------------------------------------- + void tst_QProcess::softExitInSlots() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QFETCH(QString, appName); for (int i = 0; i < 5; ++i) { @@ -1114,14 +1131,14 @@ void tst_QProcess::softExitInSlots() QVERIFY(proc.waitedForFinished); } } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::mergedChannels() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QProcess process; process.setReadChannelMode(QProcess::MergedChannels); QCOMPARE(process.readChannelMode(), QProcess::MergedChannels); @@ -1144,14 +1161,14 @@ void tst_QProcess::mergedChannels() process.closeWriteChannel(); QVERIFY(process.waitForFinished(5000)); } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::forwardedChannels() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QProcess process; process.setReadChannelMode(QProcess::ForwardedChannels); QCOMPARE(process.readChannelMode(), QProcess::ForwardedChannels); @@ -1170,15 +1187,14 @@ void tst_QProcess::forwardedChannels() process.closeWriteChannel(); QVERIFY(process.waitForFinished(5000)); } - +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::atEnd() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QProcess process; #ifdef Q_OS_MAC @@ -1200,6 +1216,7 @@ void tst_QProcess::atEnd() process.write("", 1); QVERIFY(process.waitForFinished(5000)); } +#endif class TestThread : public QThread { @@ -1276,12 +1293,11 @@ void tst_QProcess::processesInMultipleThreads() } //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::waitForFinishedWithTimeout() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - process = new QProcess(this); #ifdef Q_OS_MAC @@ -1300,14 +1316,14 @@ void tst_QProcess::waitForFinishedWithTimeout() delete process; process = 0; } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::waitForReadyReadInAReadyReadSlot() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - process = new QProcess(this); connect(process, SIGNAL(readyRead()), this, SLOT(waitForReadyReadInAReadyReadSlotSlot())); connect(process, SIGNAL(finished(int)), this, SLOT(exitLoopSlot())); @@ -1333,27 +1349,27 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot() delete process; process = 0; } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - bytesAvailable = process->bytesAvailable(); process->write("bar", 4); QVERIFY(process->waitForReadyRead(5000)); QTestEventLoop::instance().exitLoop(); } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - process = new QProcess(this); connect(process, SIGNAL(bytesWritten(qint64)), this, SLOT(waitForBytesWrittenInABytesWrittenSlotSlot())); bytesAvailable = 0; @@ -1378,18 +1394,19 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot() delete process; process = 0; } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - process->write("b"); QVERIFY(process->waitForBytesWritten(5000)); QTestEventLoop::instance().exitLoop(); } +#endif //----------------------------------------------------------------------------- void tst_QProcess::spaceArgsTest_data() @@ -1670,12 +1687,11 @@ void tst_QProcess::failToStartWithEventLoop() } //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::removeFileWhileProcessIsRunning() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QFile file("removeFile.txt"); QVERIFY(file.open(QFile::WriteOnly)); @@ -1693,8 +1709,12 @@ void tst_QProcess::removeFileWhileProcessIsRunning() process.write("", 1); QVERIFY(process.waitForFinished(5000)); } +#endif //----------------------------------------------------------------------------- + +// WinCE doesn't support environment variables. +#ifndef Q_OS_WINCE void tst_QProcess::setEnvironment_data() { QTest::addColumn("name"); @@ -1714,10 +1734,6 @@ void tst_QProcess::setEnvironment_data() void tst_QProcess::setEnvironment() { -#if defined (Q_OS_WINCE) - QSKIP("OS doesn't support environment variables", SkipAll); -#endif - // make sure our environment variables are correct QVERIFY(qgetenv("tst_QProcess").isEmpty()); QVERIFY(!qgetenv("PATH").isEmpty()); @@ -1773,8 +1789,12 @@ void tst_QProcess::setEnvironment() QCOMPARE(process.readAll(), value.toLocal8Bit()); } } +#endif //----------------------------------------------------------------------------- + +// WinCE doesn't support environment variables. +#ifndef Q_OS_WINCE void tst_QProcess::setProcessEnvironment_data() { setEnvironment_data(); @@ -1782,10 +1802,6 @@ void tst_QProcess::setProcessEnvironment_data() void tst_QProcess::setProcessEnvironment() { -#if defined (Q_OS_WINCE) - QSKIP("OS doesn't support environment variables", SkipAll); -#endif - // make sure our environment variables are correct QVERIFY(qgetenv("tst_QProcess").isEmpty()); QVERIFY(!qgetenv("PATH").isEmpty()); @@ -1816,6 +1832,8 @@ void tst_QProcess::setProcessEnvironment() QCOMPARE(process.readAll(), value.toLocal8Bit()); } } +#endif + //----------------------------------------------------------------------------- void tst_QProcess::systemEnvironment() { @@ -1833,17 +1851,18 @@ void tst_QProcess::systemEnvironment() } //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::spaceInName() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif QProcess process; process.start("test Space In Name/testSpaceInName", QStringList()); QVERIFY(process.waitForStarted()); process.write("", 1); QVERIFY(process.waitForFinished()); } +#endif //----------------------------------------------------------------------------- void tst_QProcess::lockupsInStartDetached() @@ -1859,12 +1878,11 @@ void tst_QProcess::lockupsInStartDetached() } //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::atEnd2() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QProcess process; #ifdef Q_OS_MAC @@ -1881,6 +1899,7 @@ void tst_QProcess::atEnd2() } QCOMPARE(lines.size(), 7); } +#endif //----------------------------------------------------------------------------- void tst_QProcess::waitForReadyReadForNonexistantProcess() @@ -1904,12 +1923,11 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() } //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::setStandardInputFile() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - static const char data[] = "A bunch\1of\2data\3\4\5\6\7..."; QProcess process; QFile file("data"); @@ -1930,8 +1948,12 @@ void tst_QProcess::setStandardInputFile() QCOMPARE(all.size(), int(sizeof data) - 1); // testProcessEcho drops the ending \0 QVERIFY(all == data); } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::setStandardOutputFile_data() { QTest::addColumn("channelToTest"); @@ -1962,10 +1984,6 @@ void tst_QProcess::setStandardOutputFile_data() void tst_QProcess::setStandardOutputFile() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - static const char data[] = "Original data. "; static const char testdata[] = "Test data."; @@ -2016,8 +2034,11 @@ void tst_QProcess::setStandardOutputFile() QCOMPARE(all.size(), expectedsize); } +#endif //----------------------------------------------------------------------------- +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::setStandardOutputProcess_data() { QTest::addColumn("merged"); @@ -2027,10 +2048,6 @@ void tst_QProcess::setStandardOutputProcess_data() void tst_QProcess::setStandardOutputProcess() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QProcess source; QProcess sink; @@ -2058,14 +2075,14 @@ void tst_QProcess::setStandardOutputProcess() else QCOMPARE(all, QByteArray("HHeelllloo,, WWoorrlldd")); } +#endif //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::fileWriterProcess() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif - QString stdinStr; for (int i = 0; i < 5000; ++i) stdinStr += QString::fromLatin1("%1 -- testing testing 1 2 3\n").arg(i); @@ -2087,6 +2104,7 @@ void tst_QProcess::fileWriterProcess() QCOMPARE(QFile("fileWriterProcess.txt").size(), qint64(stdinStr.size())); } while (stopWatch.elapsed() < 3000); } +#endif //----------------------------------------------------------------------------- void tst_QProcess::detachedWorkingDirectoryAndPid() @@ -2133,11 +2151,11 @@ void tst_QProcess::detachedWorkingDirectoryAndPid() } //----------------------------------------------------------------------------- + +// Reading and writing to a process is not supported on Qt/CE. +#ifndef Q_OS_WINCE void tst_QProcess::switchReadChannels() { -#ifdef Q_OS_WINCE - QSKIP("Reading and writing to a process is not supported on Qt/CE", SkipAll); -#endif const char data[] = "ABCD"; QProcess process; @@ -2166,13 +2184,14 @@ void tst_QProcess::switchReadChannels() process.setReadChannel(QProcess::StandardOutput); QCOMPARE(process.read(1), QByteArray("D")); } +#endif //----------------------------------------------------------------------------- + +// Windows CE does not support working directory logic. +#ifndef Q_OS_WINCE void tst_QProcess::setWorkingDirectory() { -#ifdef Q_OS_WINCE - QSKIP("Windows CE does not support working directory logic", SkipAll); -#endif process = new QProcess; process->setWorkingDirectory("test"); #ifdef Q_OS_MAC @@ -2191,6 +2210,7 @@ void tst_QProcess::setWorkingDirectory() delete process; process = 0; } +#endif //----------------------------------------------------------------------------- void tst_QProcess::startFinishStartFinish() diff --git a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp index 1c6bf6f19c..1827f8b2d7 100644 --- a/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp +++ b/tests/auto/corelib/io/qprocessenvironment/tst_qprocessenvironment.cpp @@ -57,7 +57,9 @@ private slots: void caseSensitivity(); void systemEnvironment(); +#ifndef Q_OS_WINCE void putenv(); +#endif }; void tst_QProcessEnvironment::operator_eq() @@ -276,11 +278,10 @@ void tst_QProcessEnvironment::systemEnvironment() #endif } +// Windows CE has no environment. +#ifndef Q_OS_WINCE void tst_QProcessEnvironment::putenv() { -#ifdef Q_OS_WINCE - QSKIP("Windows CE has no environment", SkipAll); -#else static const char envname[] = "WE_RE_SETTING_THIS_ENVIRONMENT_VARIABLE"; static bool testRan = false; @@ -312,8 +313,8 @@ void tst_QProcessEnvironment::putenv() QVERIFY(eAfter.contains(lower)); QCOMPARE(eAfter.value(lower), QString("Hello, World")); # endif -#endif } +#endif QTEST_MAIN(tst_QProcessEnvironment) diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 301f40b152..571f633c4b 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -101,8 +101,10 @@ private slots: void testEscapes(); void testCaseSensitivity_data(); void testCaseSensitivity(); +#if defined(QT_BUILD_INTERNAL) && !defined(Q_OS_WIN) void testErrorHandling_data(); void testErrorHandling(); +#endif void testIniParsing_data(); void testIniParsing(); void testChildKeysAndGroups_data(); @@ -126,7 +128,7 @@ private slots: void setPath(); void setDefaultFormat(); void dontCreateNeedlessPaths(); -#if !defined(Q_OS_WIN) +#if !defined(Q_OS_WIN) && !defined(QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER) void dontReorderIniKeysNeedlessly(); #endif #if defined(Q_OS_WIN) @@ -649,6 +651,8 @@ void tst_QSettings::testByteArray() } } +// Windows doesn't support most file modes, including read-only directories, so this test is moot. +#if defined(QT_BUILD_INTERNAL) && !defined(Q_OS_WIN) void tst_QSettings::testErrorHandling_data() { QTest::addColumn("filePerms"); // -1 means file should not exist @@ -679,10 +683,7 @@ void tst_QSettings::testErrorHandling_data() void tst_QSettings::testErrorHandling() { -#ifdef QT_BUILD_INTERNAL -#ifdef Q_OS_WIN - QSKIP("Windows doesn't support most file modes, including read-only directories, so this test is moot.", SkipAll); -#elif defined(Q_OS_UNIX) +#if defined(Q_OS_UNIX) if (::getuid() == 0) QSKIP("Running this test as root doesn't work, since file perms do not bother him", SkipAll); #else @@ -744,9 +745,9 @@ void tst_QSettings::testErrorHandling() QCOMPARE(settings.value("alpha/beta/geometry").toInt(), 100); QCOMPARE((int)settings.status(), statusAfterSetAndSync); } -#endif // !Q_OS_WIN #endif } +#endif Q_DECLARE_METATYPE(QVariant) Q_DECLARE_METATYPE(QSettings::Status) @@ -2999,13 +3000,11 @@ void tst_QSettings::dontCreateNeedlessPaths() QVERIFY(!fileInfo.dir().exists()); } -#if !defined(Q_OS_WIN) +// if QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER is defined, +// the Qt build does not preserve ordering, as a code size optimization. +#if !defined(Q_OS_WIN) && !defined(QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER) void tst_QSettings::dontReorderIniKeysNeedlessly() { -#ifdef QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER - QSKIP("This Qt build does not preserve ordering, as a code size optimization.", SkipAll); -#endif - /* This is a very strong test. It asserts that modifying resourcefile2.ini will lead to the exact contents of diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index 1348e6d6c7..5ab71de9d1 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -198,16 +198,20 @@ private slots: void octTest(); void zeroTermination(); void ws_manipulator(); +#ifndef Q_OS_WINCE void stillOpenWhenAtEnd(); +#endif void readNewlines_data(); void readNewlines(); void seek(); void pos(); void pos2(); void pos3LargeFile(); +#ifndef Q_OS_WINCE void readStdin(); void readAllFromStdin(); void readLineFromStdin(); +#endif void read(); void qbool(); void forcePoint(); @@ -1103,6 +1107,9 @@ void tst_QTextStream::ws_manipulator() } // ------------------------------------------------------------------------------ + +// Qt/CE: Cannot test network on emulator. +#ifndef Q_OS_WINCE void tst_QTextStream::stillOpenWhenAtEnd() { int argc = 0; @@ -1116,9 +1123,6 @@ void tst_QTextStream::stillOpenWhenAtEnd() while (!stream.readLine().isNull()) {} QVERIFY(file.isOpen()); -#ifdef Q_OS_WINCE - QSKIP("Qt/CE: Cannot test network on emulator", SkipAll); -#endif QTcpSocket socket; socket.connectToHost(QtNetworkSettings::serverName(), 143); QVERIFY(socket.waitForReadyRead(5000)); @@ -1127,6 +1131,7 @@ void tst_QTextStream::stillOpenWhenAtEnd() while (!stream2.readLine().isNull()) {} QVERIFY(socket.isOpen()); } +#endif // ------------------------------------------------------------------------------ void tst_QTextStream::readNewlines_data() @@ -1397,11 +1402,11 @@ void tst_QTextStream::pos3LargeFile() } // ------------------------------------------------------------------------------ + +// Qt/CE has no stdin/out support for processes. +#ifndef Q_OS_WINCE void tst_QTextStream::readStdin() { -#if defined(Q_OS_WINCE) - QSKIP("Qt/CE has no stdin/out support for processes", SkipAll); -#endif QProcess stdinProcess; stdinProcess.start("stdinProcess/stdinProcess"); stdinProcess.setReadChannel(QProcess::StandardError); @@ -1421,13 +1426,14 @@ void tst_QTextStream::readStdin() QCOMPARE(b, 2); QCOMPARE(c, 3); } +#endif // ------------------------------------------------------------------------------ + +// Qt/CE has no stdin/out support for processes. +#ifndef Q_OS_WINCE void tst_QTextStream::readAllFromStdin() { -#if defined(Q_OS_WINCE) - QSKIP("Qt/CE has no stdin/out support for processes", SkipAll); -#endif QProcess stdinProcess; stdinProcess.start("readAllStdinProcess/readAllStdinProcess", QIODevice::ReadWrite | QIODevice::Text); stdinProcess.setReadChannel(QProcess::StandardError); @@ -1442,13 +1448,14 @@ void tst_QTextStream::readAllFromStdin() QChar quoteChar('"'); QCOMPARE(stream.readAll(), QString::fromLatin1("%1hello world%2 \n").arg(quoteChar).arg(quoteChar)); } +#endif // ------------------------------------------------------------------------------ + +// Qt/CE has no stdin/out support for processes. +#ifndef Q_OS_WINCE void tst_QTextStream::readLineFromStdin() { -#if defined(Q_OS_WINCE) - QSKIP("Qt/CE has no stdin/out support for processes", SkipAll); -#endif QProcess stdinProcess; stdinProcess.start("readLineStdinProcess/readLineStdinProcess", QIODevice::ReadWrite | QIODevice::Text); stdinProcess.setReadChannel(QProcess::StandardError); @@ -1465,6 +1472,7 @@ void tst_QTextStream::readLineFromStdin() QVERIFY(stdinProcess.waitForFinished(5000)); } +#endif // ------------------------------------------------------------------------------ void tst_QTextStream::read() -- cgit v1.2.3