summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Wolff <oliver.wolff@qt.io>2018-12-14 10:58:18 +0100
committerOliver Wolff <oliver.wolff@qt.io>2018-12-20 10:51:34 +0000
commite9f39c40d98213877317a42d30b78cba102e2017 (patch)
tree0844530374c0cf2526b64493e869ccf361e033f5
parent8a51638c8a69f63263d3badef93696320e416e59 (diff)
winrtrunner: Do not accept fully wildcarded logging rules from environment
When an auto test fails in CI, it does another run using QT_LOGGING_RULES=*=true. For winrt builds this rule would enable extended logging for winrtrunner and the output would be flooded with winrtrunner specific information. Instead of confusing the users, we disregard the logging rules in winrtrunner if they do not specifically enable the application's logging so that CI runs will only show information that might be interesting to the user. Change-Id: If51a666315a2e33b83d6a7613a65ab4a152eddc4 Reviewed-by: Andre de la Rocha <andre.rocha@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--src/winrtrunner/main.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/winrtrunner/main.cpp b/src/winrtrunner/main.cpp
index 72dd763c8..bf4e8fabf 100644
--- a/src/winrtrunner/main.cpp
+++ b/src/winrtrunner/main.cpp
@@ -40,6 +40,7 @@
#include <QtCore/QCommandLineParser>
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
+#include <QtCore/QRegExp>
#include <QtCore/QStringList>
#include <QtCore/QMap>
#include <QtCore/QLoggingCategory>
@@ -52,6 +53,23 @@ QT_USE_NAMESPACE
int main(int argc, char *argv[])
{
+ // If logging rules are set via env variable, we pass these to the application we are running.
+ // winrtrunner behaves different from other applications in the regard that its logging rules
+ // have to be enabled explicitly. Setting "*=true" will not enable extended logging. Reason is
+ // CI setting "*=true" if an auto test fails and additional winrtrunner output might just
+ // confuse users.
+ const QByteArray loggingRules = qgetenv("QT_LOGGING_RULES");
+ const QList<QByteArray> rules = loggingRules.split(';');
+ QRegExp runnerExp(QLatin1String("^qt\\.winrtrunner.*\\s*=\\s*true\\s*$"));
+ bool runnerRuleFound = false;
+ for (const QByteArray &rule : rules) {
+ if (runnerExp.indexIn(QLatin1String(rule)) != -1) {
+ runnerRuleFound = true;
+ break;
+ }
+ }
+ if (!runnerRuleFound)
+ qunsetenv("QT_LOGGING_RULES");
QCoreApplication a(argc, argv);
QCommandLineParser parser;
parser.setApplicationDescription(QLatin1String("winrtrunner installs, runs, and collects test "
@@ -282,8 +300,6 @@ int main(int argc, char *argv[])
return ignoreErrors ? 0 : 3;
}
- // If logging rules are set via env variable, we pass these to the application we are running
- const QByteArray loggingRules = qgetenv("QT_LOGGING_RULES");
if (!loggingRules.isNull() && !runner.setLoggingRules(loggingRules)) {
qCDebug(lcWinRtRunner) << "Could not set logging rules, exiting with code 3.";
return ignoreErrors ? 0 : 3;