If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Add updater tests for applying mar files

RESOLVED FIXED in mozilla1.9.1b1



Application Update
9 years ago
9 years ago


(Reporter: rstrong, Assigned: rstrong)


Dependency tree / graph

Firefox Tracking Flags

(Not tracked)



(2 attachments, 2 obsolete attachments)

We should be able to create a mar file that adds / deletes / modifies files in a test sub-directory of the bin directory so we can test applying updates.
Depends on: 451692
Depends on: 452128
Depends on: 452174
John, just a heads up regarding some tests I'd like to add for verifying applying mar files
Created attachment 335657 [details] [diff] [review]
patch in progress

This needs the patch from bug 452128... besides that it works.
Assignee: nobody → robert.bugzilla
Comment on attachment 335657 [details] [diff] [review]
patch in progress

bah... the following should include something like

>+function runUpdate() {
>+  // Copy the updater binary to the update directory so the updater.ini is not
>+  // in the same directory as it is. This prevents ui from displaying and the
>+  // PostUpdate executable which is defined in the updater.ini from launching.
>+  gUpdateBin.copyTo(gUpdateDir, gUpdateBin.leafName);
>+  var updateBin = gUpdateDir.clone();
>+  updateBin.append(gUpdateBin.leafName);

  if (updateBin.leafName == "updater.app") {
    if (!updateBin.exists())
      do_throw("Unable to find the updater executable!");

>+  var process = AUS_Cc["@mozilla.org/process/util;1"]
>+                  .createInstance(AUS_Ci.nsIProcess);
>+  process.init(updateBin);
>+  var args = [gUpdateDirPath];
>+  process.run(true, args, args.length);
>+  return process.exitValue;
Summary: Add updater tests → Add updater tests for applying mar files
Duplicate of this bug: 385985
Created attachment 336536 [details] [diff] [review]
patch rev1

I still need to look over the code before asking for review.

Is there a better way for detecting the updater binary for each platform?
Attachment #335657 - Attachment is obsolete: true
Created attachment 336541 [details] [diff] [review]
patch rev2 - cleaned up a tad

Dave, I'm not sure of a better way to find the updater binary file... thoughts?
Attachment #336536 - Attachment is obsolete: true
Attachment #336541 - Flags: review?(dtownsend)
Comment on attachment 336541 [details] [diff] [review]
patch rev2 - cleaned up a tad

No I can't see a better way, unless we were to add it as something in the directory service but that doesn't seem sensible just for this use.

You might want to think about moving runUpdate into the head js, have it take a directory to apply to and do all the update binary detection in there so that it can be used in future tests. But this seems fine as it is for now.
Attachment #336541 - Flags: review?(dtownsend) → review+
Pushed to mozilla-central
Last Resolved: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.1b1
Duplicate of this bug: 342551
FYI one of these tests goes orange intermittently, see http://tinderbox.mozilla.org/showlog.cgi?log=Firefox/1221081416.1221088888.19943.gz

We need to figure out what's going on.

TEST-UNEXPECTED-FAIL | ../../../../_tests/xpcshell-simple/test_update/unit/test_0110_general.js | test failed, see log
*** test pending
*** test pending
*** test finished
*** running event loop
Testing: applying a complete mar - http://localhost:4444/data/aus-0110_general-1.xml
onCheckComplete url = http://localhost:4444/data/aus-0110_general-1.xml?force=1

### MRJPlugin:  getPluginBundle() here. ###
### MRJPlugin:  CFBundleGetBundleWithIdentifier() succeeded. ###
### MRJPlugin:  CFURLGetFSRef() succeeded. ###
Testing: contents of files added
Testing: applying a partial mar - http://localhost:4444/data/aus-0110_general-2.xml
onCheckComplete url = http://localhost:4444/data/aus-0110_general-2.xml?force=1

Testing: removal of a file and contents of added / modified files
*** test finished
*** exiting
*** PASS ***
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIFile.remove]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: ../../../../_tests/xpcshell-simple/test_update/unit/head_update.js :: remove_dirs_and_files :: line 201"  data: no]
Created attachment 337993 [details] [diff] [review]
followup patch for test (checked in)

Thanks Ben

This is failing on Mac OS X in the cleanup function that happens after the test completes. I'm just adding removal of the files under the updates dir and the removal of the updates dir with try catches.
Comment on attachment 337993 [details] [diff] [review]
followup patch for test (checked in)

btw: I'll check these in after the tree is in better shape
You need to log in before you can comment on or make changes to this bug.