forked from qt-creator/qt-creator
AutoTest: Allow arguments for test runs
Arguments specified for run configurations were ignored so far, but sometimes it might help to process them. Add the possibility and a respective setting to be able to pass arguments to the test run. Task-number: QTCREATORBUG-17630 Change-Id: Ie64b784e8477efa02f50ce6b4cf3e55864952880 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
@@ -27,9 +27,11 @@
|
||||
#include "qttesttreeitem.h"
|
||||
#include "../testframeworkmanager.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QByteArrayList>
|
||||
#include <QSet>
|
||||
|
||||
namespace Autotest {
|
||||
namespace Internal {
|
||||
@@ -83,6 +85,62 @@ QMultiHash<QString, QString> alternativeFiles(const Core::Id &id, const QStringL
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList filterInterfering(const QStringList &provided, QStringList *omitted, bool isQuickTest)
|
||||
{
|
||||
static const QSet<QString> knownInterferingSingleOptions {
|
||||
"-txt", "-xml", "-csv", "-xunitxml", "-lightxml", "-silent", "-v1", "-v2", "-vs", "-vb",
|
||||
"-functions", "-datatags", "-nocrashhandler", "-callgrind", "-perf", "-perfcounterlist",
|
||||
"-tickcounter", "-eventcounter", "-help"
|
||||
};
|
||||
static const QSet<QString> knownInterferingOptionWithParameter = { "-o" };
|
||||
static const QSet<QString> knownAllowedOptionsWithParameter {
|
||||
"-eventdelay", "-keydelay", "-mousedelay", "-maxwarnings", "-perfcounter",
|
||||
"-minimumvalue", "-minimumtotal", "-iterations", "-median"
|
||||
};
|
||||
|
||||
// handle Quick options as well
|
||||
static const QSet<QString> knownInterferingQuickOption = { "-qtquick1" };
|
||||
static const QSet<QString> knownAllowedQuickOptionsWithParameter {
|
||||
"-import", "-plugins", "-input"
|
||||
};
|
||||
|
||||
QStringList allowed;
|
||||
auto it = provided.cbegin();
|
||||
auto end = provided.cend();
|
||||
for ( ; it != end; ++it) {
|
||||
QString currentOpt = *it;
|
||||
if (knownAllowedOptionsWithParameter.contains(currentOpt)) {
|
||||
allowed.append(currentOpt);
|
||||
++it;
|
||||
QTC_ASSERT(it != end, return QStringList());
|
||||
allowed.append(*it);
|
||||
} else if (knownInterferingOptionWithParameter.contains(currentOpt)) {
|
||||
if (omitted) {
|
||||
omitted->append(currentOpt);
|
||||
++it;
|
||||
QTC_ASSERT(it != end, return QStringList());
|
||||
omitted->append(*it);
|
||||
}
|
||||
} else if (knownInterferingSingleOptions.contains(currentOpt)) {
|
||||
if (omitted)
|
||||
omitted->append(currentOpt);
|
||||
} else if (isQuickTest) {
|
||||
if (knownAllowedQuickOptionsWithParameter.contains(currentOpt)) {
|
||||
allowed.append(currentOpt);
|
||||
++it;
|
||||
QTC_ASSERT(it != end, return QStringList());
|
||||
allowed.append(*it);
|
||||
} else if (knownInterferingQuickOption.contains(currentOpt)) {
|
||||
if (omitted)
|
||||
omitted->append(currentOpt);
|
||||
}
|
||||
} else { // might be bad, but we cannot know anything
|
||||
allowed.append(currentOpt);
|
||||
}
|
||||
}
|
||||
return allowed;
|
||||
}
|
||||
|
||||
} // namespace QTestUtils
|
||||
} // namespace Internal
|
||||
} // namespace Autotest
|
||||
|
||||
Reference in New Issue
Block a user