Closed
Bug 796017
Opened 12 years ago
Closed 11 years ago
mozinstall needs tests
Categories
(Testing :: Mozbase, defect)
Testing
Mozbase
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: k0scist, Assigned: ffledgling)
References
Details
Attachments
(5 files, 3 obsolete files)
mozinstall currently has no tests: https://github.com/mozilla/mozbase/tree/master/mozinstall Instead, it should have tests.
Assignee | ||
Comment 1•11 years ago
|
||
This is the .dmg I'm currently using. It was made on MacOSX (10.7). The contents are 4 files, namely - 'foo', 'bar', 'f00' and 'b4r'
Reporter | ||
Comment 2•11 years ago
|
||
For posterity; ht tp://pastebin.mozilla.org/2569897 -> File "/Users/Jain/anhad/lulz2/bin/mozinstall", line 8, in <module> load_entry_point('mozInstall==1.6', 'console_scripts', 'mozinstall')() File "/Users/Jain/anhad/lulz2/mozbase/mozinstall/mozinstall/mozinstall.py", line 300, in install_cli install_path = install(src, options.dest) File "/Users/Jain/anhad/lulz2/mozbase/mozinstall/mozinstall/mozinstall.py", line 118, in install install_dir = _install_dmg(src, dest) File "/Users/Jain/anhad/lulz2/mozbase/mozinstall/mozinstall/mozinstall.py", line 235, in _install_dmg mounted_path = os.path.join(appDir, appName) mozinstall.mozinstall.InstallError: Failed to install "/Users/Jain/anhad/firefox-installer-stub-compressed.dmg"
Reporter | ||
Comment 3•11 years ago
|
||
http://stackoverflow.com/questions/96882/how-do-i-create-a-nice-looking-dmg-for-mac-os-x-using-command-line-tools?rq=1 may be helpful for creating .dmgs
Reporter | ||
Comment 4•11 years ago
|
||
I was able to mount the firefox .dmg using dmg2img: │dmg2img Firefox\ 22.0.dmg dmg2img v1.6.2 is derived from dmg2iso by vu1tur (to@vu1tur.eu.org) Firefox 22.0.dmg --> Firefox 22.0.img reading property list, 27293 bytes from address 42270950 ... decompressing: opening partition 0 ... 100.00% ok opening partition 1 ... 100.00% ok opening partition 2 ... 100.00% ok Archive successfully decompressed as Firefox 22.0.img You should be able to mount the image [as root] by: modprobe hfsplus mount -t hfsplus -o loop Firefox 22.0.img /mnt │sudo su [sudo] password for jhammel: root@jhammel-ThinkPad-X230:/home/jhammel/tmp# modprobe hfsplus root@jhammel-ThinkPad-X230:/home/jhammel/tmp# mount -t hfsplus -o loop 'Firefox 22.0.img' /mnt root@jhammel-ThinkPad-X230:/home/jhammel/tmp# mount /dev/sda5 on / type ext4 (rw,errors=remount-ro) proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) none on /sys/fs/cgroup type tmpfs (rw) none on /sys/fs/fuse/connections type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) udev on /dev type devtmpfs (rw,mode=0755) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755) none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880) none on /run/shm type tmpfs (rw,nosuid,nodev) none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755) binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev) gvfsd-fuse on /run/user/jhammel/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=jhammel) /home/jhammel/tmp/Firefox 22.0.img on /mnt type hfsplus (rw) root@jhammel-ThinkPad-X230:/home/jhammel/tmp# ls /mnt/ .DS_Store .VolumeIcon.icns .background/ Firefox.app/ root@jhammel-ThinkPad-X230:/home/jhammel/tmp# ls /mnt/Firefox.app/ Contents precomplete
Reporter | ||
Comment 5•11 years ago
|
||
( fyi http://packages.ubuntu.com/raring/dmg2img )
Assignee | ||
Updated•11 years ago
|
Assignee | ||
Comment 6•11 years ago
|
||
This is the text-only patch for the added tests for mozinstall. They depend on the existance of 4 stub installers in a directory `mozinstall/tests/Installer-Stubs`. This patch is also dependent on two other small bugs Bug 888741 and Bug 888756, and assumes that the patches for those have been applied. I have tested the working of this patch on WindowsXP, Linux and MacOSX and all tests are passing for me locally.
Attachment #769519 -
Flags: review?(wlachance)
Attachment #769519 -
Flags: feedback?(jhammel)
Assignee | ||
Comment 7•11 years ago
|
||
These are the stubs in 4 formats, .dmg, .exe, .tar.bz2 and .zip. These are used by the tests for mozinstall. These 4 stub files should be placed under mozinstall/tests/Installer-Stubs/ . :jhammel could be please take a look at these and tell me if this is what you had in mind for the stub installers? Thanks!
Attachment #769520 -
Flags: feedback?(jhammel)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → ffledgling
Reporter | ||
Comment 8•11 years ago
|
||
Comment on attachment 769520 [details]
Tarball of the stubs used by mozinstall patch
Looks fine at a glance. As long as it works!
Attachment #769520 -
Flags: feedback?(jhammel) → feedback+
Reporter | ||
Comment 9•11 years ago
|
||
Comment on attachment 769519 [details] [diff] [review] Patch for mozinstall tests Review of attachment 769519 [details] [diff] [review]: ----------------------------------------------------------------- ::: mozinstall/tests/test.py @@ +1,1 @@ > +import mozinfo shebang please @@ +3,5 @@ > +import mozfile > +import os > +import tarfile > +import tempfile > +import urllib2 unused @@ +11,5 @@ > + > +class TestMozInstall(unittest.TestCase): > + > + @classmethod > + def setUpClass(self): cls, not self
Attachment #769519 -
Flags: feedback?(jhammel) → feedback+
Assignee | ||
Comment 10•11 years ago
|
||
Fixed corrections pointed out by :jhammel
Attachment #769519 -
Attachment is obsolete: true
Attachment #769519 -
Flags: review?(wlachance)
Attachment #769823 -
Flags: feedback?(jhammel)
Assignee | ||
Updated•11 years ago
|
Attachment #769823 -
Flags: feedback?(jhammel) → review?(jhammel)
Reporter | ||
Comment 11•11 years ago
|
||
Comment on attachment 769823 [details] [diff] [review] Updated patch with corrections for mozinstall tests Review of attachment 769823 [details] [diff] [review]: ----------------------------------------------------------------- Pretty good, but please fix the listed nits. ::: mozinstall/tests/test.py @@ +18,5 @@ > + > + @classmethod > + def setUpClass(cls): > + """ Setting up stub installers """ > + cls.dmg = os.path.join('Installer-Stubs', 'firefox.dmg') These should be relative to the file, AIUI; can you make these absolute paths? @@ +59,5 @@ > + > + def test_get_binary_error(self): > + """ Test an InvalidBinary error is raised """ > + > + tempdir_empty = tempfile.mkdtemp() You'll need to clean up this directory. @@ +141,5 @@ > + > + elif mozinfo.isMac: > + installdir = mozinstall.install(self.dmg, self.tempdir) > + mozinstall.uninstall(installdir) > + self.assertFalse(os.path.exists(installdir)) You'll need a section for running manually: if __name__ == '__main__': unittest.main()
Attachment #769823 -
Flags: review?(jhammel) → review-
Assignee | ||
Comment 12•11 years ago
|
||
Attachment #769823 -
Attachment is obsolete: true
Attachment #769916 -
Flags: review?(jhammel)
Reporter | ||
Comment 13•11 years ago
|
||
(In reply to Anhad Jai Singh (:ffledgling) from comment #12) > Created attachment 769916 [details] [diff] [review] > Patch for mozinstall tests should be checked in with the stubs: (mozbase)│curl https://bug796017.bugzilla.mozilla.org/attachment.cgi?id=769520 | tar xvf -
Reporter | ||
Updated•11 years ago
|
Attachment #769916 -
Flags: review?(jhammel) → review+
Reporter | ||
Comment 14•11 years ago
|
||
hmmm....it runs fine from the directory, but from test.py ====================================================================== ERROR: test_get_binary (test.TestMozInstall) Test mozinstall's get_binary method ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jhammel/mozbase/src/mozbase/mozinstall/tests/test.py", line 38, in test_get_binary installdir = mozinstall.install(self.bz2, self.tempdir) File "/home/jhammel/mozbase/src/mozbase/mozinstall/mozinstall/mozinstall.py", line 107, in install '(zip, exe, tar.gz, tar.bz2 or dmg)') InvalidSource: /home/jhammel/mozbase/src/mozbase/moztest/tests/Installer-Stubs/firefox.tar.bz2 is not a recognized file type (zip, exe, tar.gz, tar.bz2 or dmg) ====================================================================== ERROR: test_install (test.TestMozInstall) Test mozinstall's install capability ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jhammel/mozbase/src/mozbase/mozinstall/tests/test.py", line 103, in test_install installdir = mozinstall.install(self.bz2, self.tempdir) File "/home/jhammel/mozbase/src/mozbase/mozinstall/mozinstall/mozinstall.py", line 107, in install '(zip, exe, tar.gz, tar.bz2 or dmg)') InvalidSource: /home/jhammel/mozbase/src/mozbase/moztest/tests/Installer-Stubs/firefox.tar.bz2 is not a recognized file type (zip, exe, tar.gz, tar.bz2 or dmg) ====================================================================== ERROR: test_uninstall (test.TestMozInstall) Test mozinstall's uninstall capabilites ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jhammel/mozbase/src/mozbase/mozinstall/tests/test.py", line 127, in test_uninstall installdir = mozinstall.install(self.bz2, self.tempdir) File "/home/jhammel/mozbase/src/mozbase/mozinstall/mozinstall/mozinstall.py", line 107, in install '(zip, exe, tar.gz, tar.bz2 or dmg)') InvalidSource: /home/jhammel/mozbase/src/mozbase/moztest/tests/Installer-Stubs/firefox.tar.bz2 is not a recognized file type (zip, exe, tar.gz, tar.bz2 or dmg) ====================================================================== ERROR: test_get_binary (test.TestMozInstall) Test mozinstall's get_binary method ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jhammel/mozbase/src/mozbase/mozinstall/tests/test.py", line 38, in test_get_binary installdir = mozinstall.install(self.bz2, self.tempdir) File "/home/jhammel/mozbase/src/mozbase/mozinstall/mozinstall/mozinstall.py", line 107, in install '(zip, exe, tar.gz, tar.bz2 or dmg)') InvalidSource: /home/jhammel/mozbase/src/mozbase/moztest/tests/Installer-Stubs/firefox.tar.bz2 is not a recognized file type (zip, exe, tar.gz, tar.bz2 or dmg) ====================================================================== ERROR: test_install (test.TestMozInstall) Test mozinstall's install capability ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jhammel/mozbase/src/mozbase/mozinstall/tests/test.py", line 103, in test_install installdir = mozinstall.install(self.bz2, self.tempdir) File "/home/jhammel/mozbase/src/mozbase/mozinstall/mozinstall/mozinstall.py", line 107, in install '(zip, exe, tar.gz, tar.bz2 or dmg)') InvalidSource: /home/jhammel/mozbase/src/mozbase/moztest/tests/Installer-Stubs/firefox.tar.bz2 is not a recognized file type (zip, exe, tar.gz, tar.bz2 or dmg) ====================================================================== ERROR: test_uninstall (test.TestMozInstall) Test mozinstall's uninstall capabilites ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jhammel/mozbase/src/mozbase/mozinstall/tests/test.py", line 127, in test_uninstall installdir = mozinstall.install(self.bz2, self.tempdir) File "/home/jhammel/mozbase/src/mozbase/mozinstall/mozinstall/mozinstall.py", line 107, in install '(zip, exe, tar.gz, tar.bz2 or dmg)') InvalidSource: /home/jhammel/mozbase/src/mozbase/moztest/tests/Installer-Stubs/firefox.tar.bz2 is not a recognized file type (zip, exe, tar.gz, tar.bz2 or dmg) ====================================================================== FAIL: test_is_installer (test.TestMozInstall) Test we can identify a correct installer ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jhammel/mozbase/src/mozbase/mozinstall/tests/test.py", line 73, in test_is_installer self.assertTrue(mozinstall.is_installer(self.bz2)) AssertionError: False is not true ====================================================================== FAIL: test_is_installer (test.TestMozInstall) Test we can identify a correct installer ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/jhammel/mozbase/src/mozbase/mozinstall/tests/test.py", line 73, in test_is_installer self.assertTrue(mozinstall.is_installer(self.bz2)) AssertionError: False is not true ---------------------------------------------------------------------- Ran 151 tests in 16.198s FAILED (failures=2, errors=6) Can you confirm this ?
Reporter | ||
Comment 15•11 years ago
|
||
very suspicious: InvalidSource: /home/jhammel/mozbase/src/mozbase/moztest/tests/Installer-Stubs/firefox.tar.bz2 is not a recognized file type (zip, exe, tar.gz, tar.bz2 or dmg)
Assignee | ||
Comment 16•11 years ago
|
||
Confirming that I'm getting the same error when I run all tests together. However, even more strange, when I run a custom manifest with only [include:mozinstall/tests/manifest.ini] in it, all tests pass again. Looking into what the problem could be.
Assignee | ||
Comment 17•11 years ago
|
||
:ahal pointed out that the issue was with setting the path for the stubs during class instantiation rather than at the time of module load. Changing it accordingly fixed the error.
Attachment #769916 -
Attachment is obsolete: true
Attachment #770191 -
Flags: review?(jhammel)
Reporter | ||
Updated•11 years ago
|
Attachment #770191 -
Flags: review?(jhammel) → review+
Reporter | ||
Comment 18•11 years ago
|
||
pushed: https://github.com/mozilla/mozbase/commit/3b5a4ab279bd80c6101627c110472b59cd29424a
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 19•11 years ago
|
||
Hey Jeff, The .exe from the stubs doesn't seem to have made it to the master in mozinstall, any idea about this?
Flags: needinfo?(jhammel)
Reporter | ||
Comment 20•11 years ago
|
||
(In reply to Anhad Jai Singh (:ffledgling) from comment #19) > Hey Jeff, The .exe from the stubs doesn't seem to have made it to the master > in mozinstall, any idea about this? So this didn't get added because I did not notice in the adding the stubs that it was .gitignored : https://github.com/mozilla/mozbase/blob/master/.gitignore#L10
Flags: needinfo?(jhammel)
Reporter | ||
Comment 21•11 years ago
|
||
If approved, I'll commit along with the firefox.exe that got gitignored
Attachment #772730 -
Flags: review?(wlachance)
Comment 22•11 years ago
|
||
Comment on attachment 772730 [details] [diff] [review] git ignore moar better This patch is fine.
Attachment #772730 -
Flags: review?(wlachance) → review+
Comment 23•11 years ago
|
||
When I tested this on Friday on my Windows XP VM, the tests were failing, and not just because of missing exes (all the different mozinstall tests were failing). We need to figure out what's wrong here...
Reporter | ||
Comment 24•11 years ago
|
||
(In reply to William Lachance (:wlach) from comment #23) > When I tested this on Friday on my Windows XP VM, the tests were failing, > and not just because of missing exes (all the different mozinstall tests > were failing). We need to figure out what's wrong here... a traceback would be lovely; should we disable the tests for the time being?
Reporter | ||
Comment 25•11 years ago
|
||
(In reply to William Lachance (:wlach) from comment #22) > Comment on attachment 772730 [details] [diff] [review] > git ignore moar better > > This patch is fine. pushed: https://github.com/mozilla/mozbase/commit/9fc4e9bd544092167edeefeac2cd0c963649700a
Comment 26•11 years ago
|
||
Comment 27•11 years ago
|
||
(In reply to Jeff Hammel [:jhammel] from comment #24) > (In reply to William Lachance (:wlach) from comment #23) > > When I tested this on Friday on my Windows XP VM, the tests were failing, > > and not just because of missing exes (all the different mozinstall tests > > were failing). We need to figure out what's wrong here... > > a traceback would be lovely; should we disable the tests for the time being? Attached a traceback. I'd prefer to fix the tests assuming the problem isn't that difficult to resolve. Any ideas :ffledgling?
Flags: needinfo?(ffledgling)
Comment 28•11 years ago
|
||
We should reopen the bug given that the work hasn't been finished yet.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 29•11 years ago
|
||
I'm not very sure why the tests are failing for :wlach the way they are, I'm wasn't getting any errors on my local VM after the .exe fix, so as :wlach has suggested earlier pushed to try with the new tests. I did a run on WinXP, OSX10.7 and 64-bitFedora. All the tests seemed to have passed on try. So I'm still not really sure what might be causing the problem. https://tbpl.mozilla.org/?tree=Try&rev=d6a06ca47811 http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/ffledgling@gmail.com-d6a06ca47811/
Comment 30•11 years ago
|
||
On closer inspection, it appears the issue was that I was using an old version of mozilla-build with Python 2.6. After upgrading to the newest with Python 2.7, everything works fine. The underlying issue is that mozinstall's test case uses a method called setupClass, which is only called in 2.7 or greater. That's not a problem though, since we're (AFAIK) only running these tests in a 2.7 environment: http://docs.python.org/2/library/unittest.html#unittest.TestCase.setUpClass (In reply to Anhad Jai Singh (:ffledgling) from comment #29) > I'm not very sure why the tests are failing for :wlach the way they are, I'm > wasn't getting any errors on my local VM after the .exe fix, so as :wlach > has suggested earlier pushed to try with the new tests. I did a run on > WinXP, OSX10.7 and 64-bitFedora. All the tests seemed to have passed on try. > > So I'm still not really sure what might be causing the problem. > > https://tbpl.mozilla.org/?tree=Try&rev=d6a06ca47811 > > http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/ffledgling@gmail. > com-d6a06ca47811/
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
Assignee | ||
Updated•11 years ago
|
Flags: needinfo?(ffledgling)
You need to log in
before you can comment on or make changes to this bug.
Description
•