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:
Nikolai Kosjar
2013-09-03 15:17:24 +02:00
parent 69fc3cf03f
commit f3ca72f989
2 changed files with 11 additions and 1 deletions

View File

@@ -82,6 +82,7 @@ static const char HELP_OPTION4[] = "--help";
static const char VERSION_OPTION[] = "-version";
static const char CLIENT_OPTION[] = "-client";
static const char SETTINGS_OPTION[] = "-settingspath";
static const char TEST_OPTION[] = "-test";
static const char PID_OPTION[] = "-pid";
static const char BLOCK_OPTION[] = "-block";
static const char PLUGINPATH_OPTION[] = "-pluginpath";
@@ -319,6 +320,7 @@ int main(int argc, char **argv)
QStringList customPluginPaths;
QStringList arguments = app.arguments(); // adapted arguments list is passed to plugin manager later
QMutableStringListIterator it(arguments);
bool testOptionProvided = false;
while (it.hasNext()) {
const QString &arg = it.next();
if (arg == QLatin1String(SETTINGS_OPTION)) {
@@ -333,8 +335,15 @@ int main(int argc, char **argv)
customPluginPaths << QDir::fromNativeSeparators(it.next());
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())
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, settingsPath);