Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 1033402 - Wait for adb port to be available before starting #1

Conversation

eliperelman
Copy link

No description provided.


Hubert Figuiere <hub@mozilla.com>
Sahaja James Lal <jlal@mozilla.com>
Eli Perelman <eli@mozilla.com>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 :)

@hfiguiere
Copy link
Contributor

Commit message needs a bug number.

Also you totally ignore the changes in https://github.com/hfiguiere/marionette-device-host/compare/bug1027232 (yes this is taken straight from the bug comments)

And unecessary rewrapping obscure the actual change. Please split these commits. I'll take over Monday anyway, pushing the other changes, etc.

@hfiguiere
Copy link
Contributor

I didn't realise there was a separate bug open from bug 1027232. Even more important to not needlessly reindent as this will make it harder to rebase 1027232.

spawn = require('child_process').spawn,
debug = require('debug')('marionette-device-host');
var tcpPort = require('tcp-port-used');
var _ = require('lodash');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seriously we need even more bloat?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hfiguiere Hey calm down! Eli is very nicely trying to help you out here!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More seriously I don't find any justification of this for the actual bug.

Also '_' as a symbol?

Not that I'm back from PTO I'll return to actually fixing the issue.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The justification was simplification and reuse of the code that was generating the options object. We technically need to have it done twice, and with a handy utility method from lodash, it was much more simplified.

In every codebase that uses underscore or lodash, the conventional symbol is the _, just like jQuery is synonymous with $.

@eliperelman
Copy link
Author

@hfiguiere:

  • Sorry, I forgot the bug number in the commit, now resolved.
  • I didn't see the previous commit you had posted in the older comments, sorry about that.
  • The wrapping had to occur in order to provide a flag for only restarting B2G on the first run, otherwise there would have been duplicated code.

@eliperelman eliperelman changed the title Wait for adb port to be available before starting Bug 1033402 - Wait for adb port to be available before starting Jul 7, 2014
@eliperelman
Copy link
Author

I didn't realise there was a separate bug open from bug 1027232. Even more important to not needlessly reindent as this will make it harder to rebase 1027232.

There shouldn't be any conflicts since 1027232 is only the gaia change needed to support this change, and this patch doesn't touch any gaia. Once this lands, then the gaia patch from 1027232 can land.

@hfiguiere
Copy link
Contributor

I was talking about this change https://github.com/hfiguiere/marionette-device-host/compare/bug1027232

It is NOT in gaia either.

@hfiguiere
Copy link
Contributor

We don't need a first run flag. It just work. The only thing missing from my change above is effectively waiting on the connection to be up which is bug 1033402 but should actually be integral part of bug 1027232 because otherwise it doesn't work (short of using the timeout, which I do not like)

@eliperelman
Copy link
Author

I've tried running it without the flag, and while B2G does restart, it restarts in between EACH test. Not just between apps, but between every test. That's because for some reason, marionette-device-host is instantiated between every test, causing B2G to restart every time. We need the flag for this.

With the patch I have proposed here, we don't need the setTimeout because it's built into the sleep 2, which correlates to what b2gperf is doing. I couldn't get setTimeout to work reliably locally, but the sleep 2 seems to work every time for me.

@hfiguiere
Copy link
Contributor

The setTimeout is stupid. It was a quick and dirty hack I wanted to fix in the next iteration with the goal of get things rolled in before I went on PTO.

Restarting before each test (but not each run) isn't a bad idea IMHO.

@eliperelman
Copy link
Author

@hfiguiere yeah, the way it's currently set up is that it restarts before every test, every run. Luckily node modules are cached so we can fence that problem with a flag in this module.

@hfiguiere
Copy link
Contributor

Definitely not every run.

@eliperelman
Copy link
Author

Agreed, it was making my tests insanely long. 😄

@zacc
Copy link

zacc commented Jul 7, 2014

The functional tests restart every test on every run. It's the only way to get a clean profile and clean slate to run the tests. Admittedly the perf tests are different (and longer) but this pull could benefit the functional tests if you gave it the flexibility to do both.

@hfiguiere
Copy link
Contributor

Testing on Hamachi/Buri, I need to change sleep 2 to sleep 5 - the same delay I had in my shell script hack. This mean that the "wait for adb port to be available" doesn't work.

@lambdabaa
Copy link

@hfiguiere In some fashion this needs to happen repeatably and not based on timing / randomness. If knowing that the marionette port is up is not enough to begin interacting with b2g, then let's think of additional data points.

@hfiguiere
Copy link
Contributor

That's the gist of my comment. I don't like the timer thing and I was just demonstrating how bad it was by just testing on a device Eli didn't test on (he doesn't have one).

@hfiguiere
Copy link
Contributor

Note: I was trying to figure a proper solution yesterday.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants