Closed Bug 835930 Opened 11 years ago Closed 10 years ago

B2G mochitests should use mozprofile for profile creation and management


(Testing :: Mochitest, defect)

Gonk (Firefox OS)
Not set


(Not tracked)



(Reporter: ahal, Assigned: ahal)



(Whiteboard: [mozbase])


(2 files, 1 obsolete file)

      No description provided.
Depends on: 837719
Depends on: 839108
Depends on: 830430
Depends on: 839527
Attached patch WIP (obsolete) — Splinter Review
Just wanted to get this attached. It is still untested and depends on bug 837719 landing first.
Attachment #713420 - Attachment is patch: true
Depends on: 841061
Depends on: 851292
I don't think this is perfect, but I think it's a step down the right path. This is blocked on bug 851292 landing, but I figured we can get started on the review process in the meantime.

This patch also gets the ball rolling on bug 830430. These bugs were so interrelated that I decided to just start them in the same patch.
Attachment #713420 - Attachment is obsolete: true
Attachment #725500 - Flags: review?(jgriffin)
Comment on attachment 725500 [details] [diff] [review]
Patch 1.0 - b2g mochitests with mozprofile

Review of attachment 725500 [details] [diff] [review]:

::: testing/mochitest/
@@ +556,5 @@
>                              os.path.join(bundlesDir, filename))
>          return retVal
>      def buildProfile(self, options):

It looks like the two versions of buildProfile are now identical; if so, the implementation should be moved to B2GMixin to avoid duplicating code.

::: testing/profiles/
@@ +8,5 @@
> +VPATH = @srcdir@
> +
> +include $(DEPTH)/config/
> +
> +MODULE = testing_profiles

MODULE not needed afaict; see

@@ +12,5 @@
> +MODULE = testing_profiles
> +
> +include $(topsrcdir)/config/
> +

Are these really mochitest-specific, or are they generic enough to let us label these as UNITTEST_PROFILE_FILES or something?
Attachment #725500 - Flags: review?(jgriffin) → review+
This patch addresses the nits, but it ended up being big enough that I'm not comfortable checking it in without another review. In addition to the nits I added a command line option to specify a custom profile data directory to make running locally a little bit easier.
Attachment #729744 - Flags: review?(jgriffin)
Comment on attachment 729744 [details] [diff] [review]
Patch 1.1 - address nits and add option to specify profile data directory

Review of attachment 729744 [details] [diff] [review]:

::: testing/mochitest/
@@ +28,5 @@
>  from mozdevice import DeviceManagerADB, DMError
>  from mozprofile import Profile, Preferences
> +class B2GMochitestMixin(Mochitest):

We should probably rename this to something like B2GMochitestBase, since we're not using it in a typical mixin, multiple-inheritance way any longer ... we're not mixing it in, just implementing a straight inheritance chain with it.

Or we could name this B2GMochitest and rename what is now B2GMochitest to B2GDeviceMochitest, which is probably even better.

@@ +332,5 @@
>      _dm = None
>      def __init__(self, automation, devmgr, options):
>          self._automation = automation
>          Mochitest.__init__(self, self._automation)

We should call Mochitest.__init__ from within B2GMochitestMixin, since we're just doing straight inheritance again.

@@ +536,2 @@
>          #self._automation = automation
>          Mochitest.__init__(self, automation)

We should call Mochitest.__init__ from within B2GMochitestMixin, since we're just doing straight inheritance again.
Attachment #729744 - Flags: review?(jgriffin) → review+
Depends on: 855041
Whiteboard: [mozbase]
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
I'm getting this error while trying to run b2g mochitests (after updating my build):
Traceback (most recent call last):
  File "", line 30, in <module>
    from mozprofile import Profile, Preferences
ImportError: cannot import name Preferences

Anyone knows why I get this problem?
You probably have an outdated version of mozprofile in your python packages (current is 0.6). Try upgrading it or installing the latest mozbase in a new virtualenv.
Thanks, that was the problem. sudo pip install --upgrade mozprofile solved it.
Now I'm getting a black emulator window with this message in the console:
"unable to execute 'cp' on device; consider installing busybox from Android Market"
This is after updating my tree and rebuilding.
The emulator build is currently broken; bug 858853
You need to log in before you can comment on or make changes to this bug.