Closed Bug 991025 Opened 6 years ago Closed 6 years ago

Enable WiFi test on emulator

Categories

(Firefox OS Graveyard :: Wifi, defect)

x86_64
Gonk (Firefox OS)
defect
Not set

Tracking

(tracking-b2g:backlog)

RESOLVED FIXED
1.4 S6 (25apr)
tracking-b2g backlog

People

(Reporter: hchang, Assigned: hchang)

References

Details

Attachments

(5 files, 3 obsolete files)

We do need wifi API test on emulator. This is a bug for tracking necessary modification on different repos and different versions of emulator.
Attached patch wifi.c.patch (obsolete) — Splinter Review
WIP on ICS emulator:

$ git clone https://github.com/mozilla-b2g/B2G b2g-emu-wifi
$ cd b2g-emu-wifi
$ GITREPO=git://github.com/elefant/b2g-manifest BRANCH=dev/emu-wifi ./config.sh emulator

Patch attachment 8400557 [details] [diff] [review] on hardware/libhardware_legacy/wifi/wifi.c

$ ./build.sh
$ ./mach marionette-webapi gecko/dom/wifi/test/marionette/test_wifi.js
Depends on: 991443
Depends on: 991447
Depends on: 991450
Depends on: 991452
(In reply to Henry Chang [:henry] from comment #2)
> WIP on ICS emulator:
> 
> $ git clone https://github.com/mozilla-b2g/B2G b2g-emu-wifi
> $ cd b2g-emu-wifi
> $ GITREPO=git://github.com/elefant/b2g-manifest BRANCH=dev/emu-wifi
> ./config.sh emulator
> 
> Patch attachment 8400557 [details] [diff] [review] on
> hardware/libhardware_legacy/wifi/wifi.c
> 
> $ ./build.sh
> $ ./mach marionette-webapi gecko/dom/wifi/test/marionette/test_wifi.js

Patching wifi.c is no longer needed because of 

https://github.com/elefant/device_generic_goldfish/commit/b39af9d668b0e612af85dade4b75312258b07b02

So the steps become:

$ git clone https://github.com/mozilla-b2g/B2G b2g-emu-wifi
$ cd b2g-emu-wifi
$ GITREPO=git://github.com/elefant/b2g-manifest BRANCH=dev/emu-wifi
> ./config.sh emulator
$ ./build.sh
$ ./mach marionette-webapi gecko/dom/wifi/test/marionette/test_wifi.js
The third step should be 

$ GITREPO=git://github.com/elefant/b2g-manifest BRANCH=dev/emu-wifi ./config.sh emulator
Attachment #8400557 - Attachment is obsolete: true
Attached patch gecko-mod.patch (obsolete) — Splinter Review
Gecko's patch if you are using custom gecko.
Try server result with modified test case and qemu patch.

https://tbpl.mozilla.org/?tree=Try&rev=f538b5f8cf49
Try server result with no qemu patch: https://tbpl.mozilla.org/?tree=Try&rev=3ae1de1ffc76
Duplicate of this bug: 908553
Depends on: 995100
blocking-b2g: --- → backlog
See Also: → 967009
Blocks: 997090
Assignee: nobody → hchang
Attachment #8402562 - Attachment is obsolete: true
Attachment #8407613 - Attachment description: Add hostap to emulator.xml → b2g-manifest - Add hostap to emulator.xml
Attachment #8407613 - Attachment description: b2g-manifest - Add hostap to emulator.xml → Part 1: b2g-manifest - Add hostap to emulator.xml
Attachment #8407615 - Attachment description: platform_build - Modify BoradConfig.mk to build wpa_supplicant and hostapd → Part 2: platform_build - Modify BoradConfig.mk to build wpa_supplicant and hostapd
Attachment #8407617 - Attachment description: device_generic_goldfish - Add wpa_supplicant service and related scripts → Part 3: device_generic_goldfish - Add wpa_supplicant service and related scripts
Attachment #8407618 - Attachment description: qemu - Add network interface "wlan0" → Part 4: qemu - Add network interface "wlan0"
All the PRs for wifi test on ICS emulator:

#1: https://github.com/mozilla-b2g/b2g-manifest/pull/166:
#2: https://github.com/mozilla-b2g/platform_build/pull/46
#3: https://github.com/mozilla-b2g/device_generic_goldfish/pull/13
#4: https://github.com/mozilla-b2g/platform_external_qemu/pull/71 

#1 works with #2 for ICS emulator to checkout and build "hostap", where #1 add
repo "hostap" to emulator.xml and #2 add build config to BoardConfig.mk to build 
wpa_supplicant and hostapd with test driver.

#3 adds services and creates directories we need while #4 modifies qemu to add an
additional network interface "wlan0" for wifi and DHCP use.
Attachment #8407613 - Flags: review?(vyang)
Attachment #8407615 - Flags: review?(vyang)
Attachment #8407617 - Flags: review?(vyang)
Attachment #8407618 - Flags: review?(vyang)
Depends on bug 871475 because part 4 (attachment 8407618 [details] [review]) needs that.
Depends on: 871475
Duplicate of this bug: 991443
Duplicate of this bug: 991447
Duplicate of this bug: 991450
Duplicate of this bug: 991452
Attachment #8407618 - Flags: review?(vyang) → review+
Comment on attachment 8407613 [details] [review]
Part 1: b2g-manifest - Add hostap to emulator.xml

We can reuse existing external/wpa_supplicant_8.
Attachment #8407613 - Flags: review?(vyang)
Attachment #8407613 - Attachment is obsolete: true
Comment on attachment 8407615 [details] [review]
Part 2: platform_build - Modify BoradConfig.mk to build wpa_supplicant and hostapd

nit: WPA_SUPPLICANT_VERSION := VER_0_8_X
Attachment #8407615 - Flags: review?(vyang) → review+
Attachment #8407617 - Flags: review?(vyang) → review+
How to use:

$ adb push ap1.conf /data/misc/wifi/hostapd && adb shell hostapd -B /data/misc/wifi/hostapd/ap1.conf
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #24)
> Created attachment 8409503 [details]
> crash-mochitest-chunk-4.txt

Can't replicate locally.
The log appears that all failed cases have a running wpa_supplicant....
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #25)
> mochitest-4 again with m-c tip:
> https://tbpl.mozilla.org/?tree=Try&rev=db003e978d6c

Looks like it's really the known intermittent failure bug 996487.  Going to land.
Hi Henry,
I suppose once this bug is landed, we could connect to the "goldfish" Wifi AP in the emulator, right?

My question is, do we still have to set the first DNS server to enable network connectivity to the Internet on the emulator?
e.g.
adb shell setprop net.dns1 10.0.2.3
or
adb shell ndc resolver setifdns eth0 10.0.0.0 10.0.2.3
(In reply to Ethan Tseng [:ethan] from comment #31)
> Hi Henry,
> I suppose once this bug is landed, we could connect to the "goldfish" Wifi
> AP in the emulator, right?
> 
> My question is, do we still have to set the first DNS server to enable
> network connectivity to the Internet on the emulator?
> e.g.
> adb shell setprop net.dns1 10.0.2.3
> or
> adb shell ndc resolver setifdns eth0 10.0.0.0 10.0.2.3

If we successfully connect to a wifi AP or 3G network, the B2G network management component would set DNS for you. Therefore you don't need to do it by yourself!
(In reply to Henry Chang [:henry] from comment #32)
> If we successfully connect to a wifi AP or 3G network, the B2G network
> management component would set DNS for you. Therefore you don't need to do
> it by yourself!
That's great!
This information is helpful to update our MDN article. :)
https://developer.mozilla.org/en-US/Firefox_OS/Using_the_B2G_emulators#Network_Connectivity
http://hg.mozilla.org/mozilla-central/rev/1d0496e30feb
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.4 S6 (25apr)
blocking-b2g: backlog → ---
You need to log in before you can comment on or make changes to this bug.