From 95cebd34ebc5b4d39b11dc91610309a35e488663 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 27 Sep 2011 19:53:01 +1000 Subject: Remove Symbian-specific code from tests. Symbian is not a supported platform for Qt5, so this code is no longer required. Change-Id: I1172e6a42d518490e63e9599bf10579df08259aa Reviewed-on: http://codereview.qt-project.org/5657 Reviewed-by: Rohan McGovern --- tests/auto/corelib/io/qfile/qfile.pro | 4 +- tests/auto/corelib/io/qfile/test/test.pro | 9 +- tests/auto/corelib/io/qfile/tst_qfile.cpp | 228 +++--------------------------- 3 files changed, 26 insertions(+), 215 deletions(-) (limited to 'tests/auto/corelib/io/qfile') diff --git a/tests/auto/corelib/io/qfile/qfile.pro b/tests/auto/corelib/io/qfile/qfile.pro index f41d32789a..8bb142c5b4 100644 --- a/tests/auto/corelib/io/qfile/qfile.pro +++ b/tests/auto/corelib/io/qfile/qfile.pro @@ -1,10 +1,10 @@ TEMPLATE = subdirs -wince*|symbian:{ +wince* { SUBDIRS = test } else { SUBDIRS = test stdinprocess } -!symbian:SUBDIRS += largefile +SUBDIRS += largefile CONFIG += parallel_test diff --git a/tests/auto/corelib/io/qfile/test/test.pro b/tests/auto/corelib/io/qfile/test/test.pro index f4ec12f874..366432c57e 100644 --- a/tests/auto/corelib/io/qfile/test/test.pro +++ b/tests/auto/corelib/io/qfile/test/test.pro @@ -1,7 +1,7 @@ load(qttest_p4) SOURCES += ../tst_qfile.cpp -wince*|symbian { +wince* { QT = core gui files.files += ..\\dosfile.txt ..\\noendofline.txt ..\\testfile.txt \ ..\\testlog.txt ..\\two.dots.file ..\\tst_qfile.cpp \ @@ -16,9 +16,6 @@ wince*|symbian { wince* { SOURCES += $$QT_SOURCE_TREE/src/corelib/kernel/qfunctions_wince.cpp # needed for QT_OPEN DEFINES += SRCDIR=\\\"\\\" -} else:symbian { - # do not define SRCDIR at all - TARGET.EPOCHEAPSIZE = 0x100000 0x3000000 } else { QT = core network DEFINES += SRCDIR=\\\"$$PWD/../\\\" @@ -37,8 +34,4 @@ win32 { LIBS+=-lole32 -luuid } -symbian { - LIBS+=-lefsrv -} - mac*:CONFIG+=insignificant_test diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index f2031497ed..c245661b14 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -50,7 +50,7 @@ #include #include #include -#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) +#if !defined(Q_OS_WINCE) #include #endif #include @@ -70,18 +70,12 @@ #elif defined(Q_OS_WINCE) # include # include -#elif defined(Q_OS_SYMBIAN) -# include #endif #include #include #include "../../../network-settings.h" -#if defined(Q_OS_SYMBIAN) -# define SRCDIR "" -#endif - #ifndef STDIN_FILENO #define STDIN_FILENO 0 #endif @@ -218,10 +212,7 @@ private slots: void resize(); void objectConstructors(); -#ifdef Q_OS_SYMBIAN - void platformSecurity_data(); - void platformSecurity(); -#endif + void caseSensitivity(); void autocloseHandle(); @@ -242,9 +233,6 @@ private: OpenQFile, OpenFd, OpenStream, -#ifdef Q_OS_SYMBIAN - OpenRFile, -#endif NumberOfFileTypes }; @@ -281,33 +269,6 @@ private: return stream_ && file.open(stream_, mode, handleFlags); } -#ifdef Q_OS_SYMBIAN - bool openRFile(QFile &file, QIODevice::OpenMode mode, QFile::FileHandleFlags handleFlags) - { - //connect file server first time - if (!rfs_.Handle() && rfs_.Connect() != KErrNone) - return false; - //symbian does not like ./ in filenames, so open by absolute path - QString fileName(QDir::toNativeSeparators(QFileInfo(file).absoluteFilePath())); - TPtrC fn(fileName.utf16(), fileName.length()); - TInt smode = 0; - if (mode & QIODevice::WriteOnly) - smode |= EFileWrite; - if (mode & QIODevice::ReadOnly) - smode |= EFileRead; - TInt r; - if ((mode & QIODevice::Truncate) || (!(mode & QIODevice::ReadOnly) && !(mode & QIODevice::Append))) { - r = rfile_.Replace(rfs_, fn, smode); - } else { - r = rfile_.Open(rfs_, fn, smode); - if (r == KErrNotFound && (mode & QIODevice::WriteOnly)) { - r = rfile_.Create(rfs_, fn, smode); - } - } - return (r == KErrNone) && file.open(rfile_, mode, handleFlags); - } -#endif - bool openFile(QFile &file, QIODevice::OpenMode mode, FileType type = OpenQFile, QFile::FileHandleFlags handleFlags = QFile::DontCloseHandle) { if (mode & QIODevice::WriteOnly && !file.exists()) @@ -329,10 +290,7 @@ private: case OpenStream: return openStream(file, mode, handleFlags); -#ifdef Q_OS_SYMBIAN - case OpenRFile: - return openRFile(file, mode, handleFlags); -#endif + case NumberOfFileTypes: break; } @@ -348,10 +306,6 @@ private: QT_CLOSE(fd_); if (stream_) ::fclose(stream_); -#ifdef Q_OS_SYMBIAN - if (rfile_.SubSessionHandle()) - rfile_.Close(); -#endif fd_ = -1; stream_ = 0; @@ -359,10 +313,6 @@ private: int fd_; FILE *stream_; -#ifdef Q_OS_SYMBIAN - RFs rfs_; - RFile rfile_; -#endif }; tst_QFile::tst_QFile() @@ -562,10 +512,7 @@ void tst_QFile::open() QFETCH( bool, ok ); -#if defined(Q_OS_SYMBIAN) - if (qstrcmp(QTest::currentDataTag(), "noreadfile") == 0) - QSKIP("Symbian does not support non-readable files", SkipSingle); -#elif defined(Q_OS_UNIX) +#if defined(Q_OS_UNIX) if (::getuid() == 0) // root and Chuck Norris don't care for file permissions. Skip. QSKIP("Running this test as root doesn't make sense", SkipAll); @@ -897,8 +844,8 @@ void tst_QFile::readAllBuffer() void tst_QFile::readAllStdin() { -#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) - QSKIP("Currently no stdin/out supported for Windows CE or Symbian", SkipAll); +#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); @@ -924,8 +871,8 @@ void tst_QFile::readAllStdin() void tst_QFile::readLineStdin() { -#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) - QSKIP("Currently no stdin/out supported for Windows CE or Symbian", SkipAll); +#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); @@ -967,7 +914,7 @@ void tst_QFile::readLineStdin() void tst_QFile::readLineStdin_lineByLine() { -#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) +#if defined(Q_OS_WINCE) QSKIP("Currently no stdin/out supported for Windows CE", SkipAll); #endif #if defined(QT_NO_PROCESS) @@ -1095,7 +1042,7 @@ void tst_QFile::ungetChar() void tst_QFile::invalidFile_data() { QTest::addColumn("fileName"); -#if !defined(Q_WS_WIN) && !defined(Q_OS_SYMBIAN) +#if !defined(Q_WS_WIN) QTest::newRow( "x11" ) << QString( "qwe//" ); #else QTest::newRow( "colon1" ) << QString( "fail:invalid" ); @@ -1165,10 +1112,6 @@ void tst_QFile::permissions_data() void tst_QFile::permissions() { -#if defined(Q_OS_SYMBIAN) - if (qstrcmp(QTest::currentDataTag(), "data0") == 0) - QSKIP("Symbian does not have execution permissions", SkipSingle); -#endif QFETCH(QString, file); QFETCH(uint, perms); QFETCH(bool, expected); @@ -1261,11 +1204,8 @@ void tst_QFile::copyShouldntOverwrite() QFile::remove("tst_qfile.cpy"); QFile file(SRCDIR "tst_qfile.cpp"); QVERIFY(file.copy("tst_qfile.cpy")); -#if defined(Q_OS_SYMBIAN) - bool ok = QFile::setPermissions("tst_qfile.cpy", QFile::WriteUser); -#else - bool ok = QFile::setPermissions("tst_qfile.cpy", QFile::WriteOther); -#endif + + bool ok = QFile::setPermissions("tst_qfile.cpy", QFile::WriteOther); QVERIFY(ok); QVERIFY(!file.copy("tst_qfile.cpy")); QFile::remove("tst_qfile.cpy"); @@ -1352,9 +1292,6 @@ static QString getWorkingDirectoryForLink(const QString &linkFileName) void tst_QFile::link() { -#if defined(Q_OS_SYMBIAN) - QSKIP("Symbian does not support links", SkipAll); -#endif QFile::remove("myLink.lnk"); QFileInfo info1(SRCDIR "tst_qfile.cpp"); @@ -1383,9 +1320,6 @@ void tst_QFile::link() void tst_QFile::linkToDir() { -#if defined(Q_OS_SYMBIAN) - QSKIP("Symbian does not support linking to directories", SkipAll); -#endif QFile::remove("myLinkToDir.lnk"); QDir dir; dir.mkdir("myDir"); @@ -1406,9 +1340,6 @@ void tst_QFile::linkToDir() void tst_QFile::absolutePathLinkToRelativePath() { -#if defined(Q_OS_SYMBIAN) - QSKIP("Symbian does not support links", SkipAll); -#endif QFile::remove("myDir/test.txt"); QFile::remove("myDir/myLink.lnk"); QDir dir; @@ -1420,7 +1351,7 @@ void tst_QFile::absolutePathLinkToRelativePath() #else QVERIFY(QFile::link("myDir/test.txt", "myDir/myLink.lnk")); #endif - QEXPECT_FAIL("", "Symlinking using relative paths is currently different on Windows and Unix/Symbian", Continue); + QEXPECT_FAIL("", "Symlinking using relative paths is currently different on Windows and Unix", Continue); QCOMPARE(QFileInfo(QFile(QFileInfo("myDir/myLink.lnk").absoluteFilePath()).symLinkTarget()).absoluteFilePath(), QFileInfo("myDir/test.txt").absoluteFilePath()); @@ -1431,29 +1362,15 @@ void tst_QFile::absolutePathLinkToRelativePath() void tst_QFile::readBrokenLink() { -#if defined(Q_OS_SYMBIAN) - QSKIP("Symbian does not support links", SkipAll); -#endif QFile::remove("myLink2.lnk"); QFileInfo info1("file12"); -#if defined(Q_OS_SYMBIAN) - // In Symbian can't link to nonexisting file directly, so create the file temporarily - QFile tempFile("file12"); - tempFile.open(QIODevice::WriteOnly); - tempFile.link("myLink2.lnk"); - tempFile.remove(); -#else QVERIFY(QFile::link("file12", "myLink2.lnk")); -#endif QFileInfo info2("myLink2.lnk"); QVERIFY(info2.isSymLink()); QCOMPARE(info2.symLinkTarget(), info1.absoluteFilePath()); QVERIFY(QFile::remove(info2.absoluteFilePath())); - -#if !defined(Q_OS_SYMBIAN) QVERIFY(QFile::link("ole/..", "myLink2.lnk")); QCOMPARE(QFileInfo("myLink2.lnk").symLinkTarget(), QDir::currentPath()); -#endif } void tst_QFile::readTextFile_data() @@ -1666,7 +1583,7 @@ void tst_QFile::bufferedRead() void tst_QFile::isSequential() { -#if defined (Q_OS_WIN) || defined(Q_OS_SYMBIAN) +#if defined (Q_OS_WIN) QSKIP("Unix only test.", SkipAll); #endif @@ -2005,7 +1922,7 @@ void tst_QFile::longFileName() } { QFile file(fileName); -#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) +#if defined(Q_OS_WINCE) QEXPECT_FAIL("244 chars", "Full pathname must be less than 260 chars", Abort); QEXPECT_FAIL("244 chars to absolutepath", "Full pathname must be less than 260 chars", Abort); #endif @@ -2268,9 +2185,6 @@ void tst_QFile::writeLargeDataBlock_data() QTest::newRow("localfile-QFile") << "./largeblockfile.txt" << (int)OpenQFile; QTest::newRow("localfile-Fd") << "./largeblockfile.txt" << (int)OpenFd; QTest::newRow("localfile-Stream") << "./largeblockfile.txt" << (int)OpenStream; -#ifdef Q_OS_SYMBIAN - QTest::newRow("localfile-RFile") << "./largeblockfile.txt" << (int)OpenRFile; -#endif #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) // Some semi-randomness to avoid collisions. @@ -2287,8 +2201,8 @@ static QByteArray getLargeDataBlock() if (array.isNull()) { -#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) - int resizeSize = 1024 * 1024; // WinCE and Symbian do not have much space +#if defined(Q_OS_WINCE) + int resizeSize = 1024 * 1024; // WinCE does not have much space #else int resizeSize = 64 * 1024 * 1024; #endif @@ -2439,7 +2353,7 @@ void tst_QFile::rename_data() QTest::newRow("a -> .") << QString("a") << QString(".") << false; QTest::newRow("renamefile -> renamefile") << QString("renamefile") << QString("renamefile") << false; QTest::newRow("renamefile -> noreadfile") << QString("renamefile") << QString("noreadfile") << false; -#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) +#if defined(Q_OS_UNIX) QTest::newRow("renamefile -> /etc/renamefile") << QString("renamefile") << QString("/etc/renamefile") << false; #endif QTest::newRow("renamefile -> renamedfile") << QString("renamefile") << QString("renamedfile") << true; @@ -2616,7 +2530,7 @@ void tst_QFile::standarderror() void tst_QFile::handle() { int fd; -#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) +#if !defined(Q_OS_WINCE) QFile file(SRCDIR "tst_qfile.cpp"); QVERIFY(file.open(QIODevice::ReadOnly)); fd = int(file.handle()); @@ -2666,9 +2580,6 @@ void tst_QFile::handle() void tst_QFile::nativeHandleLeaks() { -#ifdef Q_OS_SYMBIAN - QSKIP("test assumptions invalid for symbian", SkipAll); -#else int fd1, fd2; #ifdef Q_OS_WIN @@ -2710,7 +2621,6 @@ void tst_QFile::nativeHandleLeaks() #ifdef Q_OS_WIN QCOMPARE( handle2, handle1 ); #endif -#endif } void tst_QFile::readEof_data() @@ -2721,7 +2631,7 @@ void tst_QFile::readEof_data() QTest::newRow("buffered") << SRCDIR "testfile.txt" << 0; QTest::newRow("unbuffered") << SRCDIR "testfile.txt" << int(QIODevice::Unbuffered); -#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) +#if defined(Q_OS_UNIX) QTest::newRow("sequential,buffered") << "/dev/null" << 0; QTest::newRow("sequential,unbuffered") << "/dev/null" << int(QIODevice::Unbuffered); #endif @@ -2955,9 +2865,7 @@ void tst_QFile::map() file.close(); -#if defined(Q_OS_SYMBIAN) - if (false) // No permissions for user makes no sense in Symbian -#elif defined(Q_OS_UNIX) +#if defined(Q_OS_UNIX) if (::getuid() != 0) // root always has permissions #endif @@ -3120,7 +3028,7 @@ void tst_QFile::openStandardStreamsFileDescriptors() void tst_QFile::openStandardStreamsBufferedStreams() { -#if defined (Q_OS_WIN) || defined(Q_OS_SYMBIAN) +#if defined (Q_OS_WIN) QSKIP("Unix only test.", SkipAll); #endif // Using streams @@ -3173,9 +3081,6 @@ void tst_QFile::resize_data() QTest::newRow("native") << int(OpenQFile); QTest::newRow("fileno") << int(OpenFd); QTest::newRow("stream") << int(OpenStream); -#ifdef Q_OS_SYMBIAN - QTest::newRow("rfile") << int(OpenRFile); -#endif } void tst_QFile::resize() @@ -3201,65 +3106,9 @@ void tst_QFile::objectConstructors() QVERIFY(!file2->exists()); } -#ifdef Q_OS_SYMBIAN -void tst_QFile::platformSecurity_data() -{ - QTest::addColumn("file"); - QTest::addColumn("readable"); - QTest::addColumn("writable"); - - QString selfname = QCoreApplication::applicationFilePath(); - QString ownprivate = QCoreApplication::applicationDirPath(); - QString owndrive = selfname.left(2); - bool amiprivileged = RProcess().HasCapability(ECapabilityAllFiles); - QTest::newRow("resource") << owndrive + "/resource/apps/tst_qfile.rsc" << true << amiprivileged; - QTest::newRow("sys") << selfname << amiprivileged << false; - QTest::newRow("own private") << ownprivate + "/testfile.txt" << true << true; - QTest::newRow("other private") << owndrive + "/private/10003a3f/import/apps/tst_qfile_reg.rsc" << amiprivileged << amiprivileged; -} - -void tst_QFile::platformSecurity() -{ - QFETCH(QString,file); - QFETCH(bool,readable); - QFETCH(bool,writable); - - { - QFile f(file); - QCOMPARE(f.open(QIODevice::ReadOnly), readable); - } - - { - QFile f(file); - QCOMPARE(f.open(QIODevice::ReadOnly | QIODevice::Unbuffered), readable); - } - - //append mode used to avoid truncating the files. - { - QFile f(file); - QCOMPARE(f.open(QIODevice::WriteOnly | QIODevice::Append), writable); - } - - { - QFile f(file); - QCOMPARE(f.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Unbuffered), writable); - } - - { - QFile f(file); - QCOMPARE(f.open(QIODevice::ReadWrite), writable); - } - - { - QFile f(file); - QCOMPARE(f.open(QIODevice::ReadWrite | QIODevice::Unbuffered), writable); - } -} -#endif - void tst_QFile::caseSensitivity() { -#if defined(Q_OS_SYMBIAN) || defined(Q_OS_WIN) || defined(Q_OS_MAC) +#if defined(Q_OS_WIN) || defined(Q_OS_MAC) const bool caseSensitive = false; #else const bool caseSensitive = true; @@ -3313,37 +3162,6 @@ public: void tst_QFile::autocloseHandle() { -#ifdef Q_OS_SYMBIAN - // these tests are a bit different, because using a closed file handle results in a panic rather than error - { - QFile file("readonlyfile"); - QFile file2("readonlyfile"); - QVERIFY(openFile(file, QIODevice::ReadOnly, OpenRFile, QFile::AutoCloseHandle)); - // file is opened with mandatory lock, so opening again should fail - QVERIFY(!file2.open(QIODevice::ReadOnly)); - - file.close(); - // opening again should now succeed (because handle is closed) - QVERIFY(file2.open(QIODevice::ReadOnly)); - } - - { - QFile file("readonlyfile"); - QFile file2("readonlyfile"); - QVERIFY(openFile(file, QIODevice::ReadOnly, OpenRFile, QFile::DontCloseHandle)); - // file is opened with mandatory lock, so opening again should fail - QVERIFY(!file2.open(QIODevice::ReadOnly)); - - file.close(); - // opening again should still fail (because handle is not auto closed) - QVERIFY(!file2.open(QIODevice::ReadOnly)); - - rfile_.Close(); - // now it should succeed - QVERIFY(file2.open(QIODevice::ReadOnly)); - } -#endif - { QFile file("readonlyfile"); QVERIFY(openFile(file, QIODevice::ReadOnly, OpenFd, QFile::AutoCloseHandle)); -- cgit v1.2.3