Always enable QRegularExpression's JIT when testing
Given on most CI configurations we run tests only on debug builds, this means that effectively we don't test JIT paths (JIT is kept disabled in debug builds). To keep it enabled in a test, we have a few options: * export a developer-build-only variable from QtCore, to force JIT usage, and set it in the test. This is still suboptimal as many configurations aren't using developer builds in the first place; * use the already existing QT_REGEXP_USE_JIT environment variable, setting it from CMake/CTest. The problem here is that although add_test does support it, we don't expose it through our wrapper functions; * just set that env variable from within the test itself. I went for this option. Change-Id: I73abfb7fc0d76ec77e881f24c5daf5be304ab948 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
816c5de460
commit
2c3617dfcb
@ -37,6 +37,7 @@
|
||||
#include <qregularexpression.h>
|
||||
#include <qthread.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <optional>
|
||||
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user