From 5cff0ae2e3b8a2ee84cd2f80269340a2dc29686e Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 26 Apr 2014 21:29:19 +0300 Subject: [PATCH] tests: Large number of creds and LIST_CREDS truncation Signed-off-by: Jouni Malinen --- tests/hwsim/test_wpas_ctrl.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/hwsim/test_wpas_ctrl.py b/tests/hwsim/test_wpas_ctrl.py index 085bc7188..09b0f8ec5 100644 --- a/tests/hwsim/test_wpas_ctrl.py +++ b/tests/hwsim/test_wpas_ctrl.py @@ -340,6 +340,23 @@ def test_wpas_ctrl_cred(dev): if len(dev[0].request("LIST_CREDS").splitlines()) != 1: raise Exception("Unexpected LIST_CREDS result(4)") + # Test large number of creds and LIST_CREDS truncation + dev[0].dump_monitor() + for i in range(0, 100): + id = add_cred(dev[0]) + set_cred_quoted(dev[0], id, "realm", "relatively.long.realm.test%d.example.com" % i) + dev[0].dump_monitor() + creds = dev[0].request("LIST_CREDS") + for i in range(0, 100): + dev[0].remove_cred(i) + dev[0].dump_monitor() + if len(creds) < 3900 or len(creds) > 4100: + raise Exception("Unexpected LIST_CREDS length: %d" % len(creds)) + if "test10.example.com" not in creds: + raise Exception("Missing credential") + if len(creds.splitlines()) > 95: + raise Exception("Too many LIST_CREDS entries in the buffer") + def test_wpas_ctrl_pno(dev): """wpa_supplicant ctrl_iface pno""" if "FAIL" not in dev[0].request("SET pno 1"):