]> granicus.if.org Git - esp-idf/commitdiff
tiny-test-fw: invoke expect callbacks in order of appearance
authorIvan Grokhotkov <ivan@espressif.com>
Wed, 8 Aug 2018 12:55:33 +0000 (15:55 +0300)
committerIvan Grokhotkov <ivan@espressif.com>
Mon, 20 Aug 2018 08:49:20 +0000 (16:49 +0800)
Previously the callbacks were invoked in the same order as the list of
patterns to be matched.

tools/tiny-test-fw/DUT.py

index 091a961549b471f0ee3e1bb546b27d4975af358d..97487525ed8da97e6afd0bd3b86f1442e95e9436 100644 (file)
@@ -576,7 +576,10 @@ class BaseDUT(object):
                 data = self.data_cache.get_data(time_remaining)
 
         if match_succeed:
-            # do callback and flush matched data cache
+            # sort matched items according to order of appearance in the input data,
+            # so that the callbacks are invoked in correct order
+            matched_expect_items = sorted(matched_expect_items, key=lambda it: it["index"])
+            # invoke callbacks and flush matched data cache
             slice_index = -1
             for expect_item in matched_expect_items:
                 # trigger callback