autotest: wifi: eliminate race condition in DHCP test
network_DhcpNegotiationTimeout restarts shill, and then uses pgrep
to find shill's PID. This can fail, if pgrep executes between the
time that shill fork()s a child for logging, and that child exec()s
the logger binary.
Fortunately, there's a better way to get the pid for shill: ask
upstart. Since upstart launches shill, and monitors shill's lifetime,
it should always knows shill's PID.
BUG=chromium:256363
TEST=manual (see below)
Manual test
-----------
- $ test_that <dut_ip> network_DhcpNegotiationTimeout
verify that test succeeds
- change get_daemon_pid("shill") to get_daemon_pid("shillz")
- $ test_that <dut_ip> network_DhcpNegotiationTimeout
verify that test fails
- change get_daemon_pid("shillz") to get_daemon_pid("cromo")
- $ test_that <dut_ip> network_DhcpNegotiationTimeout
verify that test fails
- change get_daemon_pid("cromo") to get_daemon_pid("shill")
- insert utils.run("restart shill") between assignments of
start_pid and end_pid
- $ test_that <dut_ip> network_DhcpNegotiationTimeout
verify that test fails
- (this assumes the DUT doesn't have a 3g modem.)
Change-Id: I5d02b2f11fddf27c8444336c7aec8b5198b3bc4e
Reviewed-on: https://chromium-review.googlesource.com/180124
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: mukesh agrawal <quiche@chromium.org>
Tested-by: mukesh agrawal <quiche@chromium.org>
1 file changed