From 658ed3ba62752b2c188e94f2e451d4ee5c363ac4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 28 May 2019 00:02:14 +0300 Subject: [PATCH] tests: Fix status fetching loop in macsec_psk_ns with UML time-travel=inf-cpu needs bit more wait before being able to fetch the STATUS* items after initial connection request. Signed-off-by: Jouni Malinen --- tests/hwsim/test_macsec.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/hwsim/test_macsec.py b/tests/hwsim/test_macsec.py index 6c284fcf6..3540bcbc8 100644 --- a/tests/hwsim/test_macsec.py +++ b/tests/hwsim/test_macsec.py @@ -606,14 +606,22 @@ def run_macsec_psk_ns(dev, apdev, params): logger.info("wpas1 STATUS:\n" + wpas1.request("STATUS")) logger.info("wpas0 STATUS-DRIVER:\n" + wpas0.request("STATUS-DRIVER")) logger.info("wpas1 STATUS-DRIVER:\n" + wpas1.request("STATUS-DRIVER")) - macsec_ifname0 = wpas0.get_driver_status_field("parent_ifname") - macsec_ifname1 = wpas1.get_driver_status_field("parent_ifname") for i in range(10): - key_tx0 = int(wpas0.get_status_field("Number of Keys Distributed")) - key_rx0 = int(wpas0.get_status_field("Number of Keys Received")) - key_tx1 = int(wpas1.get_status_field("Number of Keys Distributed")) - key_rx1 = int(wpas1.get_status_field("Number of Keys Received")) + macsec_ifname0 = wpas0.get_driver_status_field("parent_ifname") + macsec_ifname1 = wpas1.get_driver_status_field("parent_ifname") + if "Number of Keys" in wpas0.request("STATUS"): + key_tx0 = int(wpas0.get_status_field("Number of Keys Distributed")) + key_rx0 = int(wpas0.get_status_field("Number of Keys Received")) + else: + key_tx0 = 0 + key_rx0 = 0 + if "Number of Keys" in wpas1.request("STATUS"): + key_tx1 = int(wpas1.get_status_field("Number of Keys Distributed")) + key_rx1 = int(wpas1.get_status_field("Number of Keys Received")) + else: + key_tx1 = 0 + key_rx1 = 0 if key_rx0 > 0 and key_tx1 > 0: break time.sleep(1)