diff options
Diffstat (limited to 'tests/auto/qml/qv4assembler/tst_qv4assembler.cpp')
-rw-r--r-- | tests/auto/qml/qv4assembler/tst_qv4assembler.cpp | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp index afc00ec72c..fd50ff5020 100644 --- a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp +++ b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp @@ -26,20 +26,37 @@ ** ****************************************************************************/ +#include <util.h> + #include <QtTest/QtTest> #include <QtCore/qprocess.h> #include <QtCore/qtemporaryfile.h> +#include <QtQml/qqml.h> +#include <QtQml/qqmlapplicationengine.h> + #include <private/qv4global_p.h> -class tst_QV4Assembler : public QObject +#ifdef Q_OS_WIN +#include <windows.h> +#endif + +class tst_QV4Assembler : public QQmlDataTest { Q_OBJECT private slots: + void initTestCase() override; void perfMapFile(); + void functionTable(); void jitEnabled(); }; +void tst_QV4Assembler::initTestCase() +{ + qputenv("QV4_JIT_CALL_THRESHOLD", "0"); + QQmlDataTest::initTestCase(); +} + void tst_QV4Assembler::perfMapFile() { #if !defined(Q_OS_LINUX) @@ -87,6 +104,42 @@ void tst_QV4Assembler::perfMapFile() #endif } +#ifdef Q_OS_WIN +class Crash : public QObject +{ + Q_OBJECT +public: + explicit Crash(QObject *parent = nullptr) : QObject(parent) { } + Q_INVOKABLE static void crash(); +}; + +static bool crashHandlerHit = false; + +static LONG WINAPI crashHandler(EXCEPTION_POINTERS*) +{ + crashHandlerHit = true; + return EXCEPTION_CONTINUE_EXECUTION; +} + +void Crash::crash() +{ + SetUnhandledExceptionFilter(crashHandler); + RaiseException(EXCEPTION_ACCESS_VIOLATION, 0, 0, nullptr); +} +#endif + +void tst_QV4Assembler::functionTable() +{ +#ifndef Q_OS_WIN + QSKIP("Function tables only exist on windows."); +#else + QQmlApplicationEngine engine; + qmlRegisterType<Crash>("Crash", 1, 0, "Crash"); + engine.load(testFileUrl("crash.qml")); + QTRY_VERIFY(crashHandlerHit); +#endif +} + #ifdef V4_ENABLE_JIT #define JIT_ENABLED 1 #else |