From 71ec36eee4254fda345219d17659af882f3ed6ff Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Wed, 13 May 2015 13:22:46 -0700 Subject: [PATCH 1/3] Validate saves files location Also check for writable settings in unit test runes --- src/QGCApplication.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index a3f4b68..bab4d96 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -217,7 +217,10 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) : ParseCmdLineOptions(argc, argv, rgCmdLineOptions, sizeof(rgCmdLineOptions)/sizeof(rgCmdLineOptions[0]), false); QSettings settings; - +#ifdef UNITTEST_BUILD + qDebug() << "Settings location" << settings.fileName(); + Q_ASSERT(settings.isWritable()); +#endif // The setting will delete all settings on this boot fClearSettingsOptions |= settings.contains(_deleteAllSettingsKey); @@ -269,8 +272,13 @@ void QGCApplication::_initCommon(void) QString savedFilesLocation; if (settings.contains(_savedFilesLocationKey)) { savedFilesLocation = settings.value(_savedFilesLocationKey).toString(); - } else { - // No location set. Create a default one in Documents standard location. + if (!validatePossibleSavedFilesLocation(savedFilesLocation)) { + savedFilesLocation.clear(); + } + } + + if (savedFilesLocation.isEmpty()) { + // No location set (or invalid). Create a default one in Documents standard location. QString documentsLocation = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); @@ -288,6 +296,7 @@ void QGCApplication::_initCommon(void) savedFilesLocation.clear(); } } + qDebug() << "Saved files location" << savedFilesLocation; settings.setValue(_savedFilesLocationKey, savedFilesLocation); // Load application font @@ -401,7 +410,6 @@ QString QGCApplication::savedFilesLocation(void) { QSettings settings; - Q_ASSERT(settings.contains(_savedFilesLocationKey)); return settings.value(_savedFilesLocationKey).toString(); } From c4346b19d1a33924049221e630823a1b28788ff4 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Wed, 13 May 2015 13:23:02 -0700 Subject: [PATCH 2/3] Turned off, too slow for production use --- src/qgcunittest/FileManagerTest.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qgcunittest/FileManagerTest.cc b/src/qgcunittest/FileManagerTest.cc index 11c0bbe..0487114 100644 --- a/src/qgcunittest/FileManagerTest.cc +++ b/src/qgcunittest/FileManagerTest.cc @@ -27,7 +27,7 @@ #include "FileManagerTest.h" #include "UASManager.h" -UT_REGISTER_TEST(FileManagerTest) +//UT_REGISTER_TEST(FileManagerTest) FileManagerTest::FileManagerTest(void) : _mockLink(NULL), From bf3023c739e23e49ffc7f9197e288063b8efc508 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Wed, 13 May 2015 13:23:15 -0700 Subject: [PATCH 3/3] Increase timeouts for loaded TeamCity runs --- src/FactSystem/FactSystemTestBase.cc | 2 +- src/VehicleSetup/SetupViewTest.cc | 2 +- src/qgcunittest/PX4RCCalibrationTest.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/FactSystem/FactSystemTestBase.cc b/src/FactSystem/FactSystemTestBase.cc index b0944b7..1035c81 100644 --- a/src/FactSystem/FactSystemTestBase.cc +++ b/src/FactSystem/FactSystemTestBase.cc @@ -71,7 +71,7 @@ void FactSystemTestBase::_init(MAV_AUTOPILOT autopilot) QSignalSpy spyPlugin(_plugin, SIGNAL(pluginReadyChanged(bool))); if (!_plugin->pluginReady()) { - QCOMPARE(spyPlugin.wait(10000), true); + QCOMPARE(spyPlugin.wait(60000), true); } Q_ASSERT(_plugin->pluginReady()); } diff --git a/src/VehicleSetup/SetupViewTest.cc b/src/VehicleSetup/SetupViewTest.cc index 7f6b258..b046050 100644 --- a/src/VehicleSetup/SetupViewTest.cc +++ b/src/VehicleSetup/SetupViewTest.cc @@ -76,7 +76,7 @@ void SetupViewTest::_clickThrough_test(void) QSignalSpy spyPlugin(autopilot, SIGNAL(pluginReadyChanged(bool))); if (!autopilot->pluginReady()) { - QCOMPARE(spyPlugin.wait(10000), true); + QCOMPARE(spyPlugin.wait(60000), true); } Q_ASSERT(autopilot->pluginReady()); diff --git a/src/qgcunittest/PX4RCCalibrationTest.cc b/src/qgcunittest/PX4RCCalibrationTest.cc index 966c586..350b1d9 100644 --- a/src/qgcunittest/PX4RCCalibrationTest.cc +++ b/src/qgcunittest/PX4RCCalibrationTest.cc @@ -156,7 +156,7 @@ void PX4RCCalibrationTest::init(void) QSignalSpy spyPlugin(_autopilot, SIGNAL(pluginReadyChanged(bool))); if (!_autopilot->pluginReady()) { - QCOMPARE(spyPlugin.wait(10000), true); + QCOMPARE(spyPlugin.wait(60000), true); } Q_ASSERT(_autopilot->pluginReady());