Bug 1168720 - Remove use of test env var MOZ_NO_REPLACE_FALLBACK and associated tests that are covered by other tests. r=spohl

This commit is contained in:
Robert Strong 2015-06-04 09:20:00 -07:00
parent 2e8ccea024
commit 344665f8f5
35 changed files with 83 additions and 918 deletions

View File

@ -74,6 +74,7 @@ const LOG_SWITCH_SUCCESS = "rename_file: proceeding to rename the directory\n" +
const ERR_RENAME_FILE = "rename_file: failed to rename file";
const ERR_UNABLE_OPEN_DEST = "unable to open destination file";
const ERR_BACKUP_DISCARD = "backup_discard: unable to remove";
const ERR_MOVE_DESTDIR_7 = "Moving destDir to tmpDir failed, err: 7";
const LOG_SVC_SUCCESSFUL_LAUNCH = "Process was started... waiting on result.";
@ -144,7 +145,6 @@ var gCallbackArgs = ["./", "callback.log", "Test Arg 2", "Test Arg 3"];
var gPostUpdateBinFile = "postup_app" + BIN_SUFFIX;
var gStageUpdate = false;
var gSwitchApp = false;
var gDisableReplaceFallback = false;
var gUseTestAppDir = true;
var gTimeoutRuns = 0;
@ -1584,21 +1584,11 @@ function runUpdate(aExpectedExitValue, aExpectedStatus, aCallback) {
}
debugDump("running the updater: " + updateBin.path + " " + args.join(" "));
let env = Cc["@mozilla.org/process/environment;1"].
getService(Ci.nsIEnvironment);
if (gDisableReplaceFallback) {
env.set("MOZ_NO_REPLACE_FALLBACK", "1");
}
let process = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
process.init(updateBin);
process.run(true, args, args.length);
if (gDisableReplaceFallback) {
env.set("MOZ_NO_REPLACE_FALLBACK", "");
}
let status = readStatusFile();
if (process.exitValue != aExpectedExitValue || status != aExpectedStatus) {
if (process.exitValue != aExpectedExitValue) {
@ -2126,7 +2116,7 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, aCheckSvcLog) {
gServiceLaunchedCallbackArgs = [
"-no-remote",
"-process-updates",
"-test-process-updates",
"-dump-args",
appArgsLogPath
];
@ -2343,7 +2333,6 @@ function setupUpdaterTest(aMarFile) {
helperBin.copyToFollowingLinks(afterApplyBinDir, gCallbackBinFile);
helperBin.copyToFollowingLinks(afterApplyBinDir, gPostUpdateBinFile);
let applyToDir = getApplyDirFile(null, true);
gTestFiles.forEach(function SUT_TF_FE(aTestFile) {
if (aTestFile.originalFile || aTestFile.originalContents) {
let testDir = getApplyDirFile(aTestFile.relPathDir, true);
@ -3386,8 +3375,8 @@ function createAppInfo(aID, aName, aVersion, aPlatformVersion) {
* Command line arguments used when launching the application:
* -no-remote prevents shell integration from being affected by an existing
* application process.
* -process-updates makes the application exits after being relaunched by the
* updater.
* -test-process-updates makes the application exit after being relaunched by
* the updater.
* the platform specific string defined by PIPE_TO_NULL to output both stdout
* and stderr to null. This is needed to prevent output from the application
* from ending up in the xpchsell log.
@ -3409,14 +3398,14 @@ function getProcessArgs(aExtraArgs) {
launchScript.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_DIRECTORY);
let scriptContents = "#! /bin/sh\n";
scriptContents += appBinPath + " -no-remote -process-updates " +
scriptContents += appBinPath + " -no-remote -test-process-updates " +
aExtraArgs.join(" ") + " " + PIPE_TO_NULL;
writeFile(launchScript, scriptContents);
debugDump("created " + launchScript.path + " containing:\n" +
scriptContents);
args = [launchScript.path];
} else {
args = ["/D", "/Q", "/C", appBinPath, "-no-remote", "-process-updates"].
args = ["/D", "/Q", "/C", appBinPath, "-no-remote", "-test-process-updates"].
concat(aExtraArgs).concat([PIPE_TO_NULL]);
}
return args;

View File

@ -1,48 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* Application in use complete MAR file staged patch apply failure fallback test */
const START_STATE = STATE_APPLIED;
const END_STATE = STATE_PENDING;
function run_test() {
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR);
// Launch the callback helper application so it is in use during the update.
let callbackApp = getApplyDirFile(DIR_RESOURCES + gCallbackBinFile);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
callbackAppProcess.init(callbackApp);
callbackAppProcess.run(false, args, args.length);
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdate(0, START_STATE, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, END_STATE, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -5,7 +5,7 @@
/* Application in use complete MAR file staged patch apply failure test */
const START_STATE = STATE_APPLIED;
const END_STATE = STATE_FAILED_WRITE_ERROR;
const END_STATE = STATE_PENDING;
function run_test() {
gStageUpdate = true;
@ -33,7 +33,6 @@ function doUpdate() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, END_STATE, checkUpdateApplied);
}
@ -42,8 +41,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -1,46 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* File in use complete MAR file staged patch apply failure fallback test */
function run_test() {
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR);
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(gTestFiles[13].relPathDir +
gTestFiles[13].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdate(0, STATE_APPLIED, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -1,46 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* File in use partial MAR file staged patch apply failure fallback test */
function run_test() {
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR);
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(gTestFiles[11].relPathDir +
gTestFiles[11].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdate(0, STATE_APPLIED, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -31,8 +31,7 @@ function doUpdate() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
@ -40,8 +39,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -31,8 +31,7 @@ function doUpdate() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
@ -40,8 +39,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -1,55 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* File locked complete MAR file staged patch apply failure fallback test */
function run_test() {
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR);
// Exclusively lock an existing file so it is in use during the update.
let helperBin = getTestDirFile(FILE_HELPER_BIN);
let helperDestDir = getApplyDirFile(DIR_RESOURCES);
helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
helperBin = getApplyDirFile(DIR_RESOURCES + FILE_HELPER_BIN);
// Strip off the first two directories so the path has to be from the helper's
// working directory.
let lockFileRelPath = gTestFiles[3].relPathDir.split("/");
if (IS_MACOSX) {
lockFileRelPath = lockFileRelPath.slice(2);
}
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdate(1, STATE_FAILED_WRITE_ERROR_FILE_COPY, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -1,55 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* File locked partial MAR file staged patch apply failure fallback test */
function run_test() {
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR);
// Exclusively lock an existing file so it is in use during the update.
let helperBin = getTestDirFile(FILE_HELPER_BIN);
let helperDestDir = getApplyDirFile(DIR_RESOURCES);
helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
helperBin = getApplyDirFile(DIR_RESOURCES + FILE_HELPER_BIN);
// Strip off the first two directories so the path has to be from the helper's
// working directory.
let lockFileRelPath = gTestFiles[2].relPathDir.split("/");
if (IS_MACOSX) {
lockFileRelPath = lockFileRelPath.slice(2);
}
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[2].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdate(1, STATE_FAILED_WRITE_ERROR_FILE_COPY, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -40,8 +40,7 @@ function doUpdate() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
@ -49,8 +48,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -40,8 +40,7 @@ function doUpdate() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
@ -49,8 +48,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -1,57 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* File in use inside removed dir complete MAR file staged patch apply failure
fallback test */
function run_test() {
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR);
let fileInUseBin = getApplyDirFile(gTestDirs[4].relPathDir +
gTestDirs[4].subDirs[0] +
gTestDirs[4].subDirFiles[0]);
// Remove the empty file created for the test so the helper application can
// replace it.
fileInUseBin.remove(false);
let helperBin = getTestDirFile(FILE_HELPER_BIN);
let fileInUseDir = getApplyDirFile(gTestDirs[4].relPathDir +
gTestDirs[4].subDirs[0]);
helperBin.copyTo(fileInUseDir, gTestDirs[4].subDirFiles[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdate(0, STATE_APPLIED, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -1,55 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* File in use inside removed dir partial MAR file staged patch apply failure
fallback test */
function run_test() {
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR);
let fileInUseBin = getApplyDirFile(gTestDirs[2].relPathDir +
gTestDirs[2].files[0]);
// Remove the empty file created for the test so the helper application can
// replace it.
fileInUseBin.remove(false);
let helperBin = getTestDirFile(FILE_HELPER_BIN);
let fileInUseDir = getApplyDirFile(gTestDirs[2].relPathDir);
helperBin.copyTo(fileInUseDir, gTestDirs[2].files[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdate(0, STATE_APPLIED, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -35,15 +35,13 @@ function run_test() {
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdate(0, STATE_APPLIED, null);
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
@ -51,8 +49,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -40,8 +40,7 @@ function doUpdate() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
@ -49,8 +48,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -39,8 +39,6 @@ skip-if = os == 'win' || toolkit == 'gonk'
reason = bug 1164150
[marAppInUseStageFailureComplete_win.js]
skip-if = os != 'win'
[marAppInUseFallbackStageFailureComplete_win.js]
skip-if = os != 'win'
[marFileLockedFailureComplete_win.js]
skip-if = os != 'win'
[marFileLockedFailurePartial_win.js]
@ -50,10 +48,6 @@ skip-if = os != 'win'
run-sequentially = Bug 1156446
[marFileLockedStageFailurePartial_win.js]
skip-if = os != 'win'
[marFileLockedFallbackStageFailureComplete_win.js]
skip-if = os != 'win'
[marFileLockedFallbackStageFailurePartial_win.js]
skip-if = os != 'win'
[marFileInUseSuccessComplete_win.js]
skip-if = os != 'win'
[marFileInUseSuccessPartial_win.js]
@ -70,14 +64,6 @@ skip-if = os != 'win'
skip-if = os != 'win'
[marRMRFDirFileInUseStageFailurePartial_win.js]
skip-if = os != 'win'
[marFileInUseFallbackStageFailureComplete_win.js]
skip-if = os != 'win'
[marFileInUseFallbackStageFailurePartial_win.js]
skip-if = os != 'win'
[marRMRFDirFileInUseFallbackStageFailureComplete_win.js]
skip-if = os != 'win'
[marRMRFDirFileInUseFallbackStageFailurePartial_win.js]
skip-if = os != 'win'
[marAppApplyDirLockedStageFailure_win.js]
skip-if = os != 'win'
[marAppApplyUpdateAppBinInUseStageSuccess_win.js]

View File

@ -1,58 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* Application in use complete MAR file staged patch apply failure fallback test */
const START_STATE = STATE_PENDING_SVC;
const END_STATE = STATE_PENDING;
function run_test() {
if (!shouldRunServiceTest()) {
return;
}
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR);
// Launch the callback helper application so it is in use during the update.
let callbackApp = getApplyDirFile(DIR_RESOURCES + gCallbackBinFile);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let callbackAppProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
callbackAppProcess.init(callbackApp);
callbackAppProcess.run(false, args, args.length);
setupAppFilesAsync();
}
function setupAppFilesFinished() {
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdateUsingService(START_STATE, STATE_APPLIED);
}
function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, END_STATE, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -5,7 +5,7 @@
/* Application in use complete MAR file staged patch apply failure test */
const START_STATE = STATE_PENDING_SVC;
const END_STATE = STATE_FAILED_WRITE_ERROR;
const END_STATE = STATE_PENDING;
function run_test() {
if (!shouldRunServiceTest()) {
@ -43,7 +43,6 @@ function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, END_STATE, checkUpdateApplied);
}
@ -52,8 +51,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -1,56 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* File in use complete MAR file staged patch apply failure fallback test */
function run_test() {
if (!shouldRunServiceTest()) {
return;
}
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR);
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(gTestFiles[13].relPathDir +
gTestFiles[13].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);
setupAppFilesAsync();
}
function setupAppFilesFinished() {
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
}
function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -1,56 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* File in use partial MAR file staged patch apply failure fallback test */
function run_test() {
if (!shouldRunServiceTest()) {
return;
}
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR);
// Launch an existing file so it is in use during the update.
let fileInUseBin = getApplyDirFile(gTestFiles[11].relPathDir +
gTestFiles[11].fileName);
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);
setupAppFilesAsync();
}
function setupAppFilesFinished() {
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
}
function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -41,8 +41,7 @@ function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
@ -50,8 +49,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -41,8 +41,7 @@ function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
@ -50,8 +49,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -1,65 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* File locked complete MAR file staged patch apply failure fallback test */
function run_test() {
if (!shouldRunServiceTest()) {
return;
}
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR);
// Exclusively lock an existing file so it is in use during the update.
let helperBin = getTestDirFile(FILE_HELPER_BIN);
let helperDestDir = getApplyDirFile(DIR_RESOURCES);
helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
helperBin = getApplyDirFile(DIR_RESOURCES + FILE_HELPER_BIN);
// Strip off the first two directories so the path has to be from the helper's
// working directory.
let lockFileRelPath = gTestFiles[3].relPathDir.split("/");
if (IS_MACOSX) {
lockFileRelPath = lockFileRelPath.slice(2);
}
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[3].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);
setupAppFilesAsync();
}
function setupAppFilesFinished() {
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR_FILE_COPY);
}
function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -1,65 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* File locked partial MAR file staged patch apply failure fallback test */
function run_test() {
if (!shouldRunServiceTest()) {
return;
}
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR);
// Exclusively lock an existing file so it is in use during the update.
let helperBin = getTestDirFile(FILE_HELPER_BIN);
let helperDestDir = getApplyDirFile(DIR_RESOURCES);
helperBin.copyTo(helperDestDir, FILE_HELPER_BIN);
helperBin = getApplyDirFile(DIR_RESOURCES + FILE_HELPER_BIN);
// Strip off the first two directories so the path has to be from the helper's
// working directory.
let lockFileRelPath = gTestFiles[2].relPathDir.split("/");
if (IS_MACOSX) {
lockFileRelPath = lockFileRelPath.slice(2);
}
lockFileRelPath = lockFileRelPath.join("/") + "/" + gTestFiles[2].fileName;
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT, lockFileRelPath];
let lockFileProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
lockFileProcess.init(helperBin);
lockFileProcess.run(false, args, args.length);
setupAppFilesAsync();
}
function setupAppFilesFinished() {
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR_FILE_COPY);
}
function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -50,8 +50,7 @@ function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
@ -59,8 +58,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -50,8 +50,7 @@ function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
@ -59,8 +58,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -1,67 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* File in use inside removed dir complete MAR file staged patch apply failure
fallback test */
function run_test() {
if (!shouldRunServiceTest()) {
return;
}
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesCompleteSuccess;
gTestDirs = gTestDirsCompleteSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_COMPLETE_MAR);
let fileInUseBin = getApplyDirFile(gTestDirs[4].relPathDir +
gTestDirs[4].subDirs[0] +
gTestDirs[4].subDirFiles[0]);
// Remove the empty file created for the test so the helper application can
// replace it.
fileInUseBin.remove(false);
let helperBin = getTestDirFile(FILE_HELPER_BIN);
let fileInUseDir = getApplyDirFile(gTestDirs[4].relPathDir +
gTestDirs[4].subDirs[0]);
helperBin.copyTo(fileInUseDir, gTestDirs[4].subDirFiles[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);
setupAppFilesAsync();
}
function setupAppFilesFinished() {
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
}
function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -1,65 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
/* File in use inside removed dir partial MAR file staged patch apply failure
fallback test */
function run_test() {
if (!shouldRunServiceTest()) {
return;
}
gStageUpdate = true;
setupTestCommon();
gTestFiles = gTestFilesPartialSuccess;
gTestDirs = gTestDirsPartialSuccess;
setTestFilesAndDirsForFailure();
setupUpdaterTest(FILE_PARTIAL_MAR);
let fileInUseBin = getApplyDirFile(gTestDirs[2].relPathDir +
gTestDirs[2].files[0]);
// Remove the empty file created for the test so the helper application can
// replace it.
fileInUseBin.remove(false);
let helperBin = getTestDirFile(FILE_HELPER_BIN);
let fileInUseDir = getApplyDirFile(gTestDirs[2].relPathDir);
helperBin.copyTo(fileInUseDir, gTestDirs[2].files[0]);
// Launch an existing file so it is in use during the update.
let args = [getApplyDirPath() + DIR_RESOURCES, "input", "output", "-s",
HELPER_SLEEP_TIMEOUT];
let fileInUseProcess = Cc["@mozilla.org/process/util;1"].
createInstance(Ci.nsIProcess);
fileInUseProcess.init(fileInUseBin);
fileInUseProcess.run(false, args, args.length);
setupAppFilesAsync();
}
function setupAppFilesFinished() {
do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
}
function doUpdate() {
runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
}
function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
setupHelperFinish();
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
standardInit();
checkCallbackAppLog();
}

View File

@ -52,8 +52,7 @@ function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
@ -61,8 +60,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -50,8 +50,7 @@ function checkUpdateFinished() {
// Switch the application to the staged application that was updated.
gStageUpdate = false;
gSwitchApp = true;
gDisableReplaceFallback = true;
runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
runUpdate(1, STATE_PENDING, checkUpdateApplied);
}
function checkUpdateApplied() {
@ -59,8 +58,9 @@ function checkUpdateApplied() {
}
function checkUpdate() {
checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
checkUpdateLogContains(ERR_RENAME_FILE);
checkUpdateLogContains(ERR_MOVE_DESTDIR_7);
standardInit();
checkCallbackAppLog();
}

View File

@ -33,7 +33,8 @@ function run_test() {
// Don't test symlinks on Mac OS X in this test since it tends to timeout.
// It is tested on Mac OS X in marAppInUseStageSuccessComplete_unix.js
if (IS_UNIX && !IS_MACOSX) {
// The tests don't support symlinks on gonk.
if (IS_UNIX && !IS_MACOSX && !IS_TOOLKIT_GONK) {
removeSymlink();
createSymlink();
do_register_cleanup(removeSymlink);
@ -97,7 +98,8 @@ function finishCheckUpdateApplied() {
checkUpdateLogContains("removing old distribution directory");
}
if (IS_UNIX && !IS_MACOSX) {
// The tests don't support symlinks on gonk.
if (IS_UNIX && !IS_MACOSX && !IS_TOOLKIT_GONK) {
checkSymlink();
}
checkAppBundleModTime();

View File

@ -35,8 +35,6 @@ run-sequentially = Uses the Mozilla Maintenance Service.
run-sequentially = Uses the Mozilla Maintenance Service.
[marAppInUseStageFailureCompleteSvc_win.js]
run-sequentially = Uses the Mozilla Maintenance Service.
[marAppInUseFallbackStageFailureCompleteSvc_win.js]
run-sequentially = Uses the Mozilla Maintenance Service.
[marFileLockedFailureCompleteSvc_win.js]
run-sequentially = Uses the Mozilla Maintenance Service.
[marFileLockedFailurePartialSvc_win.js]
@ -45,10 +43,6 @@ run-sequentially = Uses the Mozilla Maintenance Service.
run-sequentially = Uses the Mozilla Maintenance Service.
[marFileLockedStageFailurePartialSvc_win.js]
run-sequentially = Uses the Mozilla Maintenance Service.
[marFileLockedFallbackStageFailureCompleteSvc_win.js]
run-sequentially = Uses the Mozilla Maintenance Service.
[marFileLockedFallbackStageFailurePartialSvc_win.js]
run-sequentially = Uses the Mozilla Maintenance Service.
[marFileInUseSuccessCompleteSvc_win.js]
run-sequentially = Uses the Mozilla Maintenance Service.
[marFileInUseSuccessPartialSvc_win.js]
@ -65,14 +59,6 @@ run-sequentially = Uses the Mozilla Maintenance Service.
run-sequentially = Uses the Mozilla Maintenance Service.
[marRMRFDirFileInUseStageFailurePartialSvc_win.js]
run-sequentially = Uses the Mozilla Maintenance Service.
[marFileInUseFallbackStageFailureCompleteSvc_win.js]
run-sequentially = Uses the Mozilla Maintenance Service.
[marFileInUseFallbackStageFailurePartialSvc_win.js]
run-sequentially = Uses the Mozilla Maintenance Service.
[marRMRFDirFileInUseFallbackStageFailureCompleteSvc_win.js]
run-sequentially = Uses the Mozilla Maintenance Service.
[marRMRFDirFileInUseFallbackStageFailurePartialSvc_win.js]
run-sequentially = Uses the Mozilla Maintenance Service.
[marAppApplyDirLockedStageFailureSvc_win.js]
run-sequentially = Uses the Mozilla Maintenance Service.
[marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js]

View File

@ -345,6 +345,13 @@ mstrtok(const NS_tchar *delims, NS_tchar **str)
return ret;
}
static bool
EnvHasValue(const char *name)
{
const char *val = getenv(name);
return (val && *val);
}
#ifdef XP_WIN
/**
* Coverts a relative update path to a full path for Windows.
@ -2266,7 +2273,7 @@ UpdateThreadFunc(void *param)
// The MOZ_TEST_SKIP_UPDATE_STAGE environment variable prevents copying
// the files in dist/bin in the test updater when staging an update since
// this can cause tests to timeout.
if (getenv("MOZ_TEST_SKIP_UPDATE_STAGE")) {
if (EnvHasValue("MOZ_TEST_SKIP_UPDATE_STAGE")) {
rv = OK;
} else {
rv = CopyInstallDirToDestDir();
@ -2286,8 +2293,7 @@ UpdateThreadFunc(void *param)
}
}
bool reportRealResults = true;
if (sReplaceRequest && rv && !getenv("MOZ_NO_REPLACE_FALLBACK")) {
if (sReplaceRequest && rv) {
// When attempting to replace the application, we should fall back
// to non-staged updates in case of a failure. We do this by
// setting the status to pending, exiting the updater, and
@ -2295,22 +2301,16 @@ UpdateThreadFunc(void *param)
// startup path will see the pending status, and will start the
// updater application again in order to apply the update without
// staging.
// The MOZ_NO_REPLACE_FALLBACK environment variable is used to
// bypass this fallback, and is used in the updater tests.
// The only special thing which we should do here is to remove the
// staged directory as it won't be useful any more.
ensure_remove_recursive(gWorkingDirPath);
WriteStatusFile(sUsingService ? "pending-service" : "pending");
// We need to use --process-updates again in the tests
putenv(const_cast<char*>("MOZ_PROCESS_UPDATES="));
reportRealResults = false; // pretend success
}
if (reportRealResults) {
#ifdef TEST_UPDATER
// Some tests need to use --test-process-updates again.
putenv(const_cast<char*>("MOZ_TEST_PROCESS_UPDATES="));
#endif
} else {
if (rv) {
LOG(("failed: %d", rv));
}
else {
} else {
#ifdef XP_MACOSX
// If the update was successful we need to update the timestamp on the
// top-level Mac OS X bundle directory so that Mac OS X's Launch Services
@ -2332,7 +2332,7 @@ UpdateThreadFunc(void *param)
int NS_main(int argc, NS_tchar **argv)
{
#if defined(MOZ_WIDGET_GONK)
if (getenv("LD_PRELOAD")) {
if (EnvHasValue("LD_PRELOAD")) {
// If the updater is launched with LD_PRELOAD set, then we wind up
// preloading libmozglue.so. Under some circumstances, this can cause
// the remount of /system to fail when going from rw to ro, so if we
@ -2399,7 +2399,7 @@ int NS_main(int argc, NS_tchar **argv)
#ifdef XP_WIN
bool useService = false;
bool testOnlyFallbackKeyExists = false;
bool noServiceFallback = getenv("MOZ_NO_SERVICE_FALLBACK") != nullptr;
bool noServiceFallback = EnvHasValue("MOZ_NO_SERVICE_FALLBACK");
putenv(const_cast<char*>("MOZ_NO_SERVICE_FALLBACK="));
// We never want the service to be used unless we build with
@ -2465,7 +2465,7 @@ int NS_main(int argc, NS_tchar **argv)
*slash = NS_T('\0');
}
if (getenv("MOZ_OS_UPDATE")) {
if (EnvHasValue("MOZ_OS_UPDATE")) {
sIsOSUpdate = true;
putenv(const_cast<char*>("MOZ_OS_UPDATE="));
}
@ -2572,7 +2572,7 @@ int NS_main(int argc, NS_tchar **argv)
const int callbackIndex = 6;
#if defined(XP_WIN)
sUsingService = getenv("MOZ_USING_SERVICE") != nullptr;
sUsingService = EnvHasValue("MOZ_USING_SERVICE");
putenv(const_cast<char*>("MOZ_USING_SERVICE="));
// lastFallbackError keeps track of the last error for the service not being
// used, in case of an error when fallback is not enabled we write the
@ -3217,13 +3217,10 @@ int NS_main(int argc, NS_tchar **argv)
LaunchMacPostProcess(gInstallDirPath);
}
#endif /* XP_MACOSX */
if (getenv("MOZ_PROCESS_UPDATES") == nullptr) {
LaunchCallbackApp(argv[5],
argc - callbackIndex,
argv + callbackIndex,
sUsingService);
}
LaunchCallbackApp(argv[5],
argc - callbackIndex,
argv + callbackIndex,
sUsingService);
}
return gSucceeded ? 0 : 1;

View File

@ -3811,9 +3811,9 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
if (NS_FAILED(rv))
updRoot = mDirProvider.GetAppDir();
// If the MOZ_PROCESS_UPDATES environment variable already exists, then
// If the MOZ_TEST_PROCESS_UPDATES environment variable already exists, then
// we are being called from the callback application.
if (EnvHasValue("MOZ_PROCESS_UPDATES")) {
if (EnvHasValue("MOZ_TEST_PROCESS_UPDATES")) {
// If the caller has asked us to log our arguments, do so. This is used
// to make sure that the maintenance service successfully launches the
// callback application.
@ -3831,13 +3831,13 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
return 0;
}
// Support for processing an update and exiting. The MOZ_PROCESS_UPDATES
// Support for processing an update and exiting. The MOZ_TEST_PROCESS_UPDATES
// environment variable will be part of the updater's environment and the
// application that is relaunched by the updater. When the application is
// relaunched by the updater it will be removed below and the application
// will exit.
if (CheckArg("process-updates")) {
SaveToEnv("MOZ_PROCESS_UPDATES=1");
if (CheckArg("test-process-updates")) {
SaveToEnv("MOZ_TEST_PROCESS_UPDATES=1");
}
nsCOMPtr<nsIFile> exeFile, exeDir;
rv = mDirProvider.GetFile(XRE_EXECUTABLE_FILE, &persistent,
@ -3851,8 +3851,8 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
gRestartArgc,
gRestartArgv,
mAppData->version);
if (EnvHasValue("MOZ_PROCESS_UPDATES")) {
SaveToEnv("MOZ_PROCESS_UPDATES=");
if (EnvHasValue("MOZ_TEST_PROCESS_UPDATES")) {
SaveToEnv("MOZ_TEST_PROCESS_UPDATES=");
*aExitFlag = true;
return 0;
}

View File

@ -1012,7 +1012,7 @@ ProcessUpdates(nsIFile *greDir, nsIFile *appDir, nsIFile *updRootDir,
return rv;
ProcessType dummyPID; // this will only be used for MOZ_UPDATE_STAGING
const char *processingUpdates = PR_GetEnv("MOZ_PROCESS_UPDATES");
const char *processingUpdates = PR_GetEnv("MOZ_TEST_PROCESS_UPDATES");
if (processingUpdates && *processingUpdates) {
// Enable the tests to request an update to be staged.
const char *stagingUpdate = PR_GetEnv("MOZ_UPDATE_STAGING");