From 2a6690e50d4212614e7463d31db2aa55db232898 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Tue, 3 Nov 2020 11:06:41 -0800 Subject: [PATCH] auto-t: fix agent path timing issue The agent path was generated based on the current time which sometimes yielded duplicate paths if agents were created quickly after one another. Instead a simple iterator removes any chance of a duplicate path. --- autotests/util/iwd.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py index 7b08c23e..3ffd9f23 100755 --- a/autotests/util/iwd.py +++ b/autotests/util/iwd.py @@ -705,17 +705,22 @@ class OrderedNetwork(object): str(self.signal_strength)) + '\n'\ '\tObject: \n' + self.network_object.__str__('\t\t') +agent_count = 0 class PSKAgent(dbus.service.Object): def __init__(self, passphrases=[], users=[]): + global agent_count + if type(passphrases) != list: passphrases = [passphrases] self.passphrases = passphrases if type(users) != list: users = [users] self.users = users - self._path = '/test/agent/' + str(int(round(time.time() * 1000))) + self._path = '/test/agent/%s' % agent_count + + agent_count += 1 dbus.service.Object.__init__(self, dbus.SystemBus(), self._path)