diff --git a/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp index 684727758c3..6d844c18440 100644 --- a/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp @@ -37,6 +37,7 @@ #include #include +#include #include Q_DECLARE_METATYPE(QRegularExpression::PatternOptions) @@ -47,6 +48,9 @@ class tst_QRegularExpression : public QObject { Q_OBJECT +public: + static void initMain(); + private slots: void defaultConstructors(); void moveSemantics(); @@ -469,6 +473,16 @@ void tst_QRegularExpression::provideRegularExpressions() | QRegularExpression::InvertedGreedinessOption); } +static const char enableJitEnvironmentVariable[] = "QT_ENABLE_REGEXP_JIT"; + +void tst_QRegularExpression::initMain() +{ + if (!qEnvironmentVariableIsSet(enableJitEnvironmentVariable)) { + std::cerr << "Enabling QRegularExpression JIT for testing; set QT_ENABLE_REGEXP_JIT to 0 to disable it.\n"; + qputenv(enableJitEnvironmentVariable, "1"); + } +} + void tst_QRegularExpression::defaultConstructors() { QRegularExpression re;