tests: Fix OOM eloop_register_sock() test cases with new gcc
authorJouni Malinen <j@w1.fi>
Sat, 28 Nov 2015 17:07:35 +0000 (19:07 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 28 Nov 2015 18:48:16 +0000 (20:48 +0200)
gcc 4.8 vs 5.2 seem to compile eloop_register_sock() differently. With
5.2, that function name does not show up in the backtrace since
eloop_sock_table_add_sock() is used without a separate function call.
This broke the memory allocation failure checking in this test case. Fix
this by matching against the eloop_sock_table_add_sock() function which
shows up in the backtrace for both gcc versions.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_open.py
tests/hwsim/test_ap_wps.py

index fde813b..d86bddc 100644 (file)
@@ -217,7 +217,7 @@ def test_ap_open_out_of_memory(dev, apdev):
         hapd_out_of_mem(hapd, apdev[1], i, "=wpa_driver_nl80211_drv_init")
 
     # eloop_register_read_sock() call from i802_init()
-    hapd_out_of_mem(hapd, apdev[1], 1, "eloop_sock_table_add_sock;eloop_register_sock;?eloop_register_read_sock;=i802_init")
+    hapd_out_of_mem(hapd, apdev[1], 1, "eloop_sock_table_add_sock;?eloop_register_sock;?eloop_register_read_sock;=i802_init")
 
     # verify that a new interface can still be added when memory allocation does
     # not fail
index 4b64786..f68a140 100644 (file)
@@ -3736,7 +3736,7 @@ def _test_ap_wps_er_init_oom(dev, apdev):
     with alloc_fail(dev[0], 2, "http_server_init"):
         if "FAIL" not in dev[0].request("WPS_ER_START ifname=lo"):
             raise Exception("WPS_ER_START succeeded during OOM")
-    with alloc_fail(dev[0], 1, "eloop_register_sock;wps_er_ssdp_init"):
+    with alloc_fail(dev[0], 1, "eloop_sock_table_add_sock;?eloop_register_sock;wps_er_ssdp_init"):
         if "FAIL" not in dev[0].request("WPS_ER_START ifname=lo"):
             raise Exception("WPS_ER_START succeeded during OOM")
     with fail_test(dev[0], 1, "os_get_random;wps_er_init"):
@@ -4382,7 +4382,7 @@ RGV2aWNlIEEQSQAGADcqAAEg
     logger.info("OOM in HTTP server")
     for func in [ "http_request_init", "httpread_create",
                   "eloop_register_timeout;httpread_create",
-                  "eloop_register_sock;httpread_create",
+                  "eloop_sock_table_add_sock;?eloop_register_sock;httpread_create",
                   "httpread_hdr_analyze" ]:
         with alloc_fail(dev[0], 1, func):
             sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM,
@@ -4552,7 +4552,7 @@ def _test_ap_wps_er_http_proto_subscribe_oom(dev, apdev):
     tests = [ (1, "http_client_url_parse"),
               (1, "wpabuf_alloc;wps_er_subscribe"),
               (1, "http_client_addr"),
-              (1, "eloop_register_sock;http_client_addr"),
+              (1, "eloop_sock_table_add_sock;?eloop_register_sock;http_client_addr"),
               (1, "eloop_register_timeout;http_client_addr") ]
     for count,func in tests:
         with alloc_fail(dev[0], count, func):