forked from qt-creator/qt-creator
Plugin tests: Run in separate settings path
...if no settings path is specified by the user.
The default settins path for tests will be set to the system's temporary
directory + "/qtc-${IDE_VERSION_LONG}-test-settings".
Change-Id: Ibeaf8883c80169b4d6a3a97020a16f910292d67a
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -82,6 +82,7 @@ static const char HELP_OPTION4[] = "--help";
|
|||||||
static const char VERSION_OPTION[] = "-version";
|
static const char VERSION_OPTION[] = "-version";
|
||||||
static const char CLIENT_OPTION[] = "-client";
|
static const char CLIENT_OPTION[] = "-client";
|
||||||
static const char SETTINGS_OPTION[] = "-settingspath";
|
static const char SETTINGS_OPTION[] = "-settingspath";
|
||||||
|
static const char TEST_OPTION[] = "-test";
|
||||||
static const char PID_OPTION[] = "-pid";
|
static const char PID_OPTION[] = "-pid";
|
||||||
static const char BLOCK_OPTION[] = "-block";
|
static const char BLOCK_OPTION[] = "-block";
|
||||||
static const char PLUGINPATH_OPTION[] = "-pluginpath";
|
static const char PLUGINPATH_OPTION[] = "-pluginpath";
|
||||||
@@ -319,6 +320,7 @@ int main(int argc, char **argv)
|
|||||||
QStringList customPluginPaths;
|
QStringList customPluginPaths;
|
||||||
QStringList arguments = app.arguments(); // adapted arguments list is passed to plugin manager later
|
QStringList arguments = app.arguments(); // adapted arguments list is passed to plugin manager later
|
||||||
QMutableStringListIterator it(arguments);
|
QMutableStringListIterator it(arguments);
|
||||||
|
bool testOptionProvided = false;
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
const QString &arg = it.next();
|
const QString &arg = it.next();
|
||||||
if (arg == QLatin1String(SETTINGS_OPTION)) {
|
if (arg == QLatin1String(SETTINGS_OPTION)) {
|
||||||
@@ -333,8 +335,15 @@ int main(int argc, char **argv)
|
|||||||
customPluginPaths << QDir::fromNativeSeparators(it.next());
|
customPluginPaths << QDir::fromNativeSeparators(it.next());
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
|
} else if (arg == QLatin1String(TEST_OPTION)) {
|
||||||
|
testOptionProvided = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (settingsPath.isEmpty() && testOptionProvided) {
|
||||||
|
settingsPath = QDir::tempPath() + QString::fromLatin1("/qtc-%1-test-settings")
|
||||||
|
.arg(QLatin1String(Core::Constants::IDE_VERSION_LONG));
|
||||||
|
settingsPath = QDir::cleanPath(settingsPath);
|
||||||
|
}
|
||||||
if (!settingsPath.isEmpty())
|
if (!settingsPath.isEmpty())
|
||||||
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, settingsPath);
|
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, settingsPath);
|
||||||
|
|
||||||
|
|||||||
@@ -614,7 +614,8 @@ void PluginManager::formatOptions(QTextStream &str, int optionIndentation, int d
|
|||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
formatOption(str, QString::fromLatin1(OptionsParser::TEST_OPTION)
|
formatOption(str, QString::fromLatin1(OptionsParser::TEST_OPTION)
|
||||||
+ QLatin1String(" <plugin>[,testfunction[:testdata]]..."), QString(),
|
+ QLatin1String(" <plugin>[,testfunction[:testdata]]..."), QString(),
|
||||||
QLatin1String("Run plugin's tests"), optionIndentation, descriptionIndentation);
|
QLatin1String("Run plugin's tests (by default a separate settings path is used)"),
|
||||||
|
optionIndentation, descriptionIndentation);
|
||||||
formatOption(str, QString::fromLatin1(OptionsParser::TEST_OPTION) + QLatin1String(" all"),
|
formatOption(str, QString::fromLatin1(OptionsParser::TEST_OPTION) + QLatin1String(" all"),
|
||||||
QString(), QLatin1String("Run tests from all plugins"),
|
QString(), QLatin1String("Run tests from all plugins"),
|
||||||
optionIndentation, descriptionIndentation);
|
optionIndentation, descriptionIndentation);
|
||||||
|
|||||||
Reference in New Issue
Block a user