From: Ivan Grokhotkov Date: Wed, 8 Aug 2018 12:55:33 +0000 (+0300) Subject: tiny-test-fw: invoke expect callbacks in order of appearance X-Git-Tag: v3.2-beta1~299^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd61c1440bd217ada56550e0918e10322148d21e;p=esp-idf tiny-test-fw: invoke expect callbacks in order of appearance Previously the callbacks were invoked in the same order as the list of patterns to be matched. --- diff --git a/tools/tiny-test-fw/DUT.py b/tools/tiny-test-fw/DUT.py index 091a961549..97487525ed 100644 --- a/tools/tiny-test-fw/DUT.py +++ b/tools/tiny-test-fw/DUT.py @@ -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