Use the new test runner for the autotest

It's quite a bit faster than the old test runner.

Change-Id: If7e59dd175d740f3f702032f4affeff786be8a32
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Lars Knoll 2018-04-17 13:25:12 +02:00
parent eca0b30f22
commit f665c9b25d
4 changed files with 7754 additions and 8513 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,13 @@
CONFIG += testcase
TARGET = tst_ecmascripttests
QT += testlib
macos:CONFIG -= app_bundle
SOURCES += tst_ecmascripttests.cpp
DEFINES += SRCDIR=\\\"$$PWD\\\"
TESTSCRIPT=$$PWD/test262.py
isEmpty(V4CMD): V4CMD = qmljs
# The ES test suite takes approximately 5 mins to run, on a fairly
# vanilla developer machine, so the default watchdog timer kills the
# test some of the time. Fix by raising time-out to 400s when
# invoking tst_ecmascripttests:
checkenv.name = QTEST_FUNCTION_TIMEOUT
checkenv.value = 400000
QT_TOOL_ENV += checkenv
TEMPLATE = subdirs
SUBDIRS = testcase.pro qjstest
checkjittarget.target = check-jit
checkjittarget.commands = python $$TESTSCRIPT --command=$$V4CMD --parallel --with-test-expectations --update-expectations
checkjittarget.commands = qjstest --jit --parallel --with-test-expectations --update-expectations
checkjittarget.depends = all
QMAKE_EXTRA_TARGETS += checkjittarget
checkmothtarget.target = check-interpreter
checkmothtarget.commands = python $$TESTSCRIPT --command=\"$$V4CMD --interpret\" --parallel --with-test-expectations
checkmothtarget.commands = qjstest --interpret --parallel --with-test-expectations
checkmothtarget.depends = all
QMAKE_EXTRA_TARGETS += checkmothtarget

View File

@ -0,0 +1,15 @@
CONFIG += testcase
TARGET = tst_ecmascripttests
QT += testlib qml-private
macos:CONFIG -= app_bundle
SOURCES += tst_ecmascripttests.cpp qjstest/test262runner.cpp
HEADERS += qjstest/test262runner.h
DEFINES += SRCDIR=\\\"$$PWD\\\"
# The ES test suite takes approximately 5 mins to run, on a fairly
# vanilla developer machine, so the default watchdog timer kills the
# test some of the time. Fix by raising time-out to 400s when
# invoking tst_ecmascripttests:
checkenv.name = QTEST_FUNCTION_TIMEOUT
checkenv.value = 500000
QT_TOOL_ENV += checkenv

View File

@ -30,55 +30,37 @@
#include <QtTest/QtTest>
#include <QProcess>
#include <QLibraryInfo>
#include <qjstest/test262runner.h>
class tst_EcmaScriptTests : public QObject
{
Q_OBJECT
void runTests(bool interpret);
private slots:
void runInterpreted();
void runJitted();
};
void tst_EcmaScriptTests::runTests(bool interpret)
{
#if defined(Q_OS_LINUX) && defined(Q_PROCESSOR_X86_64)
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
if (interpret)
env.insert("QV4_FORCE_INTERPRETER", "1");
else
env.insert("QV4_JIT_CALL_THRESHOLD", "0");
QProcess process;
process.setProcessChannelMode(QProcess::ForwardedChannels);
process.setWorkingDirectory(QLatin1String(SRCDIR));
process.setProgram("python");
process.setProcessEnvironment(env);
process.setArguments(QStringList() << "test262.py" << "--command=" + QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmljs" << "--parallel" << "--with-test-expectations");
qDebug() << "Going to run" << process.program() << process.arguments() << "in" << process.workingDirectory();
process.start();
QVERIFY(process.waitForStarted());
const int timeoutInMSecs = 20 * 60 * 1000;
QVERIFY2(process.waitForFinished(timeoutInMSecs), "Tests did not terminate in time -- see output above for details");
QVERIFY2(process.exitStatus() == QProcess::NormalExit, "Running the test harness failed -- see output above for details");
QVERIFY2(process.exitCode() == 0, "Tests failed -- see output above for details");
#else
QSKIP("Currently the ecmascript tests are only run on Linux/x86-64");
#endif
}
void tst_EcmaScriptTests::runInterpreted()
{
runTests(true);
#if defined(Q_PROCESSOR_X86_64)
QDir::setCurrent(QLatin1String(SRCDIR));
Test262Runner runner(QString(), "test262");
runner.setFlags(Test262Runner::ForceBytecode|Test262Runner::WithTestExpectations|Test262Runner::Parallel|Test262Runner::Verbose);
bool result = runner.run();
QVERIFY(result);
#endif
}
void tst_EcmaScriptTests::runJitted()
{
runTests(false);
#if defined(Q_PROCESSOR_X86_64)
QDir::setCurrent(QLatin1String(SRCDIR));
Test262Runner runner(QString(), "test262");
runner.setFlags(Test262Runner::ForceJIT|Test262Runner::WithTestExpectations|Test262Runner::Parallel|Test262Runner::Verbose);
bool result = runner.run();
QVERIFY(result);
#endif
}
QTEST_GUILESS_MAIN(tst_EcmaScriptTests)