Skip to content

Commit

Permalink
Bug 1081450 - Copy maintenance service binary into its install direct…
Browse files Browse the repository at this point in the history
…ory on Windows 8 when the installed binary is different. r=bbondy
  • Loading branch information
Robert Strong committed Mar 19, 2015
1 parent 5e4ea3a commit f333ec2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 33 deletions.
38 changes: 7 additions & 31 deletions toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
Original file line number Diff line number Diff line change
Expand Up @@ -1572,15 +1572,9 @@ function stageUpdate() {
*
* @param aFirstTest
* Whether this is the first test within the test.
* @param aSkipTest
* Whether to skip this test if the installed maintenance service
* isn't the same as the build's maintenance service. This is a
* temporary workaround until all build systems grant write access to
* the maintenance service install directory so the tests can copy the
* version of the maintenance service that should be tests.
* @return true if the test should run and false if it shouldn't.
*/
function shouldRunServiceTest(aFirstTest, aSkipTest) {
function shouldRunServiceTest(aFirstTest) {
let binDir = getGREBinDir();
let updaterBin = binDir.clone();
updaterBin.append(FILE_UPDATER_BIN);
Expand Down Expand Up @@ -1646,7 +1640,7 @@ function shouldRunServiceTest(aFirstTest, aSkipTest) {
// In case the machine is running an old maintenance service or if it
// is not installed, and permissions exist to install it. Then install
// the newer bin that we have since all of the other checks passed.
return attemptServiceInstall(aSkipTest);
return attemptServiceInstall();
}

/**
Expand Down Expand Up @@ -1854,15 +1848,8 @@ function copyFileToTestAppDir(aFileRelPath, aInGreDir) {
* This is useful for XP where we have permission to upgrade in case an
* older service installer exists. Also if the user manually installed into
* a unprivileged location.
*
* @param aSkipTest
* Whether to skip this test if the installed maintenance service
* isn't the same as the build's maintenance service. This is a
* temporary workaround until all build systems grant write access to
* the maintenance service install directory so the tests can copy the
* version of the maintenance service that should be tests.
*/
function attemptServiceInstall(aSkipTest) {
*/
function attemptServiceInstall() {
const CSIDL_PROGRAM_FILES = 0x26;
const CSIDL_PROGRAM_FILESX86 = 0x2A;
// This will return an empty string on our Win XP build systems.
Expand Down Expand Up @@ -1905,7 +1892,6 @@ function attemptServiceInstall(aSkipTest) {
oldMaintSvcBin.moveTo(maintSvcDir, FILE_MAINTENANCE_SERVICE_BIN + ".backup");
buildMaintSvcBin.copyTo(maintSvcDir, FILE_MAINTENANCE_SERVICE_BIN);
backupMaintSvcBin.remove(false);
return true;
} catch (e) {
// Restore the original file in case the moveTo was successful.
if (backupMaintSvcBin.exists()) {
Expand All @@ -1918,21 +1904,11 @@ function attemptServiceInstall(aSkipTest) {
logTestInfo("unable to copy new maintenance service into the " +
"maintenance service directory: " + maintSvcDir.path + ", " +
"Exception: " + e);
do_throw("The account running the tests on the build systems should have " +
"write access to the maintenance service directory!");
}

let version = Cc["@mozilla.org/system-info;1"].
getService(Ci.nsIPropertyBag2).
getProperty("version");
// The account running the tests on Win XP and Win 7 build systems have write
// access to the maintenance service directory so throw if copying the
// maintenance service binary fails. This should always throw after write
// access is provided on all Windows build slaves in bug 1067756.
if ((parseFloat(version) <= 6.1)) {
do_throw("The account running the tests on Win 7 and below build systems " +
"should have write access to the maintenance service directory!");
}

return aSkipTest ? false : true;
return true;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* General Complete MAR File Staged Patch Apply Test */

function run_test() {
if (!shouldRunServiceTest(false, true)) {
if (!shouldRunServiceTest()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function run_test() {
// Set to true due to bug 1083653
DEBUG_AUS_TEST = true;

if (!shouldRunServiceTest(false, true)) {
if (!shouldRunServiceTest()) {
return;
}

Expand Down

0 comments on commit f333ec2

Please sign in to comment.