From c3059391fea326b7115cf038ecdad8e820a0c2d5 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 9 May 2018 13:38:34 +0200 Subject: Make tests compile for Android MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This only enables compilation, it doesn't fix any test. Qt on Android supports process, but not TEST_HELPER_INSTALLS. See also acdd57cb for winrt. android-ndk-r10e is used to compile, see http://doc-snapshots.qt.io/qt5-5.11/androidgs.html . corelib/io/{qdir,qresourceengine} need to be fixed later. Done-with: Frederik Gladhorn Done-with: MÃ¥rten Nordheim Change-Id: I34b924c8ae5d46d6835b8f0a6606450920f4423b Reviewed-by: Thiago Macieira Reviewed-by: Frederik Gladhorn --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/auto/corelib/io/qfile/tst_qfile.cpp') diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index ad00e25e7d..c202923898 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -85,6 +85,12 @@ QT_END_NAMESPACE #include #include +#ifdef Q_OS_ANDROID +// Android introduces a braindamaged fileno macro that isn't +// compatible with the POSIX fileno or its own FILE type. +# undef fileno +#endif + #if defined(Q_OS_WIN) #include "../../../network-settings.h" #endif -- cgit v1.2.3 From 8757e6fee11fbd72c1a3ade1aea0800f63b966ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Wed, 6 Jun 2018 16:13:48 +0200 Subject: Android: Make tst_qfile pass By disabling the "stdinprocess"-related tests/code... ... but differently. After fixing my earlier mistakes I'm getting segmentation faults when it executes a couple different library calls after the QProcess object has started. Task-number: QTBUG-68596 Change-Id: Id42a1f939c000754a187dee90c4a4cdfec816232 Reviewed-by: Frederik Gladhorn Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'tests/auto/corelib/io/qfile/tst_qfile.cpp') diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index c202923898..6665200585 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -379,6 +379,12 @@ private: QString m_noEndOfLineFile; }; +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) + #define STDINPROCESS_NAME "libstdinprocess.so" +#else // !android || android_embedded + #define STDINPROCESS_NAME "stdinprocess" +#endif // android && !android_embededd + static const char noReadFile[] = "noreadfile"; static const char readOnlyFile[] = "readonlyfile"; @@ -448,7 +454,11 @@ void tst_QFile::initTestCase() { QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString())); #if QT_CONFIG(process) +#if defined(Q_OS_ANDROID) + m_stdinProcessDir = QCoreApplication::applicationDirPath(); +#else m_stdinProcessDir = QFINDTESTDATA("stdinprocess"); +#endif QVERIFY(!m_stdinProcessDir.isEmpty()); #endif m_testLogFile = QFINDTESTDATA("testlog.txt"); @@ -964,11 +974,14 @@ void tst_QFile::readAllStdin() #if !QT_CONFIG(process) QSKIP("No qprocess support", SkipAll); #else +#if defined(Q_OS_ANDROID) + QSKIP("This test crashes when doing nanosleep. See QTBUG-69034."); +#endif QByteArray lotsOfData(1024, '@'); // 10 megs QProcess process; StdinReaderProcessGuard processGuard(&process); - process.start(m_stdinProcessDir + QStringLiteral("/stdinprocess"), QStringList(QStringLiteral("all"))); + process.start(m_stdinProcessDir + QStringLiteral("/" STDINPROCESS_NAME), QStringList(QStringLiteral("all"))); QVERIFY2(process.waitForStarted(), qPrintable(process.errorString())); for (int i = 0; i < 5; ++i) { QTest::qWait(1000); @@ -987,6 +1000,9 @@ void tst_QFile::readLineStdin() #if !QT_CONFIG(process) QSKIP("No qprocess support", SkipAll); #else +#if defined(Q_OS_ANDROID) + QSKIP("This test crashes when doing nanosleep. See QTBUG-69034."); +#endif QByteArray lotsOfData(1024, '@'); // 10 megs for (int i = 0; i < lotsOfData.size(); ++i) { if ((i % 32) == 31) @@ -998,7 +1014,7 @@ void tst_QFile::readLineStdin() for (int i = 0; i < 2; ++i) { QProcess process; StdinReaderProcessGuard processGuard(&process); - process.start(m_stdinProcessDir + QStringLiteral("/stdinprocess"), + process.start(m_stdinProcessDir + QStringLiteral("/" STDINPROCESS_NAME), QStringList() << QStringLiteral("line") << QString::number(i), QIODevice::Text | QIODevice::ReadWrite); QVERIFY2(process.waitForStarted(), qPrintable(process.errorString())); @@ -1028,10 +1044,13 @@ void tst_QFile::readLineStdin_lineByLine() #if !QT_CONFIG(process) QSKIP("No qprocess support", SkipAll); #else +#if defined(Q_OS_ANDROID) + QSKIP("This test crashes when calling ::poll. See QTBUG-69034."); +#endif for (int i = 0; i < 2; ++i) { QProcess process; StdinReaderProcessGuard processGuard(&process); - process.start(m_stdinProcessDir + QStringLiteral("/stdinprocess"), + process.start(m_stdinProcessDir + QStringLiteral("/" STDINPROCESS_NAME), QStringList() << QStringLiteral("line") << QString::number(i), QIODevice::Text | QIODevice::ReadWrite); QVERIFY2(process.waitForStarted(), qPrintable(process.errorString())); -- cgit v1.2.3