tests: Fix dbus_probe_req_reporting_oom if already registered
If dbus_probe_req_reporting was run before dbus_probe_req_reporting_oom, the SubscribeProbeReq() method succeeded since the memory allocation that was supposed to fail in the OOM test case was not even tried. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
90b10d4edd
commit
fb9adae466
1 changed files with 15 additions and 0 deletions
|
@ -2146,10 +2146,25 @@ def test_dbus_probe_req_reporting_oom(dev, apdev):
|
|||
(bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0])
|
||||
iface = dbus.Interface(if_obj, WPAS_DBUS_IFACE)
|
||||
|
||||
# Need to make sure this process has not already subscribed to avoid false
|
||||
# failures due to the operation succeeding due to os_strdup() not even
|
||||
# getting called.
|
||||
try:
|
||||
iface.UnsubscribeProbeReq()
|
||||
was_subscribed = True
|
||||
except dbus.exceptions.DBusException, e:
|
||||
was_subscribed = False
|
||||
pass
|
||||
|
||||
with alloc_fail_dbus(dev[0], 1, "wpas_dbus_handler_subscribe_preq",
|
||||
"SubscribeProbeReq"):
|
||||
iface.SubscribeProbeReq()
|
||||
|
||||
if was_subscribed:
|
||||
# On purpose, leave ProbeReq subscription in place to test automatic
|
||||
# cleanup.
|
||||
iface.SubscribeProbeReq()
|
||||
|
||||
def test_dbus_p2p_invalid(dev, apdev):
|
||||
"""D-Bus invalid P2P operations"""
|
||||
(bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0])
|
||||
|
|
Loading…
Reference in a new issue