Dynamically set up android port forwarding
Categories
(Testing :: XPCShell Harness, enhancement, P2)
Tracking
(firefox93 fixed)
Tracking | Status | |
---|---|---|
firefox93 | --- | fixed |
People
(Reporter: valentin, Assigned: valentin)
Details
Attachments
(1 file)
NodeServer.execute allows us to define code in an xpcshell-test and run it in a separate node instance.
Running a HTTP/2 server like this is easy and userful, as it allows tests to be isolated from each-other, but it doesn't currently work on Android, as the ports are not forwarded as from the host to the emulator like we do here
Is there a way to provide a JS accessible way of setting this up? Calling it from either the xpcshell-test or the nodejs server would be acceptable.
My questions are:
- what's the best way of doing that? Spawning a terminal command and waiting for it to finish?
- Are there any downsides of doing that a large number of sockets?
Fixing this would allow us to enable the http3_ and trr_ tests on Android link
Comment 1•3 years ago
•
|
||
(In reply to Valentin Gosu [:valentin] (he/him) from comment #0)
- what's the best way of doing that? Spawning a terminal command and waiting for it to finish?
Yes, issuing commands through the adb executable is the most obvious approach, and of course that's how all the existing python test automation does it. https://developer.android.com/studio/command-line/adb
An alternative: Use a network connection to the emulator console to issue commands, https://developer.android.com/studio/run/emulator-console. I think the 'redir' command will work -- but I'm not very familiar with this.
Another way (but I think this is not advisable, too complicated): Implement the client side of the adb protocol in js and issue adb commands that way. See maybe https://android.googlesource.com/platform/system/core/+/dd7bc3319deb2b77c5d07a51b7d6cd7e11b5beb0/adb/OVERVIEW.TXT, https://github.com/cstyan/adbDocumentation
- Are there any downsides of doing that a large number of sockets?
I don't know. Are you thinking of redirecting a whole range of sockets in the harness before running any tests? I think that would work, but haven't tried anything like that. I suppose there would be a risk of starving tests of ports needed for something else.
Assignee | ||
Comment 2•3 years ago
|
||
(In reply to Geoff Brown [:gbrown] from comment #1)
(In reply to Valentin Gosu [:valentin] (he/him) from comment #0)
- what's the best way of doing that? Spawning a terminal command and waiting for it to finish?
Yes, issuing commands through the adb executable is the most obvious approach, and of course that's how all the existing python test automation does it. https://developer.android.com/studio/command-line/adb
Seems like the easiest way forward. I'll give it a shot!
- Are there any downsides of doing that a large number of sockets?
I don't know. Are you thinking of redirecting a whole range of sockets in the harness before running any tests? I think that would work, but haven't tried anything like that. I suppose there would be a risk of starving tests of ports needed for something else.
We would do this for each individual port when it's opened. Probably not so much as to starve other tests of ports (maybe in the future, if we end up doing this for hundreds of tests).
My concerns are more of the sort - if we add dozens/hundreds of rules, would the forwarding rules slow down connections? Probably hard to tell without actually doing it.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 3•3 years ago
|
||
Assignee | ||
Comment 4•3 years ago
|
||
I'm encountering some errors in automation (even though it works locally)
https://treeherder.mozilla.org/jobs?repo=try&revision=1c85c497c81c1708463c795074d7fba3aded6a54&selectedTaskRun=X_yPrwOXSyS62ddQZXURQw.0
[task 2021-06-21T22:14:55.254Z] 22:14:55 INFO - /bin/sh: 1: adb: not found
[task 2021-06-21T22:14:55.255Z] 22:14:55 INFO - error: Command failed: adb reverse tcp:39861 tcp:39861
Should I call the binary with an absolute path?
/usr/bin/adb Seems to also not work. Do you happen to know how I should find the binary?
[task 2021-06-22T08:10:38.167Z] 08:10:38 INFO - /bin/sh: 1: /usr/bin/adb: not found
[task 2021-06-22T08:10:38.168Z] 08:10:38 INFO - error: Command failed: /usr/bin/adb reverse tcp:42701 tcp:42701
[task 2021-06-22T08:10:38.168Z] 08:10:38 INFO - /bin/sh: 1: /usr/bin/adb: not found
Comment 5•3 years ago
|
||
adb should be at <android-sdk>/platform-tools/adb. Android tests run via mozharness usually find it in the $PATH because of
or similar.
<android-sdk> is usually installed as a taskcluster "fetch", so $MOZ_FETCHES_DIR/android-sdk-linux/platform-tools/adb should do it.
Assignee | ||
Comment 6•3 years ago
|
||
Thanks, that seems to have worked!(In reply to Geoff Brown [:gbrown] from comment #5)
<android-sdk> is usually installed as a taskcluster "fetch", so $MOZ_FETCHES_DIR/android-sdk-linux/platform-tools/adb should do it.
Thanks, that seems to have worked!
Comment 7•3 years ago
|
||
There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:valentin, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 8•3 years ago
|
||
This only enables some more test on android, therefore it is not very critical.
The last update that I have was ha there is a problem with the patch. According to comment 6 it might be fix.
This bug can way for Valentin to comeback from PTO.
Assignee | ||
Comment 9•3 years ago
|
||
It seems to break tests on non-android runs for some reason.
https://treeherder.mozilla.org/jobs?repo=try&revision=e932f89b8e12d5c603497c1e95d28c28d52fc5c5&selectedTaskRun=OVE8RHQRTny-t5qwSbHAPQ.0
I'm trying to figure out why.
Comment 10•3 years ago
|
||
Pushed by valentin.gosu@gmail.com: https://hg.mozilla.org/integration/autoland/rev/1d901edbea52 Dynamically set up android port forwarding for trr tests r=necko-reviewers,dragana
Comment 11•3 years ago
|
||
bugherder |
Description
•