tests: Various wpa_supplicant ctrl_iface OOM cases

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-08-08 20:48:30 +03:00
parent 6995536fa4
commit 492f007ec5

View file

@ -1512,3 +1512,162 @@ def test_wpas_ctrl_wait(dev, apdev, test_params):
time.sleep(0.1) time.sleep(0.1)
if os.path.exists(pidfile): if os.path.exists(pidfile):
raise Exception("PID file not removed") raise Exception("PID file not removed")
def test_wpas_ctrl_oom(dev):
"""Various wpa_supplicant ctrl_iface OOM cases"""
try:
_test_wpas_ctrl_oom(dev)
finally:
dev[0].request("VENDOR_ELEM_REMOVE 1 *")
dev[0].request("VENDOR_ELEM_REMOVE 2 *")
dev[0].request("SET bssid_filter ")
def _test_wpas_ctrl_oom(dev):
dev[0].request('VENDOR_ELEM_ADD 2 000100')
tests = [ ('DRIVER_EVENT AVOID_FREQUENCIES 2412', 'FAIL',
1, 'freq_range_list_parse'),
('P2P_SET disallow_freq 2412', 'FAIL',
1, 'freq_range_list_parse'),
('SCAN freq=2412', 'FAIL',
1, 'freq_range_list_parse'),
('INTERWORKING_SELECT freq=2412', 'FAIL',
1, 'freq_range_list_parse'),
('SCAN ssid 112233', 'FAIL',
1, 'wpas_ctrl_scan'),
('MGMT_TX 00:00:00:00:00:00 00:00:00:00:00:00 action=00', 'FAIL',
1, 'wpas_ctrl_iface_mgmt_tx'),
('EAPOL_RX 00:00:00:00:00:00 00', 'FAIL',
1, 'wpas_ctrl_iface_eapol_rx'),
('DATA_TEST_FRAME 00112233445566778899aabbccddee', 'FAIL',
1, 'wpas_ctrl_iface_data_test_frame'),
('DATA_TEST_FRAME 00112233445566778899aabbccddee', 'FAIL',
1, 'l2_packet_init;wpas_ctrl_iface_data_test_frame'),
('VENDOR_ELEM_ADD 1 000100', 'FAIL',
1, 'wpas_ctrl_vendor_elem_add'),
('VENDOR_ELEM_ADD 2 000100', 'FAIL',
2, 'wpas_ctrl_vendor_elem_add'),
('VENDOR_ELEM_REMOVE 2 000100', 'FAIL',
1, 'wpas_ctrl_vendor_elem_remove'),
('SET bssid_filter 00:11:22:33:44:55', 'FAIL',
1, 'set_bssid_filter'),
('SET disallow_aps bssid 00:11:22:33:44:55', 'FAIL',
1, 'set_disallow_aps'),
('SET disallow_aps ssid 11', 'FAIL',
1, 'set_disallow_aps'),
('SET blob foo 0011', 'FAIL',
1, 'wpas_ctrl_set_blob'),
('SET blob foo 0011', 'FAIL',
2, 'wpas_ctrl_set_blob'),
('SET blob foo 0011', 'FAIL',
3, 'wpas_ctrl_set_blob'),
('WPS_NFC_TAG_READ 00', 'FAIL',
1, 'wpa_supplicant_ctrl_iface_wps_nfc_tag_read'),
('WPS_NFC_TOKEN NDEF', 'FAIL',
1, 'wpa_supplicant_ctrl_iface_wps_nfc_token'),
('WPS_NFC_TOKEN NDEF', 'FAIL',
2, 'wpa_supplicant_ctrl_iface_wps_nfc_token'),
('WPS_NFC_TOKEN NDEF', 'FAIL',
3, 'wpa_supplicant_ctrl_iface_wps_nfc_token'),
('WPS_NFC_TOKEN NDEF', 'FAIL',
4, 'wpa_supplicant_ctrl_iface_wps_nfc_token'),
('WPS_NFC_TOKEN NDEF', 'FAIL',
5, 'wpa_supplicant_ctrl_iface_wps_nfc_token'),
('NFC_REPORT_HANDOVER ROLE TYPE 00 00', 'FAIL',
1, 'wpas_ctrl_nfc_report_handover'),
('NFC_REPORT_HANDOVER ROLE TYPE 00 00', 'FAIL',
2, 'wpas_ctrl_nfc_report_handover'),
('NFC_GET_HANDOVER_REQ NDEF WPS-CR', 'FAIL',
1, 'wps_build_nfc_handover_req'),
('NFC_GET_HANDOVER_REQ NDEF WPS-CR', 'FAIL',
1, 'ndef_build_record'),
('NFC_GET_HANDOVER_REQ NDEF P2P-CR', None,
1, 'wpas_p2p_nfc_handover'),
('NFC_GET_HANDOVER_REQ NDEF P2P-CR', 'FAIL',
2, 'wpas_p2p_nfc_handover'),
('NFC_GET_HANDOVER_REQ NDEF P2P-CR', None,
1, 'wps_build_nfc_handover_req_p2p'),
('NFC_GET_HANDOVER_REQ NDEF P2P-CR', 'FAIL',
1, 'ndef_build_record'),
('NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG', None,
1, 'wpas_ctrl_nfc_get_handover_sel_p2p'),
('NFC_GET_HANDOVER_SEL NDEF P2P-CR', None,
1, 'wpas_ctrl_nfc_get_handover_sel_p2p'),
('NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG', 'FAIL',
2, 'wpas_ctrl_nfc_get_handover_sel_p2p'),
('NFC_GET_HANDOVER_SEL NDEF P2P-CR', 'FAIL',
2, 'wpas_ctrl_nfc_get_handover_sel_p2p'),
('NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG', 'FAIL',
3, 'wpas_ctrl_nfc_get_handover_sel_p2p'),
('NFC_GET_HANDOVER_SEL NDEF P2P-CR', 'FAIL',
3, 'wpas_ctrl_nfc_get_handover_sel_p2p'),
('NFC_GET_HANDOVER_SEL NDEF P2P-CR-TAG', 'FAIL',
4, 'wpas_ctrl_nfc_get_handover_sel_p2p'),
('NFC_GET_HANDOVER_SEL NDEF P2P-CR', 'FAIL',
4, 'wpas_ctrl_nfc_get_handover_sel_p2p'),
('P2P_ASP_PROVISION_RESP 00:11:22:33:44:55 id=1', 'FAIL',
1, 'p2p_parse_asp_provision_cmd'),
('P2P_SERV_DISC_REQ 00:11:22:33:44:55 02000001', 'FAIL',
1, 'p2p_ctrl_serv_disc_req'),
('P2P_SERV_DISC_RESP 2412 00:11:22:33:44:55 1 00', 'FAIL',
1, 'p2p_ctrl_serv_disc_resp'),
('P2P_SERVICE_ADD bonjour 0b5f6166706f766572746370c00c000c01 074578616d706c65c027',
'FAIL',
1, 'p2p_ctrl_service_add_bonjour'),
('P2P_SERVICE_ADD bonjour 0b5f6166706f766572746370c00c000c01 074578616d706c65c027',
'FAIL',
2, 'p2p_ctrl_service_add_bonjour'),
('P2P_SERVICE_ADD bonjour 0b5f6166706f766572746370c00c000c01 074578616d706c65c027',
'FAIL',
3, 'p2p_ctrl_service_add_bonjour'),
('P2P_SERVICE_DEL bonjour 0b5f6166706f766572746370c00c000c01',
'FAIL',
1, 'p2p_ctrl_service_del_bonjour'),
('GAS_REQUEST 00:11:22:33:44:55 00', 'FAIL',
1, 'gas_request'),
('GAS_REQUEST 00:11:22:33:44:55 00 11', 'FAIL',
2, 'gas_request'),
('HS20_GET_NAI_HOME_REALM_LIST 00:11:22:33:44:55 realm=example.com',
'FAIL',
1, 'hs20_nai_home_realm_list'),
('HS20_GET_NAI_HOME_REALM_LIST 00:11:22:33:44:55 00',
'FAIL',
1, 'hs20_get_nai_home_realm_list'),
('WNM_SLEEP enter tfs_req=11', 'FAIL',
1, 'wpas_ctrl_iface_wnm_sleep'),
('WNM_SLEEP enter tfs_req=11', 'FAIL',
2, 'wpas_ctrl_iface_wnm_sleep'),
('WNM_SLEEP enter tfs_req=11', 'FAIL',
3, 'wpas_ctrl_iface_wnm_sleep'),
('WNM_SLEEP enter tfs_req=11', 'FAIL',
4, 'wpas_ctrl_iface_wnm_sleep'),
('WNM_SLEEP enter tfs_req=11', 'FAIL',
5, 'wpas_ctrl_iface_wnm_sleep'),
('WNM_SLEEP enter', 'FAIL',
3, 'wpas_ctrl_iface_wnm_sleep'),
('VENDOR 1 1 00', 'FAIL',
1, 'wpa_supplicant_vendor_cmd'),
('VENDOR 1 1 00', 'FAIL',
2, 'wpa_supplicant_vendor_cmd'),
('RADIO_WORK add test', 'FAIL',
1, 'wpas_ctrl_radio_work_add'),
('RADIO_WORK add test', 'FAIL',
2, 'wpas_ctrl_radio_work_add'),
('AUTOSCAN periodic:1', 'FAIL',
1, 'wpa_supplicant_ctrl_iface_autoscan'),
('PING', None,
1, 'wpa_supplicant_ctrl_iface_process') ]
for cmd,exp,count,func in tests:
with alloc_fail(dev[0], count, func):
res = dev[0].request(cmd)
if exp and exp not in res:
raise Exception("Unexpected success for '%s' during OOM" % cmd)
tests = [ ('FOO', None,
1, 'wpa_supplicant_global_ctrl_iface_process'),
('IFNAME=notfound PING', 'FAIL\n',
1, 'wpas_global_ctrl_iface_ifname') ]
for cmd,exp,count,func in tests:
with alloc_fail(dev[0], count, func):
res = dev[0].global_request(cmd)
if exp and exp not in res:
raise Exception("Unexpected success for '%s' during OOM" % cmd)