From e9a1da832e6cb651a9237aa7aefd91faa1badd70 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Thu, 6 Sep 2018 16:04:15 -0700 Subject: [PATCH] Deal with no High Fidelity folder --- tools/auto-tester/src/TestRunner.cpp | 27 +++++++++++++-------------- tools/auto-tester/src/ui/AutoTester.h | 1 - 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/tools/auto-tester/src/TestRunner.cpp b/tools/auto-tester/src/TestRunner.cpp index c45af2d0ee..cb6755e70f 100644 --- a/tools/auto-tester/src/TestRunner.cpp +++ b/tools/auto-tester/src/TestRunner.cpp @@ -29,7 +29,7 @@ void TestRunner::run() { // This will be restored at the end of the tests saveExistingHighFidelityAppDataFolder(); - + // Download the latest High Fidelity installer QStringList urls; urls << INSTALLER_URL; @@ -79,23 +79,22 @@ void TestRunner::saveExistingHighFidelityAppDataFolder() { _appDataFolder = dataDirectory + "\\High Fidelity"; - if (!_appDataFolder.exists()) { - QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), - "The High Fidelity data folder was not found in " + dataDirectory); - exit(-1); + if (_appDataFolder.exists()) { + // The original folder is saved in a unique name + _savedAppDataFolder = dataDirectory + "/" + UNIQUE_FOLDER_NAME; + _appDataFolder.rename(_appDataFolder.path(), _savedAppDataFolder.path()); } - // The original folder is saved in a unique name - _savedAppDataFolder = dataDirectory + "/" + UNIQUE_FOLDER_NAME; - _appDataFolder.rename(_appDataFolder.path(), _savedAppDataFolder.path()); - // Copy an "empty" AppData folder (i.e. no entities) copyFolder(QDir::currentPath() + "/AppDataHighFidelity", _appDataFolder.path()); } void TestRunner::restoreHighFidelityAppDataFolder() { _appDataFolder.removeRecursively(); - _appDataFolder.rename(_savedAppDataFolder.path(), _appDataFolder.path()); + + if (_savedAppDataFolder != QDir()) { + _appDataFolder.rename(_savedAppDataFolder.path(), _appDataFolder.path()); + } } void TestRunner::selectTemporaryFolder() { @@ -176,6 +175,10 @@ void TestRunner::evaluateResults() { autoTester->startTestsEvaluation(false, true, _snapshotFolder, _branch, _user); } +void TestRunner::automaticTestRunEvaluationComplete() { + restoreHighFidelityAppDataFolder(); +} + // Copies a folder recursively void TestRunner::copyFolder(const QString& source, const QString& destination) { try { @@ -207,7 +210,3 @@ void TestRunner::copyFolder(const QString& source, const QString& destination) { exit(-1); } } - -void TestRunner::automaticTestRunEvaluationComplete() { - restoreHighFidelityAppDataFolder(); -} diff --git a/tools/auto-tester/src/ui/AutoTester.h b/tools/auto-tester/src/ui/AutoTester.h index 02acf7f7f8..1418365c07 100644 --- a/tools/auto-tester/src/ui/AutoTester.h +++ b/tools/auto-tester/src/ui/AutoTester.h @@ -105,7 +105,6 @@ private: HelpWindow _helpWindow; - void* _caller; };