From 0dcf694c8776ac03779e465bdc4859fba9be314d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 5 Jan 2014 16:47:12 +0100 Subject: More updater fixage Preserve --dir parameter after updating Allow more than one copy of a command line parameter in MultiMC Linux runner script no longer changes current directory, which allows '--dir .' Fixed unit tests, removed the obsolete one (for some legacy updater command line params that were also removed) [fixes 63127704] --- mmc_updater/src/tests/CMakeLists.txt | 1 - mmc_updater/src/tests/TestUpdaterOptions.cpp | 68 ---------------------------- mmc_updater/src/tests/TestUpdaterOptions.h | 8 ---- 3 files changed, 77 deletions(-) delete mode 100644 mmc_updater/src/tests/TestUpdaterOptions.cpp delete mode 100644 mmc_updater/src/tests/TestUpdaterOptions.h (limited to 'mmc_updater/src/tests') diff --git a/mmc_updater/src/tests/CMakeLists.txt b/mmc_updater/src/tests/CMakeLists.txt index 79402245..08501a98 100644 --- a/mmc_updater/src/tests/CMakeLists.txt +++ b/mmc_updater/src/tests/CMakeLists.txt @@ -44,5 +44,4 @@ macro(ADD_UPDATER_TEST CLASS) endmacro() add_updater_test(TestParseScript) -add_updater_test(TestUpdaterOptions) add_updater_test(TestFileUtils) diff --git a/mmc_updater/src/tests/TestUpdaterOptions.cpp b/mmc_updater/src/tests/TestUpdaterOptions.cpp deleted file mode 100644 index a4cb7d33..00000000 --- a/mmc_updater/src/tests/TestUpdaterOptions.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "TestUpdaterOptions.h" - -#include "FileUtils.h" -#include "Platform.h" -#include "TestUtils.h" -#include "UpdaterOptions.h" - -#include -#include - -void TestUpdaterOptions::testOldFormatArgs() -{ - const int argc = 6; - char* argv[argc]; - argv[0] = strdup("updater"); - - std::string currentDir("CurrentDir="); - const char* appDir = 0; - - // CurrentDir is the path to the directory containing the main - // Mendeley Desktop binary, on Linux and Mac this differs from - // the root of the install directory -#ifdef PLATFORM_LINUX - appDir = "/tmp/path-to-app/lib/mendeleydesktop/libexec/"; - FileUtils::mkpath(appDir); -#elif defined(PLATFORM_MAC) - appDir = "/tmp/path-to-app/Contents/MacOS/"; - FileUtils::mkpath(appDir); -#elif defined(PLATFORM_WINDOWS) - appDir = "C:/path/to/app/"; -#endif - currentDir += appDir; - - argv[1] = strdup(currentDir.c_str()); - argv[2] = strdup("TempDir=/tmp/updater"); - argv[3] = strdup("UpdateScriptFileName=/tmp/updater/file_list.xml"); - argv[4] = strdup("AppFileName=/path/to/app/theapp"); - argv[5] = strdup("PID=123456"); - - UpdaterOptions options; - options.parse(argc,argv); - - TEST_COMPARE(options.mode,UpdateInstaller::Setup); -#ifdef PLATFORM_LINUX - TEST_COMPARE(options.installDir,"/tmp/path-to-app"); -#elif defined(PLATFORM_MAC) - // /tmp is a symlink to /private/tmp on Mac - TEST_COMPARE(options.installDir,"/private/tmp/path-to-app"); -#else - TEST_COMPARE(options.installDir,"C:/path/to/app/"); -#endif - TEST_COMPARE(options.packageDir,"/tmp/updater"); - TEST_COMPARE(options.scriptPath,"/tmp/updater/file_list.xml"); - TEST_COMPARE(options.waitPid,123456); - - for (int i=0; i < argc; i++) - { - free(argv[i]); - } -} - -int main(int,char**) -{ - TestList tests; - tests.addTest(&TestUpdaterOptions::testOldFormatArgs); - return TestUtils::runTest(tests); -} - diff --git a/mmc_updater/src/tests/TestUpdaterOptions.h b/mmc_updater/src/tests/TestUpdaterOptions.h deleted file mode 100644 index 5ed102c1..00000000 --- a/mmc_updater/src/tests/TestUpdaterOptions.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -class TestUpdaterOptions -{ - public: - void testOldFormatArgs(); -}; - -- cgit v1.2.3