Closed Bug 451085 Opened 16 years ago Closed 16 years ago

Add updater tests for applying mar files

Categories

(Toolkit :: Application Update, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.1b1

People

(Reporter: robert.strong.bugs, Assigned: robert.strong.bugs)

References

Details

Attachments

(2 files, 2 obsolete files)

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
Attached patch patch in progress (obsolete) — Splinter Review
This needs the patch from bug 452128... besides that it works.
Assignee: nobody → robert.bugzilla
Status: NEW → ASSIGNED
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") {
    updateBin.append("Contents");
    updateBin.append("MacOS");
    updateBin.append("updater");
    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
Attached patch patch rev1 (obsolete) — Splinter Review
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
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
http://hg.mozilla.org/mozilla-central/rev/395243a86396fd7061ab5776539595d5b314f92f
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.1b1
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
../../../../_tests/xpcshell-simple/test_update/unit/test_0110_general.js.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]
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.

Attachment

General

Created:
Updated:
Size: