diff options
Diffstat (limited to 'tests')
28 files changed, 1844 insertions, 899 deletions
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index 56a3107..203f0ae 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -493,6 +493,7 @@ private slots: void QTBUG5590_dummyProperty(); void QTBUG12260_defaultTemplate(); void notifyError(); + void QTBUG17635_invokableAndProperty(); void revisions(); void warnings_data(); void warnings(); @@ -1390,6 +1391,31 @@ void tst_Moc::notifyError() #endif } +class QTBUG_17635_InvokableAndProperty : public QObject +{ + Q_OBJECT +public: + Q_PROPERTY(int numberOfEggs READ numberOfEggs) + Q_PROPERTY(int numberOfChickens READ numberOfChickens) + Q_INVOKABLE QString getEgg(int index) { return QString::fromLatin1("Egg"); } + Q_INVOKABLE QString getChicken(int index) { return QString::fromLatin1("Chicken"); } + int numberOfEggs() { return 2; } + int numberOfChickens() { return 4; } +}; + +void tst_Moc::QTBUG17635_invokableAndProperty() +{ + //Moc used to fail parsing Q_INVOKABLE if they were dirrectly following a Q_PROPERTY; + QTBUG_17635_InvokableAndProperty mc; + QString val; + QMetaObject::invokeMethod(&mc, "getEgg", Q_RETURN_ARG(QString, val), Q_ARG(int, 10)); + QCOMPARE(val, QString::fromLatin1("Egg")); + QMetaObject::invokeMethod(&mc, "getChicken", Q_RETURN_ARG(QString, val), Q_ARG(int, 10)); + QCOMPARE(val, QString::fromLatin1("Chicken")); + QVERIFY(mc.metaObject()->indexOfProperty("numberOfEggs") != -1); + QVERIFY(mc.metaObject()->indexOfProperty("numberOfChickens") != -1); +} + // If changed, update VersionTestNotify below class VersionTest : public QObject { diff --git a/tests/auto/network.pro b/tests/auto/network.pro index 7d83054..b427f1c 100644 --- a/tests/auto/network.pro +++ b/tests/auto/network.pro @@ -35,6 +35,8 @@ SUBDIRS=\ qsslerror \ qsslkey \ qsslsocket \ + qsslsocket_onDemandCertificates_member \ + qsslsocket_onDemandCertificates_static \ # qnetworkproxyfactory \ # Uses a hardcoded proxy configuration !contains(QT_CONFIG, private_tests): SUBDIRS -= \ diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp index cfcafc0..64de64a 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -967,7 +967,7 @@ void tst_NetworkSelfTest::smbServer() QVERIFY2(f, qt_error_string().toLocal8Bit()); char buf[128]; - size_t ret = fread(buf, sizeof buf, 1, f); + size_t ret = fread(buf, 1, sizeof buf, f); fclose(f); QCOMPARE(ret, strlen(contents)); diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index 6331db7..db0d0a7 100644 --- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -331,7 +331,7 @@ void tst_QAbstractNetworkCache::checkSynchronous() QNetworkRequest request(realUrl); request.setAttribute( - static_cast<QNetworkRequest::Attribute>(QNetworkRequest::DownloadBufferAttribute + 1), + QNetworkRequest::SynchronousRequestAttribute, true); // prime the cache diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp index 10fa7c6..41da16e 100644 --- a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp +++ b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp @@ -60,8 +60,8 @@ QString tst_QNetworkProxyFactory::formatProxyName(const QNetworkProxy & proxy) c QString proxyName; if (!proxy.user().isNull()) proxyName.append("%1:%2@").arg(proxy.user(), proxy.password()); - proxyName.append("%1:%2").arg(proxy.hostName(), proxy.port()); - proxyName.append(" (type=%1, capabilities=%2)").arg(proxy.type(), proxy.capabilities()); + proxyName.append(QString("%1:%2").arg(proxy.hostName()).arg(proxy.port())); + proxyName.append(QString(" (type=%1, capabilities=%2)").arg(proxy.type()).arg(proxy.capabilities())); return proxyName; } diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 3715162..93e3051 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -84,8 +84,6 @@ Q_DECLARE_METATYPE(QList<QNetworkProxy>) Q_DECLARE_METATYPE(QNetworkReply::NetworkError) Q_DECLARE_METATYPE(QBuffer*) -const int SynchronousRequestAttribute = QNetworkRequest::DownloadBufferAttribute + 1; - class QNetworkReplyPtr: public QSharedPointer<QNetworkReply> { public: @@ -327,6 +325,7 @@ private Q_SLOTS: void ioGetFromHttpBrokenChunkedEncoding(); void qtbug12908compressedHttpReply(); + void compressedHttpReplyBrokenGzip(); void getFromUnreachableIp(); @@ -340,7 +339,9 @@ private Q_SLOTS: void synchronousRequest_data(); void synchronousRequest(); +#ifndef QT_NO_OPENSSL void synchronousRequestSslFailure(); +#endif void httpAbort(); @@ -457,6 +458,7 @@ private: { //qDebug() << "connectSocketSignals" << client; connect(client, SIGNAL(readyRead()), this, SLOT(readyReadSlot())); + connect(client, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot())); connect(client, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(slotError(QAbstractSocket::SocketError))); } @@ -484,15 +486,19 @@ public slots: if (multiple) receivedData.remove(0, doubleEndlPos+4); - client->write(dataToTransmit); - while (client->bytesToWrite() > 0) - client->waitForBytesWritten(); + // we need to emulate the bytesWrittenSlot call if the data is empty. + if (dataToTransmit.size() == 0) + QMetaObject::invokeMethod(this, "bytesWrittenSlot", Qt::QueuedConnection); + else + client->write(dataToTransmit); + } + } - if (doClose) { - client->disconnectFromHost(); - disconnect(client, 0, this, 0); - client = 0; - } + void bytesWrittenSlot() { + if (doClose && client->bytesToWrite() == 0) { + client->disconnectFromHost(); + disconnect(client, 0, this, 0); + client = 0; } } }; @@ -961,7 +967,9 @@ tst_QNetworkReply::tst_QNetworkReply() qRegisterMetaType<QNetworkReply *>(); // for QSignalSpy qRegisterMetaType<QAuthenticator *>(); qRegisterMetaType<QNetworkProxy>(); +#ifndef QT_NO_OPENSSL qRegisterMetaType<QList<QSslError> >(); +#endif Q_SET_DEFAULT_IAP @@ -1057,7 +1065,7 @@ QString tst_QNetworkReply::runSimpleRequest(QNetworkAccessManager::Operation op, returnCode = Timeout; int code = Success; - if (request.attribute(static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute)).toBool()) { + if (request.attribute(QNetworkRequest::SynchronousRequestAttribute).toBool()) { if (reply->isFinished()) code = reply->error() != QNetworkReply::NoError ? Failure : Success; else @@ -1494,6 +1502,12 @@ void tst_QNetworkReply::getErrors() { QFETCH(QString, url); QNetworkRequest request(url); + +#if defined(Q_OS_WIN) || defined (Q_OS_SYMBIAN) + if (qstrcmp(QTest::currentDataTag(), "empty-scheme-host") == 0) + QTest::ignoreMessage(QtWarningMsg, "QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files"); +#endif + QNetworkReplyPtr reply = manager.get(request); reply->setParent(this); // we have expect-fails @@ -1508,6 +1522,9 @@ void tst_QNetworkReply::getErrors() //qDebug() << reply->errorString(); QFETCH(int, error); +#if defined(Q_OS_WIN) || defined (Q_OS_SYMBIAN) + QEXPECT_FAIL("empty-scheme-host", "this is expected to fail on Windows and Symbian, QTBUG-17731", Abort); +#endif QEXPECT_FAIL("ftp-is-dir", "QFtp cannot provide enough detail", Abort); // the line below is not necessary QEXPECT_FAIL("ftp-dir-not-readable", "QFtp cannot provide enough detail", Abort); @@ -1680,7 +1697,7 @@ void tst_QNetworkReply::putToHttpSynchronous() QFETCH(QByteArray, data); request.setAttribute( - static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute), + QNetworkRequest::SynchronousRequestAttribute, true); RUN_REQUEST(runSimpleRequest(QNetworkAccessManager::PutOperation, request, reply, data)); @@ -1740,7 +1757,7 @@ void tst_QNetworkReply::postToHttpSynchronous() QNetworkRequest request(url); request.setAttribute( - static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute), + QNetworkRequest::SynchronousRequestAttribute, true); QNetworkReplyPtr reply; @@ -2255,7 +2272,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuth() // now check with synchronous calls: { request.setAttribute( - static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute), + QNetworkRequest::SynchronousRequestAttribute, true); QSignalSpy authspy(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*))); @@ -2279,7 +2296,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuthSynchronous() QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfcs-auth/rfc3252.txt")); request.setAttribute( - static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute), + QNetworkRequest::SynchronousRequestAttribute, true); QSignalSpy authspy(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*))); @@ -2364,7 +2381,7 @@ void tst_QNetworkReply::ioGetFromHttpWithProxyAuth() reference.seek(0); { request.setAttribute( - static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute), + QNetworkRequest::SynchronousRequestAttribute, true); QSignalSpy authspy(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); @@ -2390,7 +2407,7 @@ void tst_QNetworkReply::ioGetFromHttpWithProxyAuthSynchronous() QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt")); manager.setProxy(proxy); request.setAttribute( - static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute), + QNetworkRequest::SynchronousRequestAttribute, true); QSignalSpy authspy(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*))); @@ -3503,7 +3520,7 @@ void tst_QNetworkReply::ioPostToHttpFromSocketSynchronous() QUrl url("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/md5sum.cgi"); QNetworkRequest request(url); request.setAttribute( - static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute), + QNetworkRequest::SynchronousRequestAttribute, true); QNetworkReplyPtr reply = manager.post(request, socketpair.endPoints[1]); @@ -3695,12 +3712,12 @@ void tst_QNetworkReply::ioPostToHttpsUploadProgress() incomingSocket->setReadBufferSize(1*1024); QTestEventLoop::instance().enterLoop(2); // some progress should have been made + QVERIFY(!spy.isEmpty()); QList<QVariant> args = spy.last(); qDebug() << "tst_QNetworkReply::ioPostToHttpsUploadProgress" << args.at(0).toLongLong() << sourceFile.size() << spy.size(); - QVERIFY(!args.isEmpty()); QVERIFY(args.at(0).toLongLong() > 0); // FIXME this is where it messes up @@ -3711,16 +3728,16 @@ void tst_QNetworkReply::ioPostToHttpsUploadProgress() incomingSocket->read(16*1024); QTestEventLoop::instance().enterLoop(2); // some more progress than before + QVERIFY(!spy.isEmpty()); QList<QVariant> args2 = spy.last(); - QVERIFY(!args2.isEmpty()); QVERIFY(args2.at(0).toLongLong() > args.at(0).toLongLong()); // set the read buffer to unlimited incomingSocket->setReadBufferSize(0); QTestEventLoop::instance().enterLoop(10); // progress should be finished + QVERIFY(!spy.isEmpty()); QList<QVariant> args3 = spy.last(); - QVERIFY(!args3.isEmpty()); QVERIFY(args3.at(0).toLongLong() > args2.at(0).toLongLong()); QCOMPARE(args3.at(0).toLongLong(), args3.at(1).toLongLong()); QCOMPARE(args3.at(0).toLongLong(), sourceFile.size()); @@ -3810,6 +3827,8 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp() if (reader.data.size() < testData.size()) { // oops? QCOMPARE(reader.data, testData.mid(0, reader.data.size())); qDebug() << "The data is incomplete, the last" << testData.size() - reader.data.size() << "bytes are missing"; + QEXPECT_FAIL("http+limited", "Limiting is broken right now, check QTBUG-15065", Abort); + QEXPECT_FAIL("https+limited", "Limiting is broken right now, check QTBUG-15065", Abort); } QCOMPARE(reader.data.size(), testData.size()); QCOMPARE(reader.data, testData); @@ -3822,8 +3841,8 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp() const int maxRate = rate * 1024 * (100+allowedDeviation) / 100; qDebug() << minRate << "<="<< server.transferRate << "<=" << maxRate << "?"; QVERIFY(server.transferRate >= minRate); - QEXPECT_FAIL("http+limited", "Limiting is broken right now", Continue); - QEXPECT_FAIL("https+limited", "Limiting is broken right now", Continue); + QEXPECT_FAIL("http+limited", "Limiting is broken right now, check QTBUG-15065", Continue); + QEXPECT_FAIL("https+limited", "Limiting is broken right now, check QTBUG-15065", Continue); QVERIFY(server.transferRate <= maxRate); } } @@ -4274,7 +4293,7 @@ void tst_QNetworkReply::receiveCookiesFromHttpSynchronous() QNetworkRequest request(url); request.setAttribute( - static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute), + QNetworkRequest::SynchronousRequestAttribute, true); QNetworkReplyPtr reply; @@ -4366,7 +4385,7 @@ void tst_QNetworkReply::sendCookiesSynchronous() QNetworkRequest request(url); request.setAttribute( - static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute), + QNetworkRequest::SynchronousRequestAttribute, true); QNetworkReplyPtr reply; @@ -4508,7 +4527,7 @@ void tst_QNetworkReply::httpProxyCommandsSynchronous() // send synchronous request request.setAttribute( - static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute), + QNetworkRequest::SynchronousRequestAttribute, true); QNetworkReplyPtr reply = manager.get(request); @@ -5234,6 +5253,7 @@ void tst_QNetworkReply::qtbug12908compressedHttpReply() // dd if=/dev/zero of=qtbug-12908 bs=16384 count=1 && gzip qtbug-12908 && base64 -w 0 qtbug-12908.gz QString encodedFile("H4sICDdDaUwAA3F0YnVnLTEyOTA4AO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAIC3AYbSVKsAQAAA"); QByteArray decodedFile = QByteArray::fromBase64(encodedFile.toAscii()); + QCOMPARE(decodedFile.size(), 63); MiniHttpServer server(header.toAscii() + decodedFile); server.doClose = true; @@ -5246,6 +5266,31 @@ void tst_QNetworkReply::qtbug12908compressedHttpReply() QVERIFY(!QTestEventLoop::instance().timeout()); QCOMPARE(reply->error(), QNetworkReply::NoError); + QCOMPARE(reply->size(), qint64(16384)); + QCOMPARE(reply->readAll(), QByteArray(16384, '\0')); +} + +void tst_QNetworkReply::compressedHttpReplyBrokenGzip() +{ + QString header("HTTP/1.0 200 OK\r\nContent-Encoding: gzip\r\nContent-Length: 63\r\n\r\n"); + + // dd if=/dev/zero of=qtbug-12908 bs=16384 count=1 && gzip qtbug-12908 && base64 -w 0 qtbug-12908.gz + // Then change "BMQ" to "BMX" + QString encodedFile("H4sICDdDaUwAA3F0YnVnLTEyOTA4AO3BMXEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAIC3AYbSVKsAQAAA"); + QByteArray decodedFile = QByteArray::fromBase64(encodedFile.toAscii()); + QCOMPARE(decodedFile.size(), 63); + + MiniHttpServer server(header.toAscii() + decodedFile); + server.doClose = true; + + QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(reply->error(), QNetworkReply::ProtocolFailure); } // TODO add similar test for FTP @@ -5454,7 +5499,7 @@ void tst_QNetworkReply::synchronousRequest() #endif request.setAttribute( - static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute), + QNetworkRequest::SynchronousRequestAttribute, true); QNetworkReplyPtr reply; @@ -5485,6 +5530,7 @@ void tst_QNetworkReply::synchronousRequest() reply->deleteLater(); } +#ifndef QT_NO_OPENSSL void tst_QNetworkReply::synchronousRequestSslFailure() { // test that SSL won't be accepted with self-signed certificate, @@ -5494,7 +5540,7 @@ void tst_QNetworkReply::synchronousRequestSslFailure() QUrl url("https://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt"); QNetworkRequest request(url); request.setAttribute( - static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute), + QNetworkRequest::SynchronousRequestAttribute, true); QNetworkReplyPtr reply; QSignalSpy sslErrorsSpy(&manager, SIGNAL(sslErrors(QNetworkReply *, const QList<QSslError> &))); @@ -5503,6 +5549,7 @@ void tst_QNetworkReply::synchronousRequestSslFailure() QCOMPARE(reply->error(), QNetworkReply::SslHandshakeFailedError); QCOMPARE(sslErrorsSpy.count(), 0); } +#endif void tst_QNetworkReply::httpAbort() { diff --git a/tests/auto/qscriptjstestsuite/expect_fail.txt b/tests/auto/qscriptjstestsuite/expect_fail.txt new file mode 100644 index 0000000..7f93378 --- /dev/null +++ b/tests/auto/qscriptjstestsuite/expect_fail.txt @@ -0,0 +1,198 @@ +ecma/Array/15.4.3.1-2.js | var props = ''; for ( p in Array ) { props += p } props + +ecma/Boolean/15.6.3.1-1.js | var str='';for ( p in Boolean ) { str += p } str; + +ecma/Expressions/11.4.1.js | var abc; delete(abc) + +ecma/FunctionObjects/15.3.3.1-2.js | var str='';for (prop in Function ) str += prop; str; + +ecma/ObjectObjects/15.2.3.1-1.js | var str = '';for ( p in Object ) { str += p; }; str + +ecma/Statements/12.6.3-11.js | result = ""; for ( p in Number ) { result += String(p) }; +ecma/Statements/12.6.3-2.js | Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j] + +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4256) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4257) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4258) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4259) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4260) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4261) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4262) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4263) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4264) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4265) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4266) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4267) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4268) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4269) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4270) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4271) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4272) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4273) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4274) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4275) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4276) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4277) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4278) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4279) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4280) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4281) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4282) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4283) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4284) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4285) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4286) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4287) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4288) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4289) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4290) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4291) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4292) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4293) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-5.js | var s = new String( String.fromCharCode(1024) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.11-5.js | var s = new String( String.fromCharCode(1037) ); s.toLowerCase().charCodeAt(0) +ecma/String/15.5.4.12-1.js | var s = new String( String.fromCharCode(181) ); s.toUpperCase().charCodeAt(0) +ecma/String/15.5.4.12-1.js | var s = new String( String.fromCharCode(329) ); s.toUpperCase().charCodeAt(0) +ecma/String/15.5.4.12-4.js | var s = new String( String.fromCharCode(1104) ); s.toUpperCase().charCodeAt(0) +ecma/String/15.5.4.12-4.js | var s = new String( String.fromCharCode(1117) ); s.toUpperCase().charCodeAt(0) +ecma/String/15.5.4.12-5.js | var s = new String( String.fromCharCode(1415) ); s.toUpperCase().charCodeAt(0) + +ecma/TypeConversion/9.3.1-3.js | -"\u20001234\u2001" +ecma/TypeConversion/9.3.1-3.js | - "-0x123456789abcde8" + +ecma/extensions/15.1.2.1-1.js | var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS + +ecma/GlobalObject/15.1.2.2-1.js | var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS +ecma/GlobalObject/15.1.2.3-1.js | var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS +ecma/GlobalObject/15.1.2.4.js | var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS +ecma/GlobalObject/15.1.2.5-1.js | var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS +ecma/GlobalObject/15.1.2.6.js | var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS +ecma/GlobalObject/15.1.2.7.js | var MYPROPS=''; for ( p in isFinite ) { MYPROPS+= p }; MYPROPS + +ecma_3/Array/15.4.5.1-01.js | 15.4.5.1 - array.length coverage + +ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 0 +ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 1 +ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 2 +ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 3 +ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 4 +ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 5 +ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 6 +ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 7 +ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 8 +ecma_3/extensions/regress-368516.js | Treat unicode BOM characters as whitespace: 0 +ecma_3/extensions/regress-368516.js | Treat unicode BOM characters as whitespace: 1 + +ecma_3/Date/15.9.4.3.js | 15.9.4.3 - Date.UTC edge-case arguments.: date Infinity +ecma_3/Date/15.9.4.3.js | 15.9.4.3 - Date.UTC edge-case arguments.: hours Infinity +ecma_3/Date/15.9.4.3.js | 15.9.4.3 - Date.UTC edge-case arguments.: minutes Infinity +ecma_3/Date/15.9.4.3.js | 15.9.4.3 - Date.UTC edge-case arguments.: seconds Infinity +ecma_3/Function/regress-131964.js | Section 1 of test - +ecma_3/Function/regress-313570.js | length of objects whose prototype chain includes a function: immutable +ecma_3/FunExpr/fe-001.js | Both functions were defined. + +ecma_3/LexicalConventions/7.9.1.js | Automatic Semicolon insertion in postfix expressions: expr\n++ +ecma_3/LexicalConventions/7.9.1.js | Automatic Semicolon insertion in postfix expressions: expr\n-- +ecma_3/LexicalConventions/7.9.1.js | Automatic Semicolon insertion in postfix expressions: (x\n)-- y +ecma_3/LexicalConventions/7.9.1.js | Automatic Semicolon insertion in postfix expressions: (x)-- y + +ecma_3/Object/8.6.1-01.js | In strict mode, setting a read-only property should generate a warning: Throw if STRICT and WERROR is enabled + +ecma_3/Operators/order-01.js | operator evaluation order: 11.8.2 > +ecma_3/Operators/order-01.js | operator evaluation order: 11.8.4 >= + +ecma_3/RegExp/15.10.2-1.js | Section 7 of test - \nregexp = /(z)((a+)?(b+)?(c))*/\nstring = 'zaacbbbcac'\nERROR !!! regexp failed to give expected match array:\nExpect: ["zaacbbbcac", "z", "ac", "a", , "c"]\nActual: ["zaacbbbcac", "z", "ac", "a", "bbb", "c"]\n +ecma_3/RegExp/15.10.2-1.js | Section 8 of test - \nregexp = /(a*)*/\nstring = 'b'\nERROR !!! regexp failed to give expected match array:\nExpect: ["", , ]\nActual: ["", ""]\n +ecma_3/RegExp/15.10.2-1.js | Section 12 of test - \nregexp = /(.*?)a(?!(a+)b\2c)\2(.*)/\nstring = 'baaabaac'\nERROR !!! regexp failed to give expected match array:\nExpect: ["baaabaac", "ba", , "abaac"]\nActual: ["baaabaac", "ba", "aa", "abaac"]\n +ecma_3/RegExp/perlstress-001.js | Section 218 of test - \nregexp = /((foo)|(bar))*/\nstring = 'foobar'\nERROR !!! regexp failed to give expected match array:\nExpect: ["foobar", "bar", , "bar"]\nActual: ["foobar", "bar", "foo", "bar"]\n +ecma_3/RegExp/perlstress-001.js | Section 234 of test - \nregexp = /(?:(f)(o)(o)|(b)(a)(r))*/\nstring = 'foobar'\nERROR !!! regexp failed to give expected match array:\nExpect: ["foobar", , , , "b", "a", "r"]\nActual: ["foobar", "f", "o", "o", "b", "a", "r"]\n +ecma_3/RegExp/perlstress-001.js | Section 241 of test - \nregexp = /^(?:b|a(?=(.)))*\1/\nstring = 'abc'\nERROR !!! regexp failed to give expected match array:\nExpect: ["ab", , ]\nActual: ["ab", "b"]\n +ecma_3/RegExp/perlstress-001.js | Section 412 of test - \nregexp = /^(a(b)?)+$/\nstring = 'aba'\nERROR !!! regexp failed to give expected match array:\nExpect: ["aba", "a", , ]\nActual: ["aba", "a", "b"]\n +ecma_3/RegExp/perlstress-001.js | Section 413 of test - \nregexp = /^(aa(bb)?)+$/\nstring = 'aabbaa'\nERROR !!! regexp failed to give expected match array:\nExpect: ["aabbaa", "aa", , ]\nActual: ["aabbaa", "aa", "bb"]\n + +ecma_3/RegExp/regress-209919.js | Section 1 of test - \nregexp = /(a|b*)*/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: ["a", "a"]\nActual: ["a", ""]\n +ecma_3/RegExp/regress-209919.js | Section 3 of test - \nregexp = /(b*)*/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: ["", , ]\nActual: ["", ""]\n +ecma_3/RegExp/regress-209919.js | Section 5 of test - \nregexp = /^\-?(\d{1,}|\.{0,})*(\,\d{1,})?$/\nstring = '100.00'\nERROR !!! regexp failed to give expected match array:\nExpect: ["100.00", "00", , ]\nActual: ["100.00", "", , ]\n +ecma_3/RegExp/regress-209919.js | Section 6 of test - \nregexp = /^\-?(\d{1,}|\.{0,})*(\,\d{1,})?$/\nstring = '100,00'\nERROR !!! regexp failed to give expected match array:\nExpect: ["100,00", "100", ",00"]\nActual: ["100,00", "", ",00"]\n +ecma_3/RegExp/regress-209919.js | Section 7 of test - \nregexp = /^\-?(\d{1,}|\.{0,})*(\,\d{1,})?$/\nstring = '1.000,00'\nERROR !!! regexp failed to give expected match array:\nExpect: ["1.000,00", "000", ",00"]\nActual: ["1.000,00", "", ",00"]\n + +ecma_3/String/15.5.4.11.js | Section 7 +ecma_3/String/15.5.4.11.js | Section 24 +ecma_3/String/15.5.4.11.js | Section 26 +ecma_3/String/15.5.4.11.js | Section 28 +ecma_3/String/15.5.4.11.js | Section 30 +ecma_3/String/15.5.4.14.js | 15.5.4.14 - String.prototype.split(/()/) + +ecma_3/Unicode/regress-352044-01.js | issues with Unicode escape sequences in JavaScript source code +ecma_3/Unicode/uc-001.js | Unicode format-control character test (Category Cf.) + +ecma_2/RegExp/exec-001.js | NO TESTS EXIST +ecma_2/String/replace-001.js | NO TESTS EXIST + +[Q_CC_MSVC] +ecma_3/Expressions/11.7.3-01.js | 11.7.3 - >>> should evaluate operands in order: order | QTBUG-8056 +ecma_3/Operators/order-01.js | operator evaluation order: 11.7.3 >>> | QTBUG-8056 +ecma_3/Operators/order-01.js | operator evaluation order: 11.13.2 >>>= | QTBUG-8056 + +[Q_CC_MINGW] +ecma/Math/15.8.2.13.js | Math.pow(NaN,0) +ecma/Math/15.8.2.13.js | Math.pow(NaN,-0) +ecma/Math/15.8.2.5.js | Math.atan2(Infinity, Infinity) +ecma/Math/15.8.2.5.js | Math.atan2(Infinity, -Infinity) +ecma/Math/15.8.2.5.js | Math.atan2(-Infinity, Infinity) +ecma/Math/15.8.2.5.js | Math.atan2(-Infinity, -Infinity) + +[Q_OS_SOLARIS] +ecma/Expressions/11.13.2-2.js | VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1 +ecma/Expressions/11.13.2-2.js | VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1 +ecma/Expressions/11.13.2-2.js | VAR1 = 1; VAR2= -0; VAR1 /= VAR2 +ecma/Expressions/11.13.2-2.js | VAR1 = -1; VAR2= -0; VAR1 /= VAR2 +ecma/Expressions/11.5.2.js | Number.POSITIVE_INFINITY / -0 +ecma/Expressions/11.5.2.js | Number.NEGATIVE_INFINITY / -0 +ecma/Expressions/11.5.2.js | 1 / -0 +ecma/Expressions/11.5.2.js | -1 / -0 +ecma/Math/15.8.2.10.js | Math.log(-0.0000001) +ecma/Math/15.8.2.10.js | Math.log(-1) +ecma/Math/15.8.2.11.js | Infinity/Math.max(-0,-0) +ecma/Math/15.8.2.12.js | Infinity/Math.min(0,-0) +ecma/Math/15.8.2.12.js | Infinity/Math.min(-0,-0) +ecma/Math/15.8.2.13.js | Math.pow(NaN,0) +ecma/Math/15.8.2.13.js | Math.pow(NaN,-0) +ecma/Math/15.8.2.13.js | Infinity/Math.pow(-Infinity, -1) +ecma/Math/15.8.2.13.js | Math.pow(0, -1) +ecma/Math/15.8.2.13.js | Math.pow(0, -0.5) +ecma/Math/15.8.2.13.js | Math.pow(0, -1000) +ecma/Math/15.8.2.13.js | Infinity/Math.pow(-0, 1) +ecma/Math/15.8.2.13.js | Infinity/Math.pow(-0, 3) +ecma/Math/15.8.2.13.js | Math.pow(-0, -2) +ecma/Math/15.8.2.15.js | Infinity/Math.round(-0) +ecma/Math/15.8.2.15.js | Infinity/Math.round(-0.49) +ecma/Math/15.8.2.15.js | Infinity/Math.round(-0.5) +ecma/Math/15.8.2.17.js | Infinity/Math.sqrt(-0) +ecma/Math/15.8.2.18.js | Infinity/Math.tan(-0) +ecma/Math/15.8.2.2.js | Math.acos(1.00000001) +ecma/Math/15.8.2.2.js | Math.acos(11.00000001) +ecma/Math/15.8.2.3.js | Math.asin(1.000001) +ecma/Math/15.8.2.3.js | Math.asin(-1.000001) +ecma/Math/15.8.2.3.js | Infinity/Math.asin(-0) +ecma/Math/15.8.2.4.js | Infinity/Math.atan(-0) +ecma/Math/15.8.2.5.js | Math.atan2(0, -0) +ecma/Math/15.8.2.5.js | Infinity/Math.atan2(-0, 1) +ecma/Math/15.8.2.5.js | Math.atan2(-0,\t-0) +ecma/Math/15.8.2.5.js | Math.atan2(-0,\t-1) +ecma/Math/15.8.2.6.js | Infinity/Math.ceil('-0') +ecma/Math/15.8.2.6.js | Infinity/Math.ceil(-0) +ecma/Math/15.8.2.6.js | Infinity/Math.ceil(-Number.MIN_VALUE) +ecma/Math/15.8.2.6.js | Infinity/Math.ceil(-0.9) +ecma/Math/15.8.2.9.js | Infinity/Math.floor(-0) +ecma/TypeConversion/9.3.1-3.js | var z = 0; print(1/-z) +ecma/TypeConversion/9.3.1-3.js | 1/-1e-2000 + +[Q_OS_SYMBIAN] +ecma/Math/15.8.2.13.js | Math.pow(-1, 0.5) +ecma/Math/15.8.2.13.js | Math.pow(-1, -0.5) +ecma_3/Operators/order-01.js | operator evaluation order: 11.5.1 * +ecma_3/Operators/order-01.js | operator evaluation order: 11.5.2 / +ecma_3/Operators/order-01.js | operator evaluation order: 11.6.2 - +ecma_3/Operators/order-01.js | operator evaluation order: 11.13.2 *= +ecma_3/Operators/order-01.js | operator evaluation order: 11.13.2 /= diff --git a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro index b1ddd64..471aa02 100644 --- a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro +++ b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro @@ -1,6 +1,8 @@ load(qttest_p4) QT = core script SOURCES += tst_qscriptjstestsuite.cpp +RESOURCES += qscriptjstestsuite.qrc +include(../qscriptv8testsuite/abstracttestsuite.pri) !symbian: DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.qrc b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.qrc new file mode 100644 index 0000000..4a4eb60 --- /dev/null +++ b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.qrc @@ -0,0 +1,6 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>expect_fail.txt</file> + <file>skip.txt</file> +</qresource> +</RCC> diff --git a/tests/auto/qscriptjstestsuite/skip.txt b/tests/auto/qscriptjstestsuite/skip.txt new file mode 100644 index 0000000..2dc0ccb --- /dev/null +++ b/tests/auto/qscriptjstestsuite/skip.txt @@ -0,0 +1,9 @@ +.+/15\.9\.2\..+ | unstable on slow machines +.+/15\.9\.5\..+ | too slooow +regress-130451.js | asserts +regress-322135-01.js | asserts +regress-322135-02.js | asserts +regress-322135-03.js | takes forever +regress-322135-04.js | takes forever +ecma_3/RegExp/regress-375715-04.js | bug +ecma_3/RegExp/regress-289669.js | Can fail due to relying on wall-clock time diff --git a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp index 43a6dba..e042dfe 100644 --- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp +++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp @@ -40,44 +40,18 @@ ****************************************************************************/ +#include "abstracttestsuite.h" #include <QtTest/QtTest> #include <QtScript> #if defined(Q_OS_SYMBIAN) -# define SRCDIR "" +# define SRCDIR "." #endif //TESTED_CLASS= //TESTED_FILES= -// Uncomment the following define to have the autotest generate -// addExpectedFailure() code for all the tests that fail. -// This is useful when a whole new test (sub)suite is added. -// The code is stored in addexpectedfailures.cpp. -// Paste the contents into this file after the existing -// addExpectedFailure() calls. - -//#define GENERATE_ADDEXPECTEDFAILURE_CODE - -static QString readFile(const QString &filename) -{ - QFile file(filename); - if (!file.open(QFile::ReadOnly)) - return QString(); - QTextStream stream(&file); - return stream.readAll(); -} - -static void appendCString(QVector<char> *v, const char *s) -{ - char c; - do { - c = *(s++); - *v << c; - } while (c != '\0'); -} - struct TestRecord { TestRecord() : lineNumber(-1) { } @@ -120,17 +94,18 @@ struct FailureItem QString message; }; -class tst_Suite : public QObject +class tst_QScriptJSTestSuite : public AbstractTestSuite { public: - tst_Suite(); - virtual ~tst_Suite(); + tst_QScriptJSTestSuite(); + virtual ~tst_QScriptJSTestSuite(); - static QMetaObject staticMetaObject; - virtual const QMetaObject *metaObject() const; - virtual void *qt_metacast(const char *); - virtual int qt_metacall(QMetaObject::Call, int, void **argv); +protected: + virtual void configData(TestConfig::Mode mode, const QStringList &parts); + virtual void writeSkipConfigFile(QTextStream &); + virtual void writeExpectFailConfigFile(QTextStream &); + virtual void runTestFunction(int testIndex); private: void addExpectedFailure(const QString &fileName, const QString &description, const QString &message); @@ -143,33 +118,11 @@ private: void addFileExclusion(const QRegExp &rx, const QString &message); bool isExcludedFile(const QString &fileName, QString *message) const; - QDir testsDir; QList<QString> subSuitePaths; QList<FailureItem> expectedFailures; QList<QPair<QRegExp, QString> > fileExclusions; -#ifdef GENERATE_ADDEXPECTEDFAILURE_CODE - QString generatedAddExpectedFailureCode; -#endif }; -QMetaObject tst_Suite::staticMetaObject; - -Q_GLOBAL_STATIC(QVector<uint>, qt_meta_data_tst_Suite) -Q_GLOBAL_STATIC(QVector<char>, qt_meta_stringdata_tst_Suite) - -const QMetaObject *tst_Suite::metaObject() const -{ - return &staticMetaObject; -} - -void *tst_Suite::qt_metacast(const char *_clname) -{ - if (!_clname) return 0; - if (!strcmp(_clname, qt_meta_stringdata_tst_Suite()->constData())) - return static_cast<void*>(const_cast<tst_Suite*>(this)); - return QObject::qt_metacast(_clname); -} - static QScriptValue qscript_void(QScriptContext *, QScriptEngine *eng) { return eng->undefinedValue(); @@ -222,625 +175,245 @@ static QScriptValue qscript_TestCase(QScriptContext *ctx, QScriptEngine *eng) return ret; } -int tst_Suite::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +void tst_QScriptJSTestSuite::runTestFunction(int testIndex) { - _id = QObject::qt_metacall(_c, _id, _a); - if (_id < 0) - return _id; - if (_c == QMetaObject::InvokeMetaMethod) { - if (!(_id & 1)) { - // data - QTest::addColumn<TestRecord>("record"); - bool hasData = false; - - QString testsShellPath = testsDir.absoluteFilePath("shell.js"); - QString testsShellContents = readFile(testsShellPath); - - QDir subSuiteDir(subSuitePaths.at(_id / 2)); - QString subSuiteShellPath = subSuiteDir.absoluteFilePath("shell.js"); - QString subSuiteShellContents = readFile(subSuiteShellPath); - - QDir testSuiteDir(subSuiteDir); - testSuiteDir.cdUp(); - QString suiteJsrefPath = testSuiteDir.absoluteFilePath("jsref.js"); - QString suiteJsrefContents = readFile(suiteJsrefPath); - QString suiteShellPath = testSuiteDir.absoluteFilePath("shell.js"); - QString suiteShellContents = readFile(suiteShellPath); - - QFileInfoList testFileInfos = subSuiteDir.entryInfoList(QStringList() << "*.js", QDir::Files); - foreach (QFileInfo tfi, testFileInfos) { - if ((tfi.fileName() == "shell.js") || (tfi.fileName() == "browser.js")) - continue; - - QString abspath = tfi.absoluteFilePath(); - QString relpath = testsDir.relativeFilePath(abspath); - QString excludeMessage; - if (isExcludedFile(relpath, &excludeMessage)) { - QTest::newRow(relpath.toLatin1()) << TestRecord(excludeMessage, relpath); - continue; - } + if (!(testIndex & 1)) { + // data + QTest::addColumn<TestRecord>("record"); + bool hasData = false; + + QString testsShellPath = testsDir.absoluteFilePath("shell.js"); + QString testsShellContents = readFile(testsShellPath); + + QDir subSuiteDir(subSuitePaths.at(testIndex / 2)); + QString subSuiteShellPath = subSuiteDir.absoluteFilePath("shell.js"); + QString subSuiteShellContents = readFile(subSuiteShellPath); + + QDir testSuiteDir(subSuiteDir); + testSuiteDir.cdUp(); + QString suiteJsrefPath = testSuiteDir.absoluteFilePath("jsref.js"); + QString suiteJsrefContents = readFile(suiteJsrefPath); + QString suiteShellPath = testSuiteDir.absoluteFilePath("shell.js"); + QString suiteShellContents = readFile(suiteShellPath); + + QFileInfoList testFileInfos = subSuiteDir.entryInfoList(QStringList() << "*.js", QDir::Files); + foreach (QFileInfo tfi, testFileInfos) { + if ((tfi.fileName() == "shell.js") || (tfi.fileName() == "browser.js")) + continue; + + QString abspath = tfi.absoluteFilePath(); + QString relpath = testsDir.relativeFilePath(abspath); + QString excludeMessage; + if (isExcludedFile(relpath, &excludeMessage)) { + QTest::newRow(relpath.toLatin1()) << TestRecord(excludeMessage, relpath); + continue; + } - QScriptEngine eng; - QScriptValue global = eng.globalObject(); - global.setProperty("print", eng.newFunction(qscript_void)); - global.setProperty("quit", eng.newFunction(qscript_quit)); - global.setProperty("options", eng.newFunction(qscript_options)); - - eng.evaluate(testsShellContents, testsShellPath); - if (eng.hasUncaughtException()) { - QStringList bt = eng.uncaughtExceptionBacktrace(); - QString err = eng.uncaughtException().toString(); - qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n"))); - break; - } + QScriptEngine eng; + QScriptValue global = eng.globalObject(); + global.setProperty("print", eng.newFunction(qscript_void)); + global.setProperty("quit", eng.newFunction(qscript_quit)); + global.setProperty("options", eng.newFunction(qscript_options)); + + eng.evaluate(testsShellContents, testsShellPath); + if (eng.hasUncaughtException()) { + QStringList bt = eng.uncaughtExceptionBacktrace(); + QString err = eng.uncaughtException().toString(); + qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n"))); + break; + } - eng.evaluate(suiteJsrefContents, suiteJsrefPath); - if (eng.hasUncaughtException()) { - QStringList bt = eng.uncaughtExceptionBacktrace(); - QString err = eng.uncaughtException().toString(); - qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n"))); - break; - } + eng.evaluate(suiteJsrefContents, suiteJsrefPath); + if (eng.hasUncaughtException()) { + QStringList bt = eng.uncaughtExceptionBacktrace(); + QString err = eng.uncaughtException().toString(); + qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n"))); + break; + } - eng.evaluate(suiteShellContents, suiteShellPath); - if (eng.hasUncaughtException()) { - QStringList bt = eng.uncaughtExceptionBacktrace(); - QString err = eng.uncaughtException().toString(); - qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n"))); - break; - } + eng.evaluate(suiteShellContents, suiteShellPath); + if (eng.hasUncaughtException()) { + QStringList bt = eng.uncaughtExceptionBacktrace(); + QString err = eng.uncaughtException().toString(); + qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n"))); + break; + } - eng.evaluate(subSuiteShellContents, subSuiteShellPath); - if (eng.hasUncaughtException()) { - QStringList bt = eng.uncaughtExceptionBacktrace(); - QString err = eng.uncaughtException().toString(); - qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n"))); - break; - } + eng.evaluate(subSuiteShellContents, subSuiteShellPath); + if (eng.hasUncaughtException()) { + QStringList bt = eng.uncaughtExceptionBacktrace(); + QString err = eng.uncaughtException().toString(); + qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n"))); + break; + } - QScriptValue origTestCaseCtor = global.property("TestCase"); - QScriptValue myTestCaseCtor = eng.newFunction(qscript_TestCase); - myTestCaseCtor.setData(origTestCaseCtor); - global.setProperty("TestCase", myTestCaseCtor); + QScriptValue origTestCaseCtor = global.property("TestCase"); + QScriptValue myTestCaseCtor = eng.newFunction(qscript_TestCase); + myTestCaseCtor.setData(origTestCaseCtor); + global.setProperty("TestCase", myTestCaseCtor); - global.setProperty("gTestfile", tfi.fileName()); - global.setProperty("gTestsuite", testSuiteDir.dirName()); - global.setProperty("gTestsubsuite", subSuiteDir.dirName()); - QString testFileContents = readFile(abspath); + global.setProperty("gTestfile", tfi.fileName()); + global.setProperty("gTestsuite", testSuiteDir.dirName()); + global.setProperty("gTestsubsuite", subSuiteDir.dirName()); + QString testFileContents = readFile(abspath); // qDebug() << relpath; - eng.evaluate(testFileContents, abspath); - if (eng.hasUncaughtException() && !relpath.endsWith("-n.js")) { - QStringList bt = eng.uncaughtExceptionBacktrace(); - QString err = eng.uncaughtException().toString(); - qWarning("%s\n%s\n", qPrintable(err), qPrintable(bt.join("\n"))); - continue; - } + eng.evaluate(testFileContents, abspath); + if (eng.hasUncaughtException() && !relpath.endsWith("-n.js")) { + QStringList bt = eng.uncaughtExceptionBacktrace(); + QString err = eng.uncaughtException().toString(); + qWarning("%s\n%s\n", qPrintable(err), qPrintable(bt.join("\n"))); + continue; + } - QScriptValue testcases = global.property("testcases"); - if (!testcases.isArray()) - testcases = global.property("gTestcases"); - int count = testcases.property("length").toInt32(); - if (count == 0) - continue; - - hasData = true; - QString title = global.property("TITLE").toString(); - for (int i = 0; i < count; ++i) { - QScriptValue kase = testcases.property(i); - QString description = kase.property("description").toString(); - QScriptValue expect = kase.property("expect"); - QScriptValue actual = kase.property("actual"); - bool passed = kase.property("passed").toBoolean(); - int lineNumber = kase.property("__lineNumber__").toInt32(); - - TestRecord rec(description, passed, - actual.toString(), expect.toString(), - relpath, lineNumber); - - QTest::newRow(description.toLatin1()) << rec; - } + QScriptValue testcases = global.property("testcases"); + if (!testcases.isArray()) + testcases = global.property("gTestcases"); + int count = testcases.property("length").toInt32(); + if (count == 0) + continue; + + hasData = true; + QString title = global.property("TITLE").toString(); + for (int i = 0; i < count; ++i) { + QScriptValue kase = testcases.property(i); + QString description = kase.property("description").toString(); + QScriptValue expect = kase.property("expect"); + QScriptValue actual = kase.property("actual"); + bool passed = kase.property("passed").toBoolean(); + int lineNumber = kase.property("__lineNumber__").toInt32(); + + TestRecord rec(description, passed, + actual.toString(), expect.toString(), + relpath, lineNumber); + + QTest::newRow(description.toLatin1()) << rec; } - if (!hasData) - QTest::newRow("") << TestRecord(); // dummy + } + if (!hasData) + QTest::newRow("") << TestRecord(); // dummy + } else { + QFETCH(TestRecord, record); + if ((record.lineNumber == -1) && (record.actual == "QSKIP")) { + QTest::qSkip(record.description.toLatin1(), QTest::SkipAll, record.fileName.toLatin1(), -1); } else { - QFETCH(TestRecord, record); - if ((record.lineNumber == -1) && (record.actual == "QSKIP")) { - QTest::qSkip(record.description.toLatin1(), QTest::SkipAll, record.fileName.toLatin1(), -1); - } else { - QString msg; - FailureItem::Action failAct; - bool expectFail = isExpectedFailure(record.fileName, record.description, &msg, &failAct); - if (expectFail) { - switch (failAct) { - case FailureItem::ExpectFail: - QTest::qExpectFail("", msg.toLatin1(), - QTest::Continue, record.fileName.toLatin1(), - record.lineNumber); - break; - case FailureItem::Skip: - QTest::qSkip(msg.toLatin1(), QTest::SkipSingle, - record.fileName.toLatin1(), record.lineNumber); - break; - } + QString msg; + FailureItem::Action failAct; + bool expectFail = isExpectedFailure(record.fileName, record.description, &msg, &failAct); + if (expectFail) { + switch (failAct) { + case FailureItem::ExpectFail: + QTest::qExpectFail("", msg.toLatin1(), + QTest::Continue, record.fileName.toLatin1(), + record.lineNumber); + break; + case FailureItem::Skip: + QTest::qSkip(msg.toLatin1(), QTest::SkipSingle, + record.fileName.toLatin1(), record.lineNumber); + break; } - if (!expectFail || (failAct == FailureItem::ExpectFail)) { - if (!record.passed) { -#ifdef GENERATE_ADDEXPECTEDFAILURE_CODE - if (!expectFail) { - QString escapedDescription = record.description; - escapedDescription.replace("\\", "\\\\"); - escapedDescription.replace("\n", "\\n"); - escapedDescription.replace("\"", "\\\""); - generatedAddExpectedFailureCode.append( - " addExpectedFailure(\"" + record.fileName - + "\", \"" + escapedDescription + - "\", willFixInNextReleaseMessage);\n"); - } -#endif - QTest::qCompare(record.actual, record.expected, "actual", "expect", - record.fileName.toLatin1(), record.lineNumber); - } else { - QTest::qCompare(record.actual, record.actual, "actual", "expect", - record.fileName.toLatin1(), record.lineNumber); + } + if (!expectFail || (failAct == FailureItem::ExpectFail)) { + if (!record.passed) { + if (!expectFail && shouldGenerateExpectedFailures) { + addExpectedFailure(record.fileName, + record.description, + QString()); } + QTest::qCompare(record.actual, record.expected, "actual", "expect", + record.fileName.toLatin1(), record.lineNumber); + } else { + QTest::qCompare(record.actual, record.actual, "actual", "expect", + record.fileName.toLatin1(), record.lineNumber); } } } - _id -= subSuitePaths.size()*2; } - return _id; } -tst_Suite::tst_Suite() +tst_QScriptJSTestSuite::tst_QScriptJSTestSuite() + : AbstractTestSuite("tst_QScriptJsTestSuite", + QString::fromLatin1("%0/tests").arg(SRCDIR), + ":/") { - testsDir = QDir(SRCDIR); - bool testsFound = testsDir.cd("tests"); - if (!testsFound) { - qWarning("*** no tests/ dir!"); - } - - QString willFixInNextReleaseMessage = QString::fromLatin1("Will fix in next release"); - QString fromCharCodeMessage = QString::fromLatin1("Test is wrong?"); - for (int i = 4256; i < 4294; ++i) { - addExpectedFailure("ecma/String/15.5.4.11-2.js", QString::fromLatin1("var s = new String( String.fromCharCode(%0) ); s.toLowerCase().charCodeAt(0)").arg(i), fromCharCodeMessage); - } - addExpectedFailure("ecma/String/15.5.4.11-5.js", "var s = new String( String.fromCharCode(1024) ); s.toLowerCase().charCodeAt(0)", fromCharCodeMessage); - addExpectedFailure("ecma/String/15.5.4.11-5.js", "var s = new String( String.fromCharCode(1037) ); s.toLowerCase().charCodeAt(0)", fromCharCodeMessage); - addExpectedFailure("ecma/String/15.5.4.12-1.js", "var s = new String( String.fromCharCode(181) ); s.toUpperCase().charCodeAt(0)", fromCharCodeMessage); - addExpectedFailure("ecma/String/15.5.4.12-1.js", "var s = new String( String.fromCharCode(329) ); s.toUpperCase().charCodeAt(0)", fromCharCodeMessage); - addExpectedFailure("ecma/String/15.5.4.12-4.js", "var s = new String( String.fromCharCode(1104) ); s.toUpperCase().charCodeAt(0)", fromCharCodeMessage); - addExpectedFailure("ecma/String/15.5.4.12-4.js", "var s = new String( String.fromCharCode(1117) ); s.toUpperCase().charCodeAt(0)", fromCharCodeMessage); - addExpectedFailure("ecma/String/15.5.4.12-5.js", "var s = new String( String.fromCharCode(1415) ); s.toUpperCase().charCodeAt(0)", fromCharCodeMessage); - - addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "- \"-0x123456789abcde8\"", willFixInNextReleaseMessage); - - addExpectedFailure("ecma/extensions/15.1.2.1-1.js", "var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS", willFixInNextReleaseMessage); - addExpectedFailure("ecma/GlobalObject/15.1.2.2-1.js", "var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS", willFixInNextReleaseMessage); - - addExpectedFailure("ecma/GlobalObject/15.1.2.3-1.js", "var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS", willFixInNextReleaseMessage); - addExpectedFailure("ecma/GlobalObject/15.1.2.4.js", "var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS", willFixInNextReleaseMessage); - addExpectedFailure("ecma/GlobalObject/15.1.2.5-1.js", "var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS", willFixInNextReleaseMessage); - addExpectedFailure("ecma/GlobalObject/15.1.2.6.js", "var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS", willFixInNextReleaseMessage); - addExpectedFailure("ecma/GlobalObject/15.1.2.7.js", "var MYPROPS=''; for ( p in isFinite ) { MYPROPS+= p }; MYPROPS", willFixInNextReleaseMessage); - - addExpectedFailure(QRegExp(), "NO TESTS EXIST", willFixInNextReleaseMessage); - - addExpectedFailure("ecma_3/Array/15.4.5.1-01.js", "15.4.5.1 - array.length coverage", willFixInNextReleaseMessage); - - addExpectedFailure("ecma_3/extensions/regress-228087-002.js", - "Section 1 of test - \nregexp = /{1.*}/g\n" - "string = 'foo {1} foo {2} foo'\n" - "ERROR !!! match arrays have different lengths:\n" - "Expect: [\"{1} foo {2}\"]\n" - "Actual: []", willFixInNextReleaseMessage); - - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", - "Section 1 of test - \n" - "regexp = /a|ab/\n" - "string = 'abc'\n" - "ERROR !!! regexp failed to give expected match array:\n" - "Expect: [\"a\"]\n" - "Actual: [\"ab\"]\n", willFixInNextReleaseMessage); - - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", - "Section 2 of test - \n" - "regexp = /((a)|(ab))((c)|(bc))/\n" - "string = 'abc'\n" - "ERROR !!! regexp failed to give expected match array:\n" - "Expect: [\"abc\", \"a\", \"a\", , \"bc\", , \"bc\"]\n" - "Actual: [\"abc\", \"ab\", \"\", \"ab\", \"c\", \"c\", \"\"]\n", willFixInNextReleaseMessage); - - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", - "Section 4 of test - \n" - "regexp = /a[a-z]{2,4}?/\n" - "string = 'abcdefghi'\n" - "ERROR !!! regexp FAILED to match anything !!!\n" - "Expect: abc\n" - "Actual: null\n", willFixInNextReleaseMessage); - - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js(317)", - "Section 5 of test - \n" - "regexp = /(aa|aabaac|ba|b|c)*/\n" - "string = 'aabaac'\n" - "ERROR !!! regexp failed to give expected match array:\n" - "Expect: [\"aaba\", \"ba\"]\n" - "Actual: [\"aabaac\", \"aabaac\"]\n", willFixInNextReleaseMessage); - - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 1 of test - \nregexp = /{1.*}/g\nstring = 'foo {1} foo {2} foo'\nERROR !!! match arrays have different lengths:\nExpect: [\"{1} foo {2}\"]\nActual: []\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 2 of test - \nregexp = /{1.*}/g\nstring = 'foo {1} foo {2} foo'\nERROR !!! match arrays have different lengths:\nExpect: [\"{1} foo {2}\"]\nActual: []\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 3 of test - \nregexp = /{1[.!}]*}/g\nstring = 'foo {1} foo {2} foo'\nERROR !!! match arrays have different lengths:\nExpect: [\"{1}\"]\nActual: []\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 4 of test - \nregexp = /{1[.!}]*}/g\nstring = 'foo {1} foo {2} foo'\nERROR !!! match arrays have different lengths:\nExpect: [\"{1}\"]\nActual: []\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 6 of test - \nregexp = /c{3 }/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3 }\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 7 of test - \nregexp = /c{3.}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3 }\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 8 of test - \nregexp = /c{3\\s}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3 }\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 9 of test - \nregexp = /c{3[ ]}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3 }\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 10 of test - \nregexp = /c{ 3}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{ 3}\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 12 of test - \nregexp = /c{3, }/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3, }\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 13 of test - \nregexp = /c{3 ,}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3 ,}\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 15 of test - \nregexp = /c{3 ,4}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3 ,4}\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 16 of test - \nregexp = /c{3, 4}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3, 4}\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 17 of test - \nregexp = /c{3,4 }/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3,4 }\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 0", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 1", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 2", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 3", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 4", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 5", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 6", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 7", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 8", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-368516.js", "Treat unicode BOM characters as whitespace: 0", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/extensions/regress-368516.js", "Treat unicode BOM characters as whitespace: 1", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/FunExpr/fe-001-n.js", "Previous statement should have thrown a ReferenceError", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/LexicalConventions/7.9.1.js", "Automatic Semicolon insertion in postfix expressions: expr\n++", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/LexicalConventions/7.9.1.js", "Automatic Semicolon insertion in postfix expressions: expr\n--", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/LexicalConventions/7.9.1.js", "Automatic Semicolon insertion in postfix expressions: (x\n)-- y", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/LexicalConventions/7.9.1.js", "Automatic Semicolon insertion in postfix expressions: (x)-- y", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Object/8.6.1-01.js", "In strict mode, setting a read-only property should generate a warning: Throw if STRICT and WERROR is enabled", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.8.2 >", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.8.4 >=", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 5 of test - \nregexp = /(aa|aabaac|ba|b|c)*/\nstring = 'aabaac'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"aaba\", \"ba\"]\nActual: [\"aabaac\", \"aabaac\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 6 of test - \nregexp = /^(a+)\\1*,\\1+$/\nstring = 'aaaaaaaaaa,aaaaaaaaaaaaaaa'\nERROR !!! regexp FAILED to match anything !!!\nExpect: aaaaaaaaaa,aaaaaaaaaaaaaaa,aaaaa\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 7 of test - \nregexp = /(z)((a+)?(b+)?(c))*/\nstring = 'zaacbbbcac'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"zaacbbbcac\", \"z\", \"ac\", \"a\", , \"c\"]\nActual: [\"zaacbbbcac\", \"z\", \"ac\", \"a\", \"\", \"c\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 8 of test - \nregexp = /(a*)*/\nstring = 'b'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\", , ]\nActual: [\"\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 10 of test - \nregexp = /(?=(a+))/\nstring = 'baaabac'\nERROR !!! match arrays have different lengths:\nExpect: [\"\", \"aaa\"]\nActual: [\"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 11 of test - \nregexp = /(?=(a+))a*b\\1/\nstring = 'baaabac'\nERROR !!! match arrays have different lengths:\nExpect: [\"aba\", \"a\"]\nActual: [\"aaab\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 12 of test - \nregexp = /(.*?)a(?!(a+)b\\2c)\\2(.*)/\nstring = 'baaabaac'\nERROR !!! regexp FAILED to match anything !!!\nExpect: baaabaac,ba,,abaac\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 13 of test - \nregexp = /(?=(a+))/\nstring = 'baaabac'\nERROR !!! match arrays have different lengths:\nExpect: [\"\", \"aaa\"]\nActual: [\"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 34 of test - \nregexp = /a]/\nstring = 'a]'\nERROR !!! regexp FAILED to match anything !!!\nExpect: a]\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 66 of test - \nregexp = /a.+?c/\nstring = 'abcabc'\nERROR !!! regexp FAILED to match anything !!!\nExpect: abc\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 94 of test - \nregexp = /^a(bc+|b[eh])g|.h$/\nstring = 'abh'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"bh\", , ]\nActual: [\"bh\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 95 of test - \nregexp = /(bc+d$|ef*g.|h?i(j|k))/\nstring = 'effgz'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"effgz\", \"effgz\", , ]\nActual: [\"effgz\", \"effgz\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 97 of test - \nregexp = /(bc+d$|ef*g.|h?i(j|k))/\nstring = 'reffgz'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"effgz\", \"effgz\", , ]\nActual: [\"effgz\", \"effgz\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 109 of test - \nregexp = /(([a-c])b*?\\2)*/\nstring = 'ababbbcbc'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ababb,bb,b\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 110 of test - \nregexp = /(([a-c])b*?\\2){3}/\nstring = 'ababbbcbc'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ababbbcbc,cbc,c\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 119 of test - \nregexp = /ab*?bc/i\nstring = 'ABBBBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBBBC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 120 of test - \nregexp = /ab{0,}?bc/i\nstring = 'ABBBBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBBBC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 121 of test - \nregexp = /ab+?bc/i\nstring = 'ABBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 123 of test - \nregexp = /ab{1,}?bc/i\nstring = 'ABBBBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBBBC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 124 of test - \nregexp = /ab{1,3}?bc/i\nstring = 'ABBBBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBBBC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 125 of test - \nregexp = /ab{3,4}?bc/i\nstring = 'ABBBBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBBBC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 126 of test - \nregexp = /ab??bc/i\nstring = 'ABBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 127 of test - \nregexp = /ab??bc/i\nstring = 'ABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 128 of test - \nregexp = /ab{0,1}?bc/i\nstring = 'ABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 129 of test - \nregexp = /ab??c/i\nstring = 'ABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 130 of test - \nregexp = /ab{0,1}?c/i\nstring = 'ABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 138 of test - \nregexp = /a.*?c/i\nstring = 'AXYZC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: AXYZC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 144 of test - \nregexp = /a]/i\nstring = 'A]'\nERROR !!! regexp FAILED to match anything !!!\nExpect: A]\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 160 of test - \nregexp = /a.+?c/i\nstring = 'ABCABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 161 of test - \nregexp = /a.*?c/i\nstring = 'ABCABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 162 of test - \nregexp = /a.{0,5}?c/i\nstring = 'ABCABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 169 of test - \nregexp = /(a+|b){0,1}?/i\nstring = 'AB'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ,\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 191 of test - \nregexp = /^a(bc+|b[eh])g|.h$/i\nstring = 'ABH'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"BH\", , ]\nActual: [\"BH\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 192 of test - \nregexp = /(bc+d$|ef*g.|h?i(j|k))/i\nstring = 'EFFGZ'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"EFFGZ\", \"EFFGZ\", , ]\nActual: [\"EFFGZ\", \"EFFGZ\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 194 of test - \nregexp = /(bc+d$|ef*g.|h?i(j|k))/i\nstring = 'REFFGZ'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"EFFGZ\", \"EFFGZ\", , ]\nActual: [\"EFFGZ\", \"EFFGZ\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 212 of test - \nregexp = /a(?:b|c|d)+?(.)/\nstring = 'ace'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ace,e\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 213 of test - \nregexp = /a(?:b|c|d)+?(.)/\nstring = 'acdbcdbe'\nERROR !!! regexp FAILED to match anything !!!\nExpect: acd,d\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 217 of test - \nregexp = /a(?:b|c|d){4,5}?(.)/\nstring = 'acdbcdbe'\nERROR !!! regexp FAILED to match anything !!!\nExpect: acdbcd,d\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 218 of test - \nregexp = /((foo)|(bar))*/\nstring = 'foobar'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"foobar\", \"bar\", , \"bar\"]\nActual: [\"foobar\", \"bar\", \"\", \"bar\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 220 of test - \nregexp = /a(?:b|c|d){6,7}?(.)/\nstring = 'acdbcdbe'\nERROR !!! regexp FAILED to match anything !!!\nExpect: acdbcdbe,e\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 222 of test - \nregexp = /a(?:b|c|d){5,6}?(.)/\nstring = 'acdbcdbe'\nERROR !!! regexp FAILED to match anything !!!\nExpect: acdbcdb,b\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 224 of test - \nregexp = /a(?:b|c|d){5,7}?(.)/\nstring = 'acdbcdbe'\nERROR !!! regexp FAILED to match anything !!!\nExpect: acdbcdb,b\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 225 of test - \nregexp = /a(?:b|(c|e){1,2}?|d)+?(.)/\nstring = 'ace'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ace,c,e\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 227 of test - \nregexp = /^([^a-z])|(\\^)$/\nstring = '.'\nERROR !!! regexp failed to give expected match array:\nExpect: [\".\", \".\", , ]\nActual: [\".\", \".\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 234 of test - \nregexp = /(?:(f)(o)(o)|(b)(a)(r))*/\nstring = 'foobar'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"foobar\", , , , \"b\", \"a\", \"r\"]\nActual: [\"foobar\", \"\", \"\", \"\", \"b\", \"a\", \"r\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 240 of test - \nregexp = /(?:..)*?a/\nstring = 'aba'\nERROR !!! regexp FAILED to match anything !!!\nExpect: a\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 241 of test - \nregexp = /^(?:b|a(?=(.)))*\\1/\nstring = 'abc'\nERROR !!! match arrays have different lengths:\nExpect: [\"ab\", , ]\nActual: [\"ab\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 246 of test - \nregexp = /(a|x)*ab/\nstring = 'cab'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"ab\", , ]\nActual: [\"ab\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 247 of test - \nregexp = /(a)*ab/\nstring = 'cab'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"ab\", , ]\nActual: [\"ab\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 300 of test - \nregexp = /(?=(a+?))(\\1ab)/\nstring = 'aaab'\nERROR !!! regexp FAILED to match anything !!!\nExpect: aab,a,aab\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 303 of test - \nregexp = /(?=(a+?))(\\1ab)/\nstring = 'aaab'\nERROR !!! regexp FAILED to match anything !!!\nExpect: aab,a,aab\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 304 of test - \nregexp = /([\\w:]+::)?(\\w+)$/\nstring = 'abcd'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"abcd\", , \"abcd\"]\nActual: [\"abcd\", \"\", \"abcd\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 308 of test - \nregexp = /([\\w:]+::)?(\\w+)$/\nstring = 'abcd'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"abcd\", , \"abcd\"]\nActual: [\"abcd\", \"\", \"abcd\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 342 of test - \nregexp = /a$/m\nstring = 'a\\nb\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: a\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 344 of test - \nregexp = /a$/m\nstring = 'b\\na\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: a\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 353 of test - \nregexp = /aa$/m\nstring = 'aa\\nb\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: aa\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 355 of test - \nregexp = /aa$/m\nstring = 'b\\naa\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: aa\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 364 of test - \nregexp = /ab$/m\nstring = 'ab\\nb\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ab\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 366 of test - \nregexp = /ab$/m\nstring = 'b\\nab\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ab\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 375 of test - \nregexp = /abb$/m\nstring = 'abb\\nb\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: abb\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 377 of test - \nregexp = /abb$/m\nstring = 'b\\nabb\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: abb\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 383 of test - \nregexp = /^d[x][x][x]/m\nstring = 'abcd\\ndxxx'\nERROR !!! regexp FAILED to match anything !!!\nExpect: dxxx\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 391 of test - \nregexp = /\\.c(pp|xx|c)?$/i\nstring = 'IO.c'\nERROR !!! regexp failed to give expected match array:\nExpect: [\".c\", , ]\nActual: [\".c\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 392 of test - \nregexp = /(\\.c(pp|xx|c)?$)/i\nstring = 'IO.c'\nERROR !!! regexp failed to give expected match array:\nExpect: [\".c\", \".c\", , ]\nActual: [\".c\", \".c\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 394 of test - \nregexp = /^([ab]*?)(b)?(c)$/\nstring = 'abac'\nERROR !!! regexp FAILED to match anything !!!\nExpect: abac,aba,,c\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 412 of test - \nregexp = /^(a(b)?)+$/\nstring = 'aba'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"aba\", \"a\", , ]\nActual: [\"aba\", \"a\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 413 of test - \nregexp = /^(aa(bb)?)+$/\nstring = 'aabbaa'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"aabbaa\", \"aa\", , ]\nActual: [\"aabbaa\", \"aa\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 414 of test - \nregexp = /^.{9}abc.*\\n/m\nstring = '123\\nabcabcabcabc\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: abcabcabcabc\n\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 415 of test - \nregexp = /^(a)?a$/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", , ]\nActual: [\"a\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 416 of test - \nregexp = /^(a\\1?)(a\\1?)(a\\2?)(a\\3?)$/\nstring = 'aaaaaa'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"aaaaaa\", \"a\", \"aa\", \"a\", \"aa\"]\nActual: [\"aaaaaa\", \"aa\", \"a\", \"aa\", \"a\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 418 of test - \nregexp = /^(0+)?(?:x(1))?/\nstring = 'x1'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"x1\", , \"1\"]\nActual: [\"x1\", \"\", \"1\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 419 of test - \nregexp = /^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?/\nstring = '012cxx0190'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"012cxx0190\", \"012c\", , \"0190\"]\nActual: [\"012cxx0190\", \"012c\", \"\", \"0190\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 420 of test - \nregexp = /^(b+?|a){1,2}c/\nstring = 'bbbac'\nERROR !!! regexp FAILED to match anything !!!\nExpect: bbbac,a\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 421 of test - \nregexp = /^(b+?|a){1,2}c/\nstring = 'bbbbac'\nERROR !!! regexp FAILED to match anything !!!\nExpect: bbbbac,a\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-002.js", "Section 40 of test - \nregexp = /(a)|\\1/\nstring = 'x'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\", , ]\nActual: [\"\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-105972.js", "Section 1 of test - \nregexp = /^.*?$/\nstring = 'Hello World'\nERROR !!! regexp FAILED to match anything !!!\nExpect: Hello World\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-105972.js", "Section 2 of test - \nregexp = /^.*?/\nstring = 'Hello World'\nERROR !!! regexp FAILED to match anything !!!\nExpect: \nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-105972.js", "Section 3 of test - \nregexp = /^.*?(:|$)/\nstring = 'Hello: World'\nERROR !!! regexp FAILED to match anything !!!\nExpect: Hello:,:\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-123437.js", "Section 1 of test - \nregexp = /(a)?a/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", , ]\nActual: [\"a\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-123437.js", "Section 2 of test - \nregexp = /a|(b)/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", , ]\nActual: [\"a\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-123437.js", "Section 3 of test - \nregexp = /(a)?(a)/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", , \"a\"]\nActual: [\"a\", \"\", \"a\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-165353.js", "Section 1 of test - \nregexp = /^([a-z]+)*[a-z]$/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", , ]\nActual: [\"a\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-169497.js", "Section 1 of test - \nregexp = /<body.*>((.*\\n?)*?)<\\/body>/i\nstring = '<html>\\n<body onXXX=\"alert(event.type);\">\\n<p>Kibology for all</p>\\n<p>All for Kibology</p>\\n</body>\\n</html>'\nERROR !!! regexp FAILED to match anything !!!\nExpect: <body onXXX=\"alert(event.type);\">\n<p>Kibology for all</p>\n<p>All for Kibology</p>\n</body>,\n<p>Kibology for all</p>\n<p>All for Kibology</p>\n,<p>All for Kibology</p>\n\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-187133.js", "Section 5 of test - \nregexp = /(?!a|b)|c/\nstring = 'bc'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\"]\nActual: [\"c\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 1 of test - \nregexp = /(\\d|\\d\\s){2,}/\nstring = '12 3 45'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"12\", \"2\"]\nActual: [\"12 3 45\", \"5\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 3 of test - \nregexp = /(\\d|\\d\\s)+/\nstring = '12 3 45'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"12\", \"2\"]\nActual: [\"12 3 45\", \"5\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 8 of test - \nregexp = /(\\d|\\d\\s){2,}?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 12,2\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 9 of test - \nregexp = /(\\d|\\d\\s){4,}?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 12 3 4,4\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 10 of test - \nregexp = /(\\d|\\d\\s)+?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 1,1\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 11 of test - \nregexp = /(\\d\\s?){4,}?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 12 3 4,4\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 12 of test - \nregexp = /(\\d\\s|\\d){2,}?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 12 ,2 \nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 13 of test - \nregexp = /(\\d\\s|\\d){4,}?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 12 3 4,4\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 14 of test - \nregexp = /(\\d\\s|\\d)+?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 1,1\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-202564.js", "Section 1 of test - \nregexp = /(?:(.+), )?(.+), (..) to (?:(.+), )?(.+), (..)/\nstring = 'Seattle, WA to Buckley, WA'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"Seattle, WA to Buckley, WA\", , \"Seattle\", \"WA\", , \"Buckley\", \"WA\"]\nActual: [\"Seattle, WA to Buckley, WA\", \"\", \"Seattle\", \"WA\", \"\", \"Buckley\", \"WA\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 2 of test - \nregexp = /(a|b*){5,}/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", \"\"]\nActual: [\"a\", \"a\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 3 of test - \nregexp = /(b*)*/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\", , ]\nActual: [\"\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 5 of test - \nregexp = /^\\-?(\\d{1,}|\\.{0,})*(\\,\\d{1,})?$/\nstring = '100.00'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"100.00\", \"00\", , ]\nActual: [\"100.00\", \"00\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-216591.js", "Section 1 of test - \nregexp = /\\{(([a-z0-9\\-_]+?\\.)+?)([a-z0-9\\-_]+?)\\}/i\nstring = 'a {result.data.DATA} b'\nERROR !!! regexp FAILED to match anything !!!\nExpect: {result.data.DATA},result.data.,data.,DATA\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-216591.js", "Section 2 of test - \nregexp = /\\{(([a-z0-9\\-_]+?\\.)+?)([a-z0-9\\-_]+?)\\}/gi\nstring = 'a {result.data.DATA} b'\nERROR !!! match arrays have different lengths:\nExpect: [\"{result.data.DATA}\"]\nActual: []\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-220367-001.js", "Section 1 of test - \nregexp = /(a)|(b)/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", \"a\", , ]\nActual: [\"a\", \"a\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-220367-001.js", "Section 2 of test - \nregexp = /(a)|(b)/\nstring = 'b'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"b\", , \"b\"]\nActual: [\"b\", \"\", \"b\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-223535.js", "Section 2 of test - \nregexp = /|a/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\"]\nActual: [\"a\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-223535.js", "Section 6 of test - \nregexp = /(|a)/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\", \"\"]\nActual: [\"a\", \"a\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-223535.js", "Section 7 of test - \nregexp = /(|a|)/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\", \"\"]\nActual: [\"a\", \"a\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-224676.js", "Section 17 of test - \nregexp = /[x]b|(a)/\nstring = 'ZZZxbZZZ'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"xb\", , ]\nActual: [\"xb\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-224676.js", "Section 18 of test - \nregexp = /[x]b|()a/\nstring = 'ZZZxbZZZ'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"xb\", , ]\nActual: [\"xb\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-225289.js", "Section 7 of test - \nregexp = /(a)|([^a])/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", \"a\", , ]\nActual: [\"a\", \"a\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-225289.js", "Section 9 of test - \nregexp = /(a)|([^a])/\nstring = '()'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"(\", , \"(\"]\nActual: [\"(\", \"\", \"(\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-225289.js", "Section 10 of test - \nregexp = /((?:a|[^a])*)/g\nstring = 'a'\nERROR !!! match arrays have different lengths:\nExpect: [\"a\", \"\"]\nActual: [\"a\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-225289.js", "Section 11 of test - \nregexp = /((?:a|[^a])*)/g\nstring = ''\nERROR !!! match arrays have different lengths:\nExpect: [\"\"]\nActual: []\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-225289.js", "Section 12 of test - \nregexp = /((?:a|[^a])*)/g\nstring = '()'\nERROR !!! match arrays have different lengths:\nExpect: [\"()\", \"\"]\nActual: [\"()\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-31316.js", "Section 1 of test - \nregexp = /<([^\\/<>][^<>]*[^\\/])>|<([^\\/<>])>/\nstring = '<p>Some<br />test</p>'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"<p>\", , \"p\"]\nActual: [\"<p>\", \"\", \"p\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-330684.js", "Do not hang on RegExp", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-375711.js", "Do not assert with /[Q-b]/i.exec(\"\"): /[q-b]/.exec(\"\")", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-375711.js", "Do not assert with /[Q-b]/i.exec(\"\"): /[q-b]/i.exec(\"\")", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(?)'and flag 'i'", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(?)'and flag 'g'", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(?)'and flag 'm'", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(?)'and flag 'undefined'", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(a'and flag 'i'", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(a'and flag 'g'", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(a'and flag 'm'", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(a'and flag 'undefined'", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '( ]'and flag 'i'", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '( ]'and flag 'g'", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '( ]'and flag 'm'", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '( ]'and flag 'undefined'", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-78156.js", "Section 1 of test - \nregexp = /^\\d/gm\nstring = 'aaa\\n789\\r\\nccc\\r\\n345'\nERROR !!! match arrays have different lengths:\nExpect: [\"7\", \"3\"]\nActual: []\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-78156.js", "Section 2 of test - \nregexp = /\\d$/gm\nstring = 'aaa\\n789\\r\\nccc\\r\\n345'\nERROR !!! match arrays have different lengths:\nExpect: [\"9\", \"5\"]\nActual: [\"5\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-78156.js", "Section 3 of test - \nregexp = /^\\d/gm\nstring = 'aaa\\n789\\r\\nccc\\r\\nddd'\nERROR !!! match arrays have different lengths:\nExpect: [\"7\"]\nActual: []\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-78156.js", "Section 4 of test - \nregexp = /\\d$/gm\nstring = 'aaa\\n789\\r\\nccc\\r\\nddd'\nERROR !!! match arrays have different lengths:\nExpect: [\"9\"]\nActual: []\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-85721.js", "Section 2 of test - \nregexp = /<sql:connection id=\"([^\\r\\n]*?)\">\\s*<sql:url>\\s*([^\\r\\n]*?)\\s*<\\/sql:url>\\s*<sql:driver>\\s*([^\\r\\n]*?)\\s*<\\/sql:driver>\\s*(\\s*<sql:userId>\\s*([^\\r\\n]*?)\\s*<\\/sql:userId>\\s*)?\\s*(\\s*<sql:password>\\s*([^\\r\\n]*?)\\s*<\\/sql:password>\\s*)?\\s*<\\/sql:connection>/\nstring = '<sql:connection id=\"conn1\"> <sql:url>www.m.com</sql:url> <sql:driver>drive.class</sql:driver>\\n<sql:userId>foo</sql:userId> <sql:password>goo</sql:password> </sql:connection>'\nERROR !!! regexp FAILED to match anything !!!\nExpect: <sql:connection id=\"conn1\"> <sql:url>www.m.com</sql:url> <sql:driver>drive.class</sql:driver>\n<sql:userId>foo</sql:userId> <sql:password>goo</sql:password> </sql:connection>,conn1,www.m.com,drive.class,<sql:userId>foo</sql:userId> ,foo,<sql:password>goo</sql:password> ,goo\nActual: null\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-87231.js", "Section 3 of test - \nregexp = /^(A)?(A.*)$/\nstring = 'A'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"A\", , \"A\"]\nActual: [\"A\", \"\", \"A\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-87231.js", "Section 6 of test - \nregexp = /(A)?(A.*)/\nstring = 'zxcasd;fl\\ ^AaaAAaaaf;lrlrzs'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"AaaAAaaaf;lrlrzs\", , \"AaaAAaaaf;lrlrzs\"]\nActual: [\"AaaAAaaaf;lrlrzs\", \"\", \"AaaAAaaaf;lrlrzs\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 24", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 28", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 30", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/String/15.5.4.14.js", "15.5.4.14 - String.prototype.split(/()/)", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Unicode/regress-352044-01.js", "issues with Unicode escape sequences in JavaScript source code", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Unicode/uc-001.js", "Unicode format-control character test (Category Cf.)", willFixInNextReleaseMessage); - - addFileExclusion(".+/15\\.9\\.2\\..+", "unstable on slow machines"); - addFileExclusion(".+/15\\.9\\.5\\..+", "too slooow"); - addFileExclusion("regress-130451.js", "asserts"); - addFileExclusion("regress-322135-01.js", "asserts"); - addFileExclusion("regress-322135-02.js", "asserts"); - addFileExclusion("regress-322135-03.js", "takes forever"); - addFileExclusion("regress-322135-04.js", "takes forever"); - addFileExclusion("ecma_3/RegExp/regress-375715-04.js", "bug"); - - addFileExclusion("ecma_3/RegExp/regress-289669.js", "Can fail due to relying on wall-clock time"); - - // Failures due to switch to JSC as back-end - addExpectedFailure("ecma/Array/15.4.3.1-2.js", "var props = ''; for ( p in Array ) { props += p } props", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Boolean/15.6.3.1-1.js", "var str='';for ( p in Boolean ) { str += p } str;", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Expressions/11.4.1.js", "var abc; delete(abc)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/FunctionObjects/15.3.3.1-2.js", "var str='';for (prop in Function ) str += prop; str;", willFixInNextReleaseMessage); - addExpectedFailure("ecma/ObjectObjects/15.2.3.1-1.js", "var str = '';for ( p in Object ) { str += p; }; str", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Statements/12.6.3-11.js", "result = \"\"; for ( p in Number ) { result += String(p) };", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Statements/12.6.3-2.js", "Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j]", willFixInNextReleaseMessage); - addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "-\"\\u20001234\\u2001\"", willFixInNextReleaseMessage); - addExpectedFailure("ecma_2/RegExp/properties-001.js", "//.toString()", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Date/15.9.4.3.js", "15.9.4.3 - Date.UTC edge-case arguments.: date Infinity", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Date/15.9.4.3.js", "15.9.4.3 - Date.UTC edge-case arguments.: hours Infinity", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Date/15.9.4.3.js", "15.9.4.3 - Date.UTC edge-case arguments.: minutes Infinity", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Date/15.9.4.3.js", "15.9.4.3 - Date.UTC edge-case arguments.: seconds Infinity", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Function/regress-131964.js", "Section 1 of test - ", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Function/regress-313570.js", "length of objects whose prototype chain includes a function: immutable", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/FunExpr/fe-001.js", "Both functions were defined.", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 7 of test - \nregexp = /(z)((a+)?(b+)?(c))*/\nstring = 'zaacbbbcac'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"zaacbbbcac\", \"z\", \"ac\", \"a\", , \"c\"]\nActual: [\"zaacbbbcac\", \"z\", \"ac\", \"a\", \"bbb\", \"c\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 12 of test - \nregexp = /(.*?)a(?!(a+)b\\2c)\\2(.*)/\nstring = 'baaabaac'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"baaabaac\", \"ba\", , \"abaac\"]\nActual: [\"baaabaac\", \"ba\", \"aa\", \"abaac\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 218 of test - \nregexp = /((foo)|(bar))*/\nstring = 'foobar'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"foobar\", \"bar\", , \"bar\"]\nActual: [\"foobar\", \"bar\", \"foo\", \"bar\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 234 of test - \nregexp = /(?:(f)(o)(o)|(b)(a)(r))*/\nstring = 'foobar'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"foobar\", , , , \"b\", \"a\", \"r\"]\nActual: [\"foobar\", \"f\", \"o\", \"o\", \"b\", \"a\", \"r\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 241 of test - \nregexp = /^(?:b|a(?=(.)))*\\1/\nstring = 'abc'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"ab\", , ]\nActual: [\"ab\", \"b\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 412 of test - \nregexp = /^(a(b)?)+$/\nstring = 'aba'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"aba\", \"a\", , ]\nActual: [\"aba\", \"a\", \"b\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 413 of test - \nregexp = /^(aa(bb)?)+$/\nstring = 'aabbaa'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"aabbaa\", \"aa\", , ]\nActual: [\"aabbaa\", \"aa\", \"bb\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 1 of test - \nregexp = /(a|b*)*/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", \"a\"]\nActual: [\"a\", \"\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 5 of test - \nregexp = /^\\-?(\\d{1,}|\\.{0,})*(\\,\\d{1,})?$/\nstring = '100.00'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"100.00\", \"00\", , ]\nActual: [\"100.00\", \"\", , ]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 6 of test - \nregexp = /^\\-?(\\d{1,}|\\.{0,})*(\\,\\d{1,})?$/\nstring = '100,00'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"100,00\", \"100\", \",00\"]\nActual: [\"100,00\", \"\", \",00\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 7 of test - \nregexp = /^\\-?(\\d{1,}|\\.{0,})*(\\,\\d{1,})?$/\nstring = '1.000,00'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"1.000,00\", \"000\", \",00\"]\nActual: [\"1.000,00\", \"\", \",00\"]\n", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/RegExp/regress-311414.js", "RegExp captured tail match should be O(N) BigO 2 < 2", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 7", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 26", willFixInNextReleaseMessage); - -#ifdef Q_CC_MSVC - addExpectedFailure("ecma_3/Expressions/11.7.3-01.js", "11.7.3 - >>> should evaluate operands in order: order", "QTBUG-8056"); - addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.7.3 >>>", "QTBUG-8056"); - addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.13.2 >>>=", "QTBUG-8056"); -#endif - -#ifdef Q_CC_MINGW - addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(NaN,0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(NaN,-0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(Infinity, Infinity)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(Infinity, -Infinity)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(-Infinity, Infinity)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(-Infinity, -Infinity)", willFixInNextReleaseMessage); -#endif - -#ifdef Q_OS_SOLARIS - addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = 1; VAR2= -0; VAR1 /= VAR2", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = -1; VAR2= -0; VAR1 /= VAR2", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Expressions/11.5.2.js", "Number.POSITIVE_INFINITY / -0", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Expressions/11.5.2.js", "Number.NEGATIVE_INFINITY / -0", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Expressions/11.5.2.js", "1 / -0", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Expressions/11.5.2.js", "-1 / -0", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.10.js", "Math.log(-0.0000001)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.10.js", "Math.log(-1)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.11.js", "Infinity/Math.max(-0,-0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.12.js", "Infinity/Math.min(0,-0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.12.js", "Infinity/Math.min(-0,-0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(NaN,0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(NaN,-0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.13.js", "Infinity/Math.pow(-Infinity, -1)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(0, -1)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(0, -0.5)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(0, -1000)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.13.js", "Infinity/Math.pow(-0, 1)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.13.js", "Infinity/Math.pow(-0, 3)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(-0, -2)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.15.js", "Infinity/Math.round(-0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.15.js", "Infinity/Math.round(-0.49)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.15.js", "Infinity/Math.round(-0.5)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.17.js", "Infinity/Math.sqrt(-0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.18.js", "Infinity/Math.tan(-0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.2.js", "Math.acos(1.00000001)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.2.js", "Math.acos(11.00000001)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.3.js", "Math.asin(1.000001)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.3.js", "Math.asin(-1.000001)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.3.js", "Infinity/Math.asin(-0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.4.js", "Infinity/Math.atan(-0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(0, -0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.5.js", "Infinity/Math.atan2(-0, 1)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(-0,\t-0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(-0,\t-1)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.6.js", "Infinity/Math.ceil('-0')", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.6.js", "Infinity/Math.ceil(-0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.6.js", "Infinity/Math.ceil(-Number.MIN_VALUE)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.6.js", "Infinity/Math.ceil(-0.9)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.9.js", "Infinity/Math.floor(-0)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "var z = 0; print(1/-z)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "1/-1e-2000", willFixInNextReleaseMessage); -#endif - -#ifdef Q_OS_SYMBIAN - addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(-1, 0.5)", willFixInNextReleaseMessage); - addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(-1, -0.5)", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.5.1 *", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.5.2 /", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.6.2 -", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.13.2 *=", willFixInNextReleaseMessage); - addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.13.2 /=", willFixInNextReleaseMessage); -#endif - - static const char klass[] = "tst_QScriptJsTestSuite"; - - QVector<uint> *data = qt_meta_data_tst_Suite(); - // content: - *data << 1 // revision - << 0 // classname - << 0 << 0 // classinfo - << 0 << 10 // methods (backpatched later) - << 0 << 0 // properties - << 0 << 0 // enums/sets - ; - - QVector<char> *stringdata = qt_meta_stringdata_tst_Suite(); - appendCString(stringdata, klass); - appendCString(stringdata, ""); - // don't execute any tests on slow machines #if !defined(Q_OS_IRIX) // do all the test suites - QFileInfoList testSuiteDirInfos; - if (testsFound) - testSuiteDirInfos = testsDir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot); + QFileInfoList testSuiteDirInfos = testsDir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot); foreach (QFileInfo tsdi, testSuiteDirInfos) { QDir testSuiteDir(tsdi.absoluteFilePath()); // do all the dirs in the test suite QFileInfoList subSuiteDirInfos = testSuiteDir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot); foreach (QFileInfo ssdi, subSuiteDirInfos) { subSuitePaths.append(ssdi.absoluteFilePath()); - // slot: signature, parameters, type, tag, flags - QString data_slot = QString::fromLatin1("%0/%1_data()") - .arg(testSuiteDir.dirName()).arg(ssdi.fileName()); - static const int nullbyte = sizeof(klass); - *data << stringdata->size() << nullbyte << nullbyte << nullbyte << 0x08; - appendCString(stringdata, data_slot.toLatin1()); - QString slot = QString::fromLatin1("%0/%1()") - .arg(testSuiteDir.dirName()).arg(ssdi.fileName()); - *data << stringdata->size() << nullbyte << nullbyte << nullbyte << 0x08; - appendCString(stringdata, slot.toLatin1()); + QString function = QString::fromLatin1("%0/%1") + .arg(testSuiteDir.dirName()).arg(ssdi.fileName()); + addTestFunction(function, CreateDataFunction); } } #endif - (*data)[4] = subSuitePaths.size() * 2; + finalizeMetaObject(); +} + +tst_QScriptJSTestSuite::~tst_QScriptJSTestSuite() +{ +} - *data << 0; // eod +void tst_QScriptJSTestSuite::configData(TestConfig::Mode mode, const QStringList &parts) +{ + switch (mode) { + case TestConfig::Skip: + addFileExclusion(parts.at(0), parts.value(1)); + break; + + case TestConfig::ExpectFail: + addExpectedFailure(parts.at(0), parts.value(1), parts.value(2)); + break; + } +} - // initialize staticMetaObject - staticMetaObject.d.superdata = &QObject::staticMetaObject; - staticMetaObject.d.stringdata = stringdata->constData(); - staticMetaObject.d.data = data->constData(); - staticMetaObject.d.extradata = 0; +void tst_QScriptJSTestSuite::writeSkipConfigFile(QTextStream &stream) +{ + stream << QString::fromLatin1("# testcase | message") << endl; } -tst_Suite::~tst_Suite() +void tst_QScriptJSTestSuite::writeExpectFailConfigFile(QTextStream &stream) { -#ifdef GENERATE_ADDEXPECTEDFAILURE_CODE - if (!generatedAddExpectedFailureCode.isEmpty()) { - QFile file("addexpectedfailures.cpp"); - file.open(QFile::WriteOnly); - QTextStream ts(&file); - ts << generatedAddExpectedFailureCode; + stream << QString::fromLatin1("# testcase | description | message") << endl; + for (int i = 0; i < expectedFailures.size(); ++i) { + const FailureItem &fail = expectedFailures.at(i); + if (fail.pathRegExp.pattern().isEmpty()) + continue; + stream << QString::fromLatin1("%0 | %1") + .arg(fail.pathRegExp.pattern()) + .arg(escape(fail.description)); + if (!fail.message.isEmpty()) + stream << QString::fromLatin1(" | %0").arg(escape(fail.message)); + stream << endl; } -#endif } -void tst_Suite::addExpectedFailure(const QRegExp &path, const QString &description, const QString &message) +void tst_QScriptJSTestSuite::addExpectedFailure(const QRegExp &path, const QString &description, const QString &message) { expectedFailures.append(FailureItem(FailureItem::ExpectFail, path, description, message)); } -void tst_Suite::addExpectedFailure(const QString &fileName, const QString &description, const QString &message) +void tst_QScriptJSTestSuite::addExpectedFailure(const QString &fileName, const QString &description, const QString &message) { expectedFailures.append(FailureItem(FailureItem::ExpectFail, QRegExp(fileName), description, message)); } -void tst_Suite::addSkip(const QRegExp &path, const QString &description, const QString &message) +void tst_QScriptJSTestSuite::addSkip(const QRegExp &path, const QString &description, const QString &message) { expectedFailures.append(FailureItem(FailureItem::Skip, path, description, message)); } -void tst_Suite::addSkip(const QString &fileName, const QString &description, const QString &message) +void tst_QScriptJSTestSuite::addSkip(const QString &fileName, const QString &description, const QString &message) { expectedFailures.append(FailureItem(FailureItem::Skip, QRegExp(fileName), description, message)); } -bool tst_Suite::isExpectedFailure(const QString &fileName, const QString &description, +bool tst_QScriptJSTestSuite::isExpectedFailure(const QString &fileName, const QString &description, QString *message, FailureItem::Action *action) const { for (int i = 0; i < expectedFailures.size(); ++i) { @@ -857,17 +430,17 @@ bool tst_Suite::isExpectedFailure(const QString &fileName, const QString &descri return false; } -void tst_Suite::addFileExclusion(const QString &fileName, const QString &message) +void tst_QScriptJSTestSuite::addFileExclusion(const QString &fileName, const QString &message) { fileExclusions.append(qMakePair(QRegExp(fileName), message)); } -void tst_Suite::addFileExclusion(const QRegExp &rx, const QString &message) +void tst_QScriptJSTestSuite::addFileExclusion(const QRegExp &rx, const QString &message) { fileExclusions.append(qMakePair(rx, message)); } -bool tst_Suite::isExcludedFile(const QString &fileName, QString *message) const +bool tst_QScriptJSTestSuite::isExcludedFile(const QString &fileName, QString *message) const { for (int i = 0; i < fileExclusions.size(); ++i) { if (fileExclusions.at(i).first.indexIn(fileName) != -1) { @@ -879,4 +452,4 @@ bool tst_Suite::isExcludedFile(const QString &fileName, QString *message) const return false; } -QTEST_MAIN(tst_Suite) +QTEST_MAIN(tst_QScriptJSTestSuite) diff --git a/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp b/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp new file mode 100644 index 0000000..d47eb24 --- /dev/null +++ b/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp @@ -0,0 +1,481 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "abstracttestsuite.h" +#include <QtTest/QtTest> +#include <QtCore/qset.h> +#include <QtCore/qtextstream.h> + +/*! + AbstractTestSuite provides a way of building QtTest test objects + dynamically. The use case is integration of JavaScript test suites + into QtTest autotests. + + Subclasses add their tests functions with addTestFunction() in the + constructor, and must reimplement runTestFunction(). Additionally, + subclasses can reimplement initTestCase() and cleanupTestCase() + (but make sure to call the base implementation). + + AbstractTestSuite uses configuration files for getting information + about skipped tests (skip.txt) and expected test failures + (expect_fail.txt). Subclasses must reimplement + createSkipConfigFile() and createExpectFailConfigFile() for + creating these files, and configData() for processing an entry of + such a file. + + The config file format is as follows: + - Lines starting with '#' are skipped. + - Lines of the form [SYMBOL] means that the upcoming data + should only be processed if the given SYMBOL is defined on + this platform. + - Any other line is split on ' | ' and handed off to the client. + + Subclasses must provide a default tests directory (where the + subclass expects to find the script files to run as tests), and a + default config file directory. Some environment variables can be + used to affect where AbstractTestSuite will look for files: + + - QTSCRIPT_TEST_CONFIG_DIR: Overrides the default test config path. + + - QTSCRIPT_TEST_CONFIG_SUFFIX: Is appended to "skip" and + "expect_fail" to create the test config name. This makes it easy to + maintain skip- and expect_fail-files corresponding to different + revisions of a test suite, and switch between them. + + - QTSCRIPT_TEST_DIR: Overrides the default test dir. + + AbstractTestSuite does _not_ define how the test dir itself is + processed or how tests are run; this is left up to the subclass. + + If no config files are found, AbstractTestSuite will ask the + subclass to create a default skip file. Also, the + shouldGenerateExpectedFailures variable will be set to true. The + subclass should check for this when a test fails, and add an entry + to its set of expected failures. When all tests have been run, + AbstractTestSuite will ask the subclass to create the expect_fail + file based on the tests that failed. The next time the autotest is + run, the created config files will be used. + + The reason for skipping a test is usually that it takes a very long + time to complete (or even hangs completely), or it crashes. It's + not possible for the test runner to know in advance which tests are + problematic, which is why the entries to the skip file are + typically added manually. When running tests for the first time, it + can be useful to run the autotest with the -v1 command line option, + so you can see the name of each test before it's run, and can add a + skip entry if appropriate. +*/ + +// Helper class for constructing the test class's QMetaObject contents +// at runtime. +class TestMetaObjectBuilder +{ +public: + TestMetaObjectBuilder(const QByteArray &className, + const QMetaObject *superClass); + + void appendPrivateVoidSlot(const char *signature); + void appendPrivateVoidSlot(const QString &signature) + { appendPrivateVoidSlot(signature.toLatin1().constData()); } + + void assignContents(QMetaObject &); + +private: + void appendString(const char *); + void finalize(); + + const QByteArray m_className; + const QMetaObject *m_superClass; + QVector<uint> m_data; + QVector<char> m_stringdata; + int m_emptyStringOffset; + bool m_finalized; +}; + +TestMetaObjectBuilder::TestMetaObjectBuilder( + const QByteArray &className, + const QMetaObject *superClass) + : m_className(className), m_superClass(superClass), + m_finalized(false) +{ + // header + m_data << 1 // revision + << 0 // classname + << 0 << 0 // classinfo + << 0 << 10 // methods (backpatched later) + << 0 << 0 // properties + << 0 << 0 // enums/sets + ; + + appendString(className.constData()); + m_emptyStringOffset = m_stringdata.size(); + appendString(""); +} + +void TestMetaObjectBuilder::appendString(const char *s) +{ + char c; + do { + c = *(s++); + m_stringdata << c; + } while (c != '\0'); +} + +void TestMetaObjectBuilder::appendPrivateVoidSlot(const char *signature) +{ + static const int methodCountOffset = 4; + // signature, parameters, type, tag, flags + m_data << m_stringdata.size() + << m_emptyStringOffset + << m_emptyStringOffset + << m_emptyStringOffset + << 0x08; + appendString(signature); + ++m_data[methodCountOffset]; +} + +void TestMetaObjectBuilder::finalize() +{ + if (m_finalized) + return; + m_data << 0; // eod + m_finalized = true; +} + +/** + Assigns this builder's contents to the meta-object \a mo. It's up + to the caller to ensure that this builder (and hence, its data) + stays alive as long as needed. +*/ +void TestMetaObjectBuilder::assignContents(QMetaObject &mo) +{ + finalize(); + mo.d.superdata = m_superClass; + mo.d.stringdata = m_stringdata.constData(); + mo.d.data = m_data.constData(); + mo.d.extradata = 0; +} + + +class TestConfigClientInterface; +// For parsing information about skipped tests and expected failures. +class TestConfigParser +{ +public: + static void parse(const QString &path, + TestConfig::Mode mode, + TestConfigClientInterface *client); + +private: + static QString unescape(const QString &); + static bool isKnownSymbol(const QString &); + static bool isDefined(const QString &); + + static QSet<QString> knownSymbols; + static QSet<QString> definedSymbols; +}; + +QSet<QString> TestConfigParser::knownSymbols; +QSet<QString> TestConfigParser::definedSymbols; + +/** + Parses the config file at the given \a path in the given \a mode. + Handling of errors and data is delegated to the given \a client. +*/ +void TestConfigParser::parse(const QString &path, + TestConfig::Mode mode, + TestConfigClientInterface *client) +{ + QFile file(path); + if (!file.open(QIODevice::ReadOnly)) + return; + QTextStream stream(&file); + int lineNumber = 0; + QString predicate; + const QString separator = QString::fromLatin1(" | "); + while (!stream.atEnd()) { + ++lineNumber; + QString line = stream.readLine(); + if (line.isEmpty()) + continue; + if (line.startsWith('#')) // Comment + continue; + if (line.startsWith('[')) { // Predicate + if (!line.endsWith(']')) { + client->configError(path, "malformed predicate", lineNumber); + return; + } + QString symbol = line.mid(1, line.size()-2); + if (isKnownSymbol(symbol)) { + predicate = symbol; + } else { + qWarning("symbol %s is not known -- add it to TestConfigParser!", qPrintable(symbol)); + predicate = QString(); + } + } else { + if (predicate.isEmpty() || isDefined(predicate)) { + QStringList parts = line.split(separator, QString::KeepEmptyParts); + for (int i = 0; i < parts.size(); ++i) + parts[i] = unescape(parts[i]); + client->configData(mode, parts); + } + } + } +} + +QString TestConfigParser::unescape(const QString &str) +{ + return QString(str).replace("\\n", "\n"); +} + +bool TestConfigParser::isKnownSymbol(const QString &symbol) +{ + if (knownSymbols.isEmpty()) { + knownSymbols + // If you add a symbol here, add a case for it in + // isDefined() as well. + << "Q_OS_LINUX" + << "Q_OS_SOLARIS" + << "Q_OS_WINCE" + << "Q_OS_SYMBIAN" + << "Q_CC_MSVC" + << "Q_CC_MINGW" + ; + } + return knownSymbols.contains(symbol); +} + +bool TestConfigParser::isDefined(const QString &symbol) +{ + if (definedSymbols.isEmpty()) { + definedSymbols +#ifdef Q_OS_LINUX + << "Q_OS_LINUX" +#endif +#ifdef Q_OS_SOLARIS + << "Q_OS_SOLARIS" +#endif +#ifdef Q_OS_WINCE + << "Q_OS_WINCE" +#endif +#ifdef Q_OS_SYMBIAN + << "Q_OS_SYMBIAN" +#endif +#ifdef Q_CC_MSVC + << "Q_CC_MSVC" +#endif +#ifdef Q_CC_MINGW + << "Q_CC_MINGW" +#endif + ; + } + return definedSymbols.contains(symbol); +} + + +QMetaObject AbstractTestSuite::staticMetaObject; + +const QMetaObject *AbstractTestSuite::metaObject() const +{ + return &staticMetaObject; +} + +void *AbstractTestSuite::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, staticMetaObject.d.stringdata)) + return static_cast<void*>(const_cast<AbstractTestSuite*>(this)); + return QObject::qt_metacast(_clname); +} + +int AbstractTestSuite::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + switch (_id) { + case 0: + initTestCase(); + break; + case 1: + cleanupTestCase(); + break; + default: + // If another method is added above, this offset must be adjusted. + runTestFunction(_id - 2); + } + _id -= staticMetaObject.methodCount() - staticMetaObject.methodOffset(); + } + return _id; +} + +AbstractTestSuite::AbstractTestSuite(const QByteArray &className, + const QString &defaultTestsPath, + const QString &defaultConfigPath) + : shouldGenerateExpectedFailures(false), + metaBuilder(new TestMetaObjectBuilder(className, &QObject::staticMetaObject)) +{ + QString testConfigPath = qgetenv("QTSCRIPT_TEST_CONFIG_DIR"); + if (testConfigPath.isEmpty()) + testConfigPath = defaultConfigPath; + QString configSuffix = qgetenv("QTSCRIPT_TEST_CONFIG_SUFFIX"); + skipConfigPath = QString::fromLatin1("%0/skip%1.txt") + .arg(testConfigPath).arg(configSuffix); + expectFailConfigPath = QString::fromLatin1("%0/expect_fail%1.txt") + .arg(testConfigPath).arg(configSuffix); + + QString testsPath = qgetenv("QTSCRIPT_TEST_DIR"); + if (testsPath.isEmpty()) + testsPath = defaultTestsPath; + testsDir = QDir(testsPath); + + addTestFunction("initTestCase"); + addTestFunction("cleanupTestCase"); + + // Subclass constructors should add their custom test functions to + // the meta-object and call finalizeMetaObject(). +} + +AbstractTestSuite::~AbstractTestSuite() +{ + delete metaBuilder; +} + +void AbstractTestSuite::addTestFunction(const QString &name, + DataFunctionCreation dfc) +{ + if (dfc == CreateDataFunction) { + QString dataSignature = QString::fromLatin1("%0_data()").arg(name); + metaBuilder->appendPrivateVoidSlot(dataSignature); + } + QString signature = QString::fromLatin1("%0()").arg(name); + metaBuilder->appendPrivateVoidSlot(signature); +} + +void AbstractTestSuite::finalizeMetaObject() +{ + metaBuilder->assignContents(staticMetaObject); +} + +void AbstractTestSuite::initTestCase() +{ + if (!testsDir.exists()) { + QString message = QString::fromLatin1("tests directory (%0) doesn't exist.") + .arg(testsDir.path()); + QFAIL(qPrintable(message)); + return; + } + + if (QFileInfo(skipConfigPath).exists()) + TestConfigParser::parse(skipConfigPath, TestConfig::Skip, this); + else + createSkipConfigFile(); + + if (QFileInfo(expectFailConfigPath).exists()) + TestConfigParser::parse(expectFailConfigPath, TestConfig::ExpectFail, this); + else + shouldGenerateExpectedFailures = true; +} + +void AbstractTestSuite::cleanupTestCase() +{ + if (shouldGenerateExpectedFailures) + createExpectFailConfigFile(); +} + +void AbstractTestSuite::configError(const QString &path, const QString &message, int lineNumber) +{ + QString output; + output.append(path); + if (lineNumber != -1) + output.append(":").append(QString::number(lineNumber)); + output.append(": ").append(message); + QFAIL(qPrintable(output)); +} + +void AbstractTestSuite::createSkipConfigFile() +{ + QFile file(skipConfigPath); + if (!file.open(QIODevice::WriteOnly)) + return; + QWARN(qPrintable(QString::fromLatin1("creating %0").arg(skipConfigPath))); + QTextStream stream(&file); + + writeSkipConfigFile(stream); + + file.close(); +} + +void AbstractTestSuite::createExpectFailConfigFile() +{ + QFile file(expectFailConfigPath); + if (!file.open(QFile::WriteOnly)) + return; + QWARN(qPrintable(QString::fromLatin1("creating %0").arg(expectFailConfigPath))); + QTextStream stream(&file); + + writeExpectFailConfigFile(stream); + + file.close(); +} + +/*! + Convenience function for reading all contents of a file. + */ +QString AbstractTestSuite::readFile(const QString &filename) +{ + QFile file(filename); + if (!file.open(QFile::ReadOnly)) + return QString(); + QTextStream stream(&file); + stream.setCodec("UTF-8"); + return stream.readAll(); +} + +/*! + Escapes characters in the string \a str so it's suitable for writing + to a config file. + */ +QString AbstractTestSuite::escape(const QString &str) +{ + return QString(str).replace("\n", "\\n"); +} diff --git a/tests/auto/qscriptv8testsuite/abstracttestsuite.h b/tests/auto/qscriptv8testsuite/abstracttestsuite.h new file mode 100644 index 0000000..b13c61a --- /dev/null +++ b/tests/auto/qscriptv8testsuite/abstracttestsuite.h @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ABSTRACTTESTSUITE_H +#define ABSTRACTTESTSUITE_H + +#include <QtCore/qobject.h> + +#include <QtCore/qbytearray.h> +#include <QtCore/qdir.h> +#include <QtCore/qstring.h> +#include <QtCore/qstringlist.h> +#include <QtCore/qvector.h> +#include <QtCore/qtextstream.h> + +class TestMetaObjectBuilder; + +namespace TestConfig { +enum Mode { + Skip, + ExpectFail +}; +} + +// For receiving callbacks from the config parser. +class TestConfigClientInterface +{ +public: + virtual ~TestConfigClientInterface() {} + virtual void configData(TestConfig::Mode mode, + const QStringList &parts) = 0; + virtual void configError(const QString &path, + const QString &message, + int lineNumber) = 0; +}; + +class AbstractTestSuite : public QObject, + public TestConfigClientInterface +{ +// No Q_OBJECT macro, we implement the meta-object ourselves. +public: + AbstractTestSuite(const QByteArray &className, + const QString &defaultTestsPath, + const QString &defaultConfigPath); + virtual ~AbstractTestSuite(); + + static QMetaObject staticMetaObject; + virtual const QMetaObject *metaObject() const; + virtual void *qt_metacast(const char *); + virtual int qt_metacall(QMetaObject::Call, int, void **argv); + + static QString readFile(const QString &); + static QString escape(const QString &); + +protected: + enum DataFunctionCreation { + DontCreateDataFunction, + CreateDataFunction + }; + + void addTestFunction(const QString &, + DataFunctionCreation = DontCreateDataFunction); + void finalizeMetaObject(); + + virtual void initTestCase(); + virtual void cleanupTestCase(); + + virtual void writeSkipConfigFile(QTextStream &) = 0; + virtual void writeExpectFailConfigFile(QTextStream &) = 0; + + virtual void runTestFunction(int index) = 0; + + virtual void configError(const QString &path, const QString &message, int lineNumber); + + QDir testsDir; + bool shouldGenerateExpectedFailures; + +private: + TestMetaObjectBuilder *metaBuilder; + QString skipConfigPath, expectFailConfigPath; + +private: + void createSkipConfigFile(); + void createExpectFailConfigFile(); +}; + +#endif diff --git a/tests/auto/qscriptv8testsuite/abstracttestsuite.pri b/tests/auto/qscriptv8testsuite/abstracttestsuite.pri new file mode 100644 index 0000000..1de5b93 --- /dev/null +++ b/tests/auto/qscriptv8testsuite/abstracttestsuite.pri @@ -0,0 +1,4 @@ +SOURCES += $$PWD/abstracttestsuite.cpp +HEADERS += $$PWD/abstracttestsuite.h +INCLUDEPATH += $$PWD +DEPENDPATH += $$PWD diff --git a/tests/auto/qscriptv8testsuite/expect_fail.txt b/tests/auto/qscriptv8testsuite/expect_fail.txt new file mode 100644 index 0000000..a4eee73 --- /dev/null +++ b/tests/auto/qscriptv8testsuite/expect_fail.txt @@ -0,0 +1,16 @@ +# testcase | actual | expected | message +arguments-enum | 2 | 0 +const-redecl | undefined | TypeError | local:'const x; var x' +date-parse | NaN | 946713600000 | Sat, 01-Jan-2000 08:00:00 GMT+00:00 +delete-global-properties | true | false +delete | false | true | delete 100 +function-arguments-null | false | true +function-caller | null | function eval() {\n [native code]\n} +function-prototype | prototype | disconnectconnect +global-const-var-conflicts | false | true +number-tostring | 0 | 0.0000a7c5ac471b4788 +parse-int-float | 1e+21 | 1 +regexp | false | true +string-lastindexof | 0 | -1 +string-split | 4 | 3 | 19 - array length +substr | abcdefghijklmn | diff --git a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro index 00e2e01..e1c6234 100644 --- a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro +++ b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro @@ -2,3 +2,4 @@ load(qttest_p4) QT = core script SOURCES += tst_qscriptv8testsuite.cpp RESOURCES += qscriptv8testsuite.qrc +include(abstracttestsuite.pri) diff --git a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.qrc b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.qrc index a894ee5..150ccf0 100644 --- a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.qrc +++ b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.qrc @@ -1,5 +1,7 @@ <!DOCTYPE RCC><RCC version="1.0"> <qresource> <file>tests</file> + <file>expect_fail.txt</file> + <file>skip.txt</file> </qresource> </RCC> diff --git a/tests/auto/qscriptv8testsuite/skip.txt b/tests/auto/qscriptv8testsuite/skip.txt new file mode 100644 index 0000000..3c2cc53 --- /dev/null +++ b/tests/auto/qscriptv8testsuite/skip.txt @@ -0,0 +1,17 @@ +# testcase | message +debug-* | not applicable +mirror-* | not applicable +array-concat | Hangs on JSC backend +array-splice | Hangs on JSC backend +sparse-array-reverse | Hangs on JSC backend +string-case | V8-specific behavior? (Doesn't pass on SpiderMonkey either) + +[Q_OS_WINCE] +deep-recursion | Demands too much memory on WinCE +nested-repetition-count-overflow | Demands too much memory on WinCE +unicode-test | Demands too much memory on WinCE +mul-exhaustive | Demands too much memory on WinCE + +[Q_OS_SYMBIAN] +nested-repetition-count-overflow | Demands too much memory on Symbian +unicode-test | Demands too much memory on Symbian diff --git a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp index 7d0858e..b35fd06 100644 --- a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp +++ b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp @@ -40,68 +40,33 @@ ****************************************************************************/ +#include "abstracttestsuite.h" #include <QtTest/QtTest> -#include <QByteArray> - #include <QtScript> //TESTED_CLASS= //TESTED_FILES= -// Uncomment the following define to have the autotest generate -// addExpectedFailure() code for all the tests that fail. -// This is useful when a whole new test (sub)suite is added. -// The code is stored in addexpectedfailures.cpp. -// Paste the contents into this file after the existing -// addExpectedFailure() calls. - -//#define GENERATE_ADDEXPECTEDFAILURE_CODE - -static QString readFile(const QString &filename) -{ - QFile file(filename); - if (!file.open(QFile::ReadOnly)) - return QString(); - QTextStream stream(&file); - stream.setCodec("UTF-8"); - return stream.readAll(); -} - -static void appendCString(QVector<char> *v, const char *s) -{ - char c; - do { - c = *(s++); - *v << c; - } while (c != '\0'); -} - -struct ExpectedFailure +class tst_QScriptV8TestSuite : public AbstractTestSuite { - ExpectedFailure(const QString &name, const QString &act, - const QString &exp, const QString &msg) - : testName(name), actual(act), expected(exp), message(msg) - { } - - QString testName; - QString actual; - QString expected; - QString message; -}; - -class tst_Suite : public QObject -{ - public: - tst_Suite(); - virtual ~tst_Suite(); + tst_QScriptV8TestSuite(); + virtual ~tst_QScriptV8TestSuite(); + +protected: + struct ExpectedFailure + { + ExpectedFailure(const QString &name, const QString &act, + const QString &exp, const QString &msg) + : testName(name), actual(act), expected(exp), message(msg) + { } + + QString testName; + QString actual; + QString expected; + QString message; + }; - static QMetaObject staticMetaObject; - virtual const QMetaObject *metaObject() const; - virtual void *qt_metacast(const char *); - virtual int qt_metacall(QMetaObject::Call, int, void **argv); - -private: void addExpectedFailure(const QString &testName, const QString &actual, const QString &expected, const QString &message); bool isExpectedFailure(const QString &testName, const QString &actual, @@ -110,34 +75,23 @@ private: void addTestExclusion(const QRegExp &rx, const QString &message); bool isExcludedTest(const QString &testName, QString *message) const; - QDir testsDir; + virtual void initTestCase(); + virtual void configData(TestConfig::Mode mode, const QStringList &parts); + virtual void writeSkipConfigFile(QTextStream &); + virtual void writeExpectFailConfigFile(QTextStream &); + virtual void runTestFunction(int testIndex); + QStringList testNames; QList<ExpectedFailure> expectedFailures; QList<QPair<QRegExp, QString> > testExclusions; QString mjsunitContents; -#ifdef GENERATE_ADDEXPECTEDFAILURE_CODE - QString generatedAddExpectedFailureCode; -#endif }; -QMetaObject tst_Suite::staticMetaObject; - -Q_GLOBAL_STATIC(QVector<uint>, qt_meta_data_tst_Suite) -Q_GLOBAL_STATIC(QVector<char>, qt_meta_stringdata_tst_Suite) - -const QMetaObject *tst_Suite::metaObject() const -{ - return &staticMetaObject; -} - -void *tst_Suite::qt_metacast(const char *_clname) -{ - if (!_clname) return 0; - if (!strcmp(_clname, qt_meta_stringdata_tst_Suite()->constData())) - return static_cast<void*>(const_cast<tst_Suite*>(this)); - return QObject::qt_metacast(_clname); -} - +// We expect failing tests to call the fail() function (defined in +// mjsunit.js) with arguments expected, actual, message_opt. This +// function intercepts the call, calls the real fail() function (which +// will throw an exception), and sets the original arguments on the +// exception object so that we can process them later. static QScriptValue qscript_fail(QScriptContext *ctx, QScriptEngine *eng) { QScriptValue realFail = ctx->callee().data(); @@ -146,193 +100,141 @@ static QScriptValue qscript_fail(QScriptContext *ctx, QScriptEngine *eng) Q_ASSERT(eng->hasUncaughtException()); ret.setProperty("expected", ctx->argument(0)); ret.setProperty("actual", ctx->argument(1)); + ret.setProperty("message", ctx->argument(2)); QScriptContextInfo info(ctx->parentContext()->parentContext()); ret.setProperty("lineNumber", info.lineNumber()); return ret; } -int tst_Suite::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +void tst_QScriptV8TestSuite::writeSkipConfigFile(QTextStream &stream) { - _id = QObject::qt_metacall(_c, _id, _a); - if (_id < 0) - return _id; - if (_c == QMetaObject::InvokeMetaMethod) { - QString name = testNames.at(_id); - QString path = testsDir.absoluteFilePath(name + ".js"); - QString excludeMessage; - if (isExcludedTest(name, &excludeMessage)) { - QTest::qSkip(excludeMessage.toLatin1(), QTest::SkipAll, path.toLatin1(), -1); - } else { - QScriptEngine engine; - engine.evaluate(mjsunitContents).toString(); - if (engine.hasUncaughtException()) { - QStringList bt = engine.uncaughtExceptionBacktrace(); - QString err = engine.uncaughtException().toString(); - qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n"))); - } else { - QScriptValue fakeFail = engine.newFunction(qscript_fail); - fakeFail.setData(engine.globalObject().property("fail")); - engine.globalObject().setProperty("fail", fakeFail); - QString contents = readFile(path); - QScriptValue ret = engine.evaluate(contents); - if (engine.hasUncaughtException()) { - if (!ret.isError()) { - Q_ASSERT(ret.instanceOf(engine.globalObject().property("MjsUnitAssertionError"))); - QString actual = ret.property("actual").toString(); - QString expected = ret.property("expected").toString(); - int lineNumber = ret.property("lineNumber").toInt32(); - QString failMessage; - if (isExpectedFailure(name, actual, expected, &failMessage)) { - QTest::qExpectFail("", failMessage.toLatin1(), - QTest::Continue, path.toLatin1(), - lineNumber); - } -#ifdef GENERATE_ADDEXPECTEDFAILURE_CODE - else { - generatedAddExpectedFailureCode.append( - " addExpectedFailure(\"" + name - + "\", \"" + actual + "\", \"" + expected - + "\", willFixInNextReleaseMessage);\n"); - } -#endif - QTest::qCompare(actual, expected, "actual", "expect", - path.toLatin1(), lineNumber); - } else { - int lineNumber = ret.property("lineNumber").toInt32(); - QTest::qExpectFail("", ret.toString().toLatin1(), - QTest::Continue, path.toLatin1(), lineNumber); - QTest::qVerify(false, ret.toString().toLatin1(), "", path.toLatin1(), lineNumber); - } - } - } - } - _id -= testNames.size(); - } - return _id; + stream << QString::fromLatin1("# testcase | message") << endl; } -tst_Suite::tst_Suite() +void tst_QScriptV8TestSuite::writeExpectFailConfigFile(QTextStream &stream) { - testsDir = QDir(":/tests"); - if (!testsDir.exists()) { - qWarning("*** no tests/ dir!"); - } else { - if (!testsDir.exists("mjsunit.js")) - qWarning("*** no tests/mjsunit.js file!"); - else { - mjsunitContents = readFile(testsDir.absoluteFilePath("mjsunit.js")); - if (mjsunitContents.isEmpty()) - qWarning("*** tests/mjsunit.js is empty!"); - } + stream << QString::fromLatin1("# testcase | actual | expected | message") << endl; + for (int i = 0; i < expectedFailures.size(); ++i) { + const ExpectedFailure &fail = expectedFailures.at(i); + stream << QString::fromLatin1("%0 | %1 | %2") + .arg(fail.testName) + .arg(escape(fail.actual)) + .arg(escape(fail.expected)); + if (!fail.message.isEmpty()) + stream << QString::fromLatin1(" | %0").arg(escape(fail.message)); + stream << endl; } - QString willFixInNextReleaseMessage = QString::fromLatin1("Will fix in next release"); - addExpectedFailure("arguments-enum", "2", "0", willFixInNextReleaseMessage); - addExpectedFailure("const-redecl", "undefined", "TypeError", willFixInNextReleaseMessage); - addExpectedFailure("global-const-var-conflicts", "false", "true", willFixInNextReleaseMessage); - addExpectedFailure("string-lastindexof", "0", "-1", "test is wrong?"); - -#ifndef Q_OS_LINUX - addExpectedFailure("to-precision", "1.235e+27", "1.234e+27", "QTBUG-8053: toPrecision(4) gives wrong result on Mac"); -#endif - -#ifdef Q_OS_SOLARIS - addExpectedFailure("math-min-max", "Infinity", "-Infinity", willFixInNextReleaseMessage); - addExpectedFailure("negate-zero", "false", "true", willFixInNextReleaseMessage); - addExpectedFailure("str-to-num", "Infinity", "-Infinity", willFixInNextReleaseMessage); -#endif - - addTestExclusion("debug-*", "not applicable"); - addTestExclusion("mirror-*", "not applicable"); - - addTestExclusion("array-concat", "Hangs on JSC backend"); - addTestExclusion("array-splice", "Hangs on JSC backend"); - addTestExclusion("sparse-array-reverse", "Hangs on JSC backend"); - - addTestExclusion("string-case", "V8-specific behavior? (Doesn't pass on SpiderMonkey either)"); - -#ifdef Q_OS_WINCE - addTestExclusion("deep-recursion", "Demands too much memory on WinCE"); - addTestExclusion("nested-repetition-count-overflow", "Demands too much memory on WinCE"); - addTestExclusion("unicode-test", "Demands too much memory on WinCE"); - addTestExclusion("mul-exhaustive", "Demands too much memory on WinCE"); -#endif - -#ifdef Q_OS_SYMBIAN - addTestExclusion("nested-repetition-count-overflow", "Demands too much memory on Symbian"); - addTestExclusion("unicode-test", "Demands too much memory on Symbian"); -#endif - // Failures due to switch to JSC as back-end - addExpectedFailure("date-parse", "NaN", "946713600000", willFixInNextReleaseMessage); - addExpectedFailure("delete-global-properties", "true", "false", willFixInNextReleaseMessage); - addExpectedFailure("delete", "false", "true", willFixInNextReleaseMessage); - addExpectedFailure("function-arguments-null", "false", "true", willFixInNextReleaseMessage); - addExpectedFailure("function-caller", "null", "function eval() {\n [native code]\n}", willFixInNextReleaseMessage); - addExpectedFailure("function-prototype", "prototype", "disconnectconnect", willFixInNextReleaseMessage); - addExpectedFailure("number-tostring", "0", "0.0000a7c5ac471b4788", willFixInNextReleaseMessage); - addExpectedFailure("parse-int-float", "1e+21", "1", willFixInNextReleaseMessage); - addExpectedFailure("regexp", "false", "true", willFixInNextReleaseMessage); - addExpectedFailure("smi-negative-zero", "-Infinity", "Infinity", willFixInNextReleaseMessage); - addExpectedFailure("string-split", "4", "3", willFixInNextReleaseMessage); - addExpectedFailure("substr", "abcdefghijklmn", "", willFixInNextReleaseMessage); +} - static const char klass[] = "tst_QScriptV8TestSuite"; +void tst_QScriptV8TestSuite::runTestFunction(int testIndex) +{ + QString name = testNames.at(testIndex); + QString path = testsDir.absoluteFilePath(name + ".js"); - QVector<uint> *data = qt_meta_data_tst_Suite(); - // content: - *data << 1 // revision - << 0 // classname - << 0 << 0 // classinfo - << 0 << 10 // methods (backpatched later) - << 0 << 0 // properties - << 0 << 0 // enums/sets - ; + QString excludeMessage; + if (isExcludedTest(name, &excludeMessage)) { + QTest::qSkip(excludeMessage.toLatin1(), QTest::SkipAll, path.toLatin1(), -1); + return; + } - QVector<char> *stringdata = qt_meta_stringdata_tst_Suite(); - appendCString(stringdata, klass); - appendCString(stringdata, ""); + QScriptEngine engine; + engine.evaluate(mjsunitContents); + if (engine.hasUncaughtException()) { + QStringList bt = engine.uncaughtExceptionBacktrace(); + QString err = engine.uncaughtException().toString(); + qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n"))); + } else { + // Prepare to intercept calls to mjsunit's fail() function. + QScriptValue fakeFail = engine.newFunction(qscript_fail); + fakeFail.setData(engine.globalObject().property("fail")); + engine.globalObject().setProperty("fail", fakeFail); + + QString contents = readFile(path); + QScriptValue ret = engine.evaluate(contents); + if (engine.hasUncaughtException()) { + if (!ret.isError()) { + Q_ASSERT(ret.instanceOf(engine.globalObject().property("MjsUnitAssertionError"))); + QString actual = ret.property("actual").toString(); + QString expected = ret.property("expected").toString(); + int lineNumber = ret.property("lineNumber").toInt32(); + QString failMessage; + if (shouldGenerateExpectedFailures) { + if (ret.property("message").isString()) + failMessage = ret.property("message").toString(); + addExpectedFailure(name, actual, expected, failMessage); + } else if (isExpectedFailure(name, actual, expected, &failMessage)) { + QTest::qExpectFail("", failMessage.toLatin1(), + QTest::Continue, path.toLatin1(), + lineNumber); + } + QTest::qCompare(actual, expected, "actual", "expect", + path.toLatin1(), lineNumber); + } else { + int lineNumber = ret.property("lineNumber").toInt32(); + QTest::qExpectFail("", ret.toString().toLatin1(), + QTest::Continue, path.toLatin1(), lineNumber); + QTest::qVerify(false, ret.toString().toLatin1(), "", path.toLatin1(), lineNumber); + } + } + } +} +tst_QScriptV8TestSuite::tst_QScriptV8TestSuite() + : AbstractTestSuite("tst_QScriptV8TestSuite", + ":/tests", ":/") +{ + // One test function per test file. QFileInfoList testFileInfos; testFileInfos = testsDir.entryInfoList(QStringList() << "*.js", QDir::Files); foreach (QFileInfo tfi, testFileInfos) { QString name = tfi.baseName(); - // slot: signature, parameters, type, tag, flags - QString slot = QString::fromLatin1("%0()").arg(name); - static const int nullbyte = sizeof(klass); - *data << stringdata->size() << nullbyte << nullbyte << nullbyte << 0x08; - appendCString(stringdata, slot.toLatin1()); + addTestFunction(name); testNames.append(name); } - (*data)[4] = testFileInfos.size(); + finalizeMetaObject(); +} - *data << 0; // eod +tst_QScriptV8TestSuite::~tst_QScriptV8TestSuite() +{ +} - // initialize staticMetaObject - staticMetaObject.d.superdata = &QObject::staticMetaObject; - staticMetaObject.d.stringdata = stringdata->constData(); - staticMetaObject.d.data = data->constData(); - staticMetaObject.d.extradata = 0; +void tst_QScriptV8TestSuite::initTestCase() +{ + AbstractTestSuite::initTestCase(); + + // FIXME: These warnings should be QFAIL, but that would make the + // test fail right now. + if (!testsDir.exists("mjsunit.js")) + qWarning("*** no tests/mjsunit.js file!"); + else { + mjsunitContents = readFile(testsDir.absoluteFilePath("mjsunit.js")); + if (mjsunitContents.isEmpty()) + qWarning("*** tests/mjsunit.js is empty!"); + } } -tst_Suite::~tst_Suite() +void tst_QScriptV8TestSuite::configData(TestConfig::Mode mode, const QStringList &parts) { -#ifdef GENERATE_ADDEXPECTEDFAILURE_CODE - if (!generatedAddExpectedFailureCode.isEmpty()) { - QFile file("addexpectedfailures.cpp"); - file.open(QFile::WriteOnly); - QTextStream ts(&file); - ts << generatedAddExpectedFailureCode; + switch (mode) { + case TestConfig::Skip: + addTestExclusion(parts.at(0), parts.value(1)); + break; + + case TestConfig::ExpectFail: + addExpectedFailure(parts.at(0), parts.value(1), + parts.value(2), parts.value(3)); + break; } -#endif } -void tst_Suite::addExpectedFailure(const QString &testName, const QString &actual, +void tst_QScriptV8TestSuite::addExpectedFailure(const QString &testName, const QString &actual, const QString &expected, const QString &message) { expectedFailures.append(ExpectedFailure(testName, actual, expected, message)); } -bool tst_Suite::isExpectedFailure(const QString &testName, const QString &actual, +bool tst_QScriptV8TestSuite::isExpectedFailure(const QString &testName, const QString &actual, const QString &expected, QString *message) const { for (int i = 0; i < expectedFailures.size(); ++i) { @@ -346,17 +248,17 @@ bool tst_Suite::isExpectedFailure(const QString &testName, const QString &actual return false; } -void tst_Suite::addTestExclusion(const QString &testName, const QString &message) +void tst_QScriptV8TestSuite::addTestExclusion(const QString &testName, const QString &message) { testExclusions.append(qMakePair(QRegExp(testName), message)); } -void tst_Suite::addTestExclusion(const QRegExp &rx, const QString &message) +void tst_QScriptV8TestSuite::addTestExclusion(const QRegExp &rx, const QString &message) { testExclusions.append(qMakePair(rx, message)); } -bool tst_Suite::isExcludedTest(const QString &testName, QString *message) const +bool tst_QScriptV8TestSuite::isExcludedTest(const QString &testName, QString *message) const { for (int i = 0; i < testExclusions.size(); ++i) { if (testExclusions.at(i).first.indexIn(testName) != -1) { @@ -368,4 +270,4 @@ bool tst_Suite::isExcludedTest(const QString &testName, QString *message) const return false; } -QTEST_MAIN(tst_Suite) +QTEST_MAIN(tst_QScriptV8TestSuite) diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 8177d29..739f902 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -390,6 +390,9 @@ void tst_QSslSocket::constructing() QSslConfiguration savedDefault = QSslConfiguration::defaultConfiguration(); // verify that changing the default config doesn't affect this socket + // (on Unix, the ca certs might be empty, depending on whether we load + // them on demand or not, so set them explicitly) + socket.setCaCertificates(QSslSocket::systemCaCertificates()); QSslSocket::setDefaultCaCertificates(QList<QSslCertificate>()); QSslSocket::setDefaultCiphers(QList<QSslCipher>()); QVERIFY(!socket.caCertificates().isEmpty()); @@ -518,11 +521,6 @@ void tst_QSslSocket::sslErrors_data() << 993 << (SslErrorList() << QSslError::HostNameMismatch << QSslError::SelfSignedCertificate); - - QTest::newRow("imap.trolltech.com") - << "imap.trolltech.com" - << 993 - << (SslErrorList() << QSslError::SelfSignedCertificateInChain); } void tst_QSslSocket::sslErrors() diff --git a/tests/auto/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro b/tests/auto/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro new file mode 100644 index 0000000..ea62865 --- /dev/null +++ b/tests/auto/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro @@ -0,0 +1,36 @@ +load(qttest_p4) + +SOURCES += tst_qsslsocket_onDemandCertificates_member.cpp +!wince*:win32:LIBS += -lws2_32 +QT += network +QT -= gui + +TARGET = tst_qsslsocket_onDemandCertificates_member + +win32 { + CONFIG(debug, debug|release) { + DESTDIR = debug +} else { + DESTDIR = release + } +} + +wince* { + DEFINES += SRCDIR=\\\"./\\\" + + certFiles.files = certs ssl.tar.gz + certFiles.path = . + DEPLOYMENT += certFiles +} else:symbian { + TARGET.EPOCHEAPSIZE="0x100 0x1000000" + TARGET.CAPABILITY=NetworkServices + + certFiles.files = certs ssl.tar.gz + certFiles.path = . + DEPLOYMENT += certFiles + INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE # Needed for e32svr.h in S^3 envs +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} + +requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp b/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp new file mode 100644 index 0000000..2a1358d --- /dev/null +++ b/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp @@ -0,0 +1,225 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtNetwork> +#include <QtTest/QtTest> + +#include <QNetworkProxy> +#include <QAuthenticator> + +#include "private/qhostinfo_p.h" + +#include "../network-settings.h" + +#ifdef Q_OS_SYMBIAN +#define SRCDIR "" +#endif + +#ifndef QT_NO_OPENSSL +class QSslSocketPtr: public QSharedPointer<QSslSocket> +{ +public: + inline QSslSocketPtr(QSslSocket *ptr = 0) + : QSharedPointer<QSslSocket>(ptr) + { } + + inline operator QSslSocket *() const { return data(); } +}; +#endif + +class tst_QSslSocket_onDemandCertificates_member : public QObject +{ + Q_OBJECT + + int proxyAuthCalled; + +public: + tst_QSslSocket_onDemandCertificates_member(); + virtual ~tst_QSslSocket_onDemandCertificates_member(); + +#ifndef QT_NO_OPENSSL + QSslSocketPtr newSocket(); +#endif + +public slots: + void initTestCase_data(); + void init(); + void cleanup(); + void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth); + +#ifndef QT_NO_OPENSSL +private slots: + void onDemandRootCertLoadingMemberMethods(); + +private: + QSslSocket *socket; +#endif // QT_NO_OPENSSL +}; + +tst_QSslSocket_onDemandCertificates_member::tst_QSslSocket_onDemandCertificates_member() +{ + Q_SET_DEFAULT_IAP +} + +tst_QSslSocket_onDemandCertificates_member::~tst_QSslSocket_onDemandCertificates_member() +{ +} + +enum ProxyTests { + NoProxy = 0x00, + Socks5Proxy = 0x01, + HttpProxy = 0x02, + TypeMask = 0x0f, + + NoAuth = 0x00, + AuthBasic = 0x10, + AuthNtlm = 0x20, + AuthMask = 0xf0 +}; + +void tst_QSslSocket_onDemandCertificates_member::initTestCase_data() +{ + QTest::addColumn<bool>("setProxy"); + QTest::addColumn<int>("proxyType"); + + QTest::newRow("WithoutProxy") << false << 0; + QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy); + QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic); + + QTest::newRow("WithHttpProxy") << true << int(HttpProxy); + QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic); + // uncomment the line below when NTLM works +// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm); +} + +void tst_QSslSocket_onDemandCertificates_member::init() +{ + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) { + QFETCH_GLOBAL(int, proxyType); + QString testServer = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString(); + QNetworkProxy proxy; + + switch (proxyType) { + case Socks5Proxy: + proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1080); + break; + + case Socks5Proxy | AuthBasic: + proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1081); + break; + + case HttpProxy | NoAuth: + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3128); + break; + + case HttpProxy | AuthBasic: + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3129); + break; + + case HttpProxy | AuthNtlm: + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3130); + break; + } + QNetworkProxy::setApplicationProxy(proxy); + } + + qt_qhostinfo_clear_cache(); +} + +void tst_QSslSocket_onDemandCertificates_member::cleanup() +{ + QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +} + +#ifndef QT_NO_OPENSSL +QSslSocketPtr tst_QSslSocket_onDemandCertificates_member::newSocket() +{ + QSslSocket *socket = new QSslSocket; + + proxyAuthCalled = 0; + connect(socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), + SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), + Qt::DirectConnection); + + return QSslSocketPtr(socket); +} +#endif + +void tst_QSslSocket_onDemandCertificates_member::proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth) +{ + ++proxyAuthCalled; + auth->setUser("qsockstest"); + auth->setPassword("password"); +} + +#ifndef QT_NO_OPENSSL + +void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMethods() +{ + QString host("qt.nokia.com"); + + // not using any root certs -> should not work + QSslSocketPtr socket2 = newSocket(); + this->socket = socket2; + socket2->setCaCertificates(QList<QSslCertificate>()); + socket2->connectToHostEncrypted(host, 443); + QVERIFY(!socket2->waitForEncrypted()); + + // default: using on demand loading -> should work + QSslSocketPtr socket = newSocket(); + this->socket = socket; + socket->connectToHostEncrypted(host, 443); + QVERIFY(socket->waitForEncrypted()); + + // not using any root certs again -> should not work + QSslSocketPtr socket3 = newSocket(); + this->socket = socket3; + socket3->setCaCertificates(QList<QSslCertificate>()); + socket3->connectToHostEncrypted(host, 443); + QVERIFY(!socket3->waitForEncrypted()); +} + +#endif // QT_NO_OPENSSL + +QTEST_MAIN(tst_QSslSocket_onDemandCertificates_member) +#include "tst_qsslsocket_onDemandCertificates_member.moc" diff --git a/tests/auto/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro b/tests/auto/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro new file mode 100644 index 0000000..13990cb --- /dev/null +++ b/tests/auto/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro @@ -0,0 +1,36 @@ +load(qttest_p4) + +SOURCES += tst_qsslsocket_onDemandCertificates_static.cpp +!wince*:win32:LIBS += -lws2_32 +QT += network +QT -= gui + +TARGET = tst_qsslsocket_onDemandCertificates_static + +win32 { + CONFIG(debug, debug|release) { + DESTDIR = debug +} else { + DESTDIR = release + } +} + +wince* { + DEFINES += SRCDIR=\\\"./\\\" + + certFiles.files = certs ssl.tar.gz + certFiles.path = . + DEPLOYMENT += certFiles +} else:symbian { + TARGET.EPOCHEAPSIZE="0x100 0x1000000" + TARGET.CAPABILITY=NetworkServices + + certFiles.files = certs ssl.tar.gz + certFiles.path = . + DEPLOYMENT += certFiles + INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE # Needed for e32svr.h in S^3 envs +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} + +requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp b/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp new file mode 100644 index 0000000..8259977 --- /dev/null +++ b/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp @@ -0,0 +1,226 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include <QtNetwork> +#include <QtTest/QtTest> + +#include <QNetworkProxy> +#include <QAuthenticator> + +#include "private/qhostinfo_p.h" + +#include "../network-settings.h" + +#ifdef Q_OS_SYMBIAN +#define SRCDIR "" +#endif + +#ifndef QT_NO_OPENSSL +class QSslSocketPtr: public QSharedPointer<QSslSocket> +{ +public: + inline QSslSocketPtr(QSslSocket *ptr = 0) + : QSharedPointer<QSslSocket>(ptr) + { } + + inline operator QSslSocket *() const { return data(); } +}; +#endif + +class tst_QSslSocket_onDemandCertificates_static : public QObject +{ + Q_OBJECT + + int proxyAuthCalled; + +public: + tst_QSslSocket_onDemandCertificates_static(); + virtual ~tst_QSslSocket_onDemandCertificates_static(); + +#ifndef QT_NO_OPENSSL + QSslSocketPtr newSocket(); +#endif + +public slots: + void initTestCase_data(); + void init(); + void cleanup(); + void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth); + +#ifndef QT_NO_OPENSSL +private slots: + void onDemandRootCertLoadingStaticMethods(); + +private: + QSslSocket *socket; +#endif // QT_NO_OPENSSL +}; + +tst_QSslSocket_onDemandCertificates_static::tst_QSslSocket_onDemandCertificates_static() +{ + Q_SET_DEFAULT_IAP +} + +tst_QSslSocket_onDemandCertificates_static::~tst_QSslSocket_onDemandCertificates_static() +{ +} + +enum ProxyTests { + NoProxy = 0x00, + Socks5Proxy = 0x01, + HttpProxy = 0x02, + TypeMask = 0x0f, + + NoAuth = 0x00, + AuthBasic = 0x10, + AuthNtlm = 0x20, + AuthMask = 0xf0 +}; + +void tst_QSslSocket_onDemandCertificates_static::initTestCase_data() +{ + QTest::addColumn<bool>("setProxy"); + QTest::addColumn<int>("proxyType"); + + QTest::newRow("WithoutProxy") << false << 0; + QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy); + QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic); + + QTest::newRow("WithHttpProxy") << true << int(HttpProxy); + QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic); + // uncomment the line below when NTLM works +// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm); +} + +void tst_QSslSocket_onDemandCertificates_static::init() +{ + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) { + QFETCH_GLOBAL(int, proxyType); + QString testServer = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString(); + QNetworkProxy proxy; + + switch (proxyType) { + case Socks5Proxy: + proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1080); + break; + + case Socks5Proxy | AuthBasic: + proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1081); + break; + + case HttpProxy | NoAuth: + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3128); + break; + + case HttpProxy | AuthBasic: + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3129); + break; + + case HttpProxy | AuthNtlm: + proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3130); + break; + } + QNetworkProxy::setApplicationProxy(proxy); + } + + qt_qhostinfo_clear_cache(); +} + +void tst_QSslSocket_onDemandCertificates_static::cleanup() +{ + QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy); +} + +#ifndef QT_NO_OPENSSL +QSslSocketPtr tst_QSslSocket_onDemandCertificates_static::newSocket() +{ + QSslSocket *socket = new QSslSocket; + + proxyAuthCalled = 0; + connect(socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), + SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)), + Qt::DirectConnection); + + return QSslSocketPtr(socket); +} +#endif + +void tst_QSslSocket_onDemandCertificates_static::proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth) +{ + ++proxyAuthCalled; + auth->setUser("qsockstest"); + auth->setPassword("password"); +} + +#ifndef QT_NO_OPENSSL + +void tst_QSslSocket_onDemandCertificates_static::onDemandRootCertLoadingStaticMethods() +{ + QString host("qt.nokia.com"); + + // not using any root certs -> should not work + QSslSocket::setDefaultCaCertificates(QList<QSslCertificate>()); + QSslSocketPtr socket = newSocket(); + this->socket = socket; + socket->connectToHostEncrypted(host, 443); + QVERIFY(!socket->waitForEncrypted()); + + // using system root certs -> should work + QSslSocket::setDefaultCaCertificates(QSslSocket::systemCaCertificates()); + QSslSocketPtr socket2 = newSocket(); + this->socket = socket2; + socket2->connectToHostEncrypted(host, 443); + QVERIFY(socket2->waitForEncrypted()); + + // not using any root certs again -> should not work + QSslSocket::setDefaultCaCertificates(QList<QSslCertificate>()); + QSslSocketPtr socket3 = newSocket(); + this->socket = socket3; + socket3->connectToHostEncrypted(host, 443); + QVERIFY(!socket3->waitForEncrypted()); +} + +#endif // QT_NO_OPENSSL + +QTEST_MAIN(tst_QSslSocket_onDemandCertificates_static) +#include "tst_qsslsocket_onDemandCertificates_static.moc" diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 6cff7c53..c2acc18 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -50,6 +50,8 @@ #include <unistd.h> #endif +#include "../../shared/util.h" + //TESTED_CLASS= //TESTED_FILES= @@ -272,9 +274,9 @@ void tst_QTimer::livelock() QFETCH(int, interval); LiveLockTester tester(interval); QTest::qWait(180); // we have to use wait here, since we're testing timers with a non-zero timeout - QCOMPARE(tester.timeoutsForFirst, 1); + QTRY_COMPARE(tester.timeoutsForFirst, 1); QCOMPARE(tester.timeoutsForExtra, 0); - QCOMPARE(tester.timeoutsForSecond, 1); + QTRY_COMPARE(tester.timeoutsForSecond, 1); #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) if (QSysInfo::WindowsVersion < QSysInfo::WV_XP) QEXPECT_FAIL("non-zero timer", "Multimedia timers are not available on Windows 2000", Continue); @@ -724,7 +726,7 @@ void tst_QTimer::QTBUG13633_dontBlockEvents() { DontBlockEvents t; QTest::qWait(60); - QVERIFY(t.total > 2); + QTRY_VERIFY(t.total > 2); } class SlotRepeater : public QObject { diff --git a/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp index 6cb62d0..041b61a 100644 --- a/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -46,7 +46,7 @@ #include <qsslsocket.h> -// #include "../../../../auto/network-settings.h" +#include "../../../../auto/network-settings.h" //TESTED_CLASS= //TESTED_FILES= @@ -65,6 +65,7 @@ public slots: void init(); void cleanup(); private slots: + void rootCertLoading(); void systemCaCertificates(); }; @@ -89,6 +90,16 @@ void tst_QSslSocket::cleanup() } //---------------------------------------------------------------------------------- + +void tst_QSslSocket::rootCertLoading() +{ + QBENCHMARK_ONCE { + QSslSocket socket; + socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + socket.waitForEncrypted(); + } +} + void tst_QSslSocket::systemCaCertificates() { // The results of this test change if the benchmarking system changes too much. diff --git a/tests/benchmarks/script/sunspider/tst_sunspider.cpp b/tests/benchmarks/script/sunspider/tst_sunspider.cpp index 0df19b6..9e2bb6f 100644 --- a/tests/benchmarks/script/sunspider/tst_sunspider.cpp +++ b/tests/benchmarks/script/sunspider/tst_sunspider.cpp @@ -110,7 +110,7 @@ void tst_SunSpider::benchmark_data() void tst_SunSpider::benchmark() { QFETCH(QString, testName); - QString testContents = readFile(testsDir.absoluteFilePath(testName + ".js")); + QString testContents = readFile(testsDir.filePath(testName + ".js")); QVERIFY(!testContents.isEmpty()); QScriptEngine engine; diff --git a/tests/benchmarks/script/v8/tst_v8.cpp b/tests/benchmarks/script/v8/tst_v8.cpp index 841e2f3..b9cb859 100644 --- a/tests/benchmarks/script/v8/tst_v8.cpp +++ b/tests/benchmarks/script/v8/tst_v8.cpp @@ -115,10 +115,10 @@ void tst_V8::benchmark() { QFETCH(QString, testName); - QString baseDotJsContents = readFile(testsDir.absoluteFilePath("base.js")); + QString baseDotJsContents = readFile(testsDir.filePath("base.js")); QVERIFY(!baseDotJsContents.isEmpty()); - QString testContents = readFile(testsDir.absoluteFilePath(testName + ".js")); + QString testContents = readFile(testsDir.filePath(testName + ".js")); QVERIFY(!testContents.isEmpty()); QScriptEngine engine; |