[Piglit] [PATCH 3/5] framework/profile: Make test run order deterministic
dylan at pnwbakers.com
Mon May 2 21:21:12 UTC 2016
Test run order has been non-deterministic because of the data structure
used, a dict. This patch simple replaces the dict with an OrderedDict,
which is just like a dict, except that it remembers insertion order.
This means that when using -1/--no-concurrency option that tests will be
run in a deterministic order.
What this does not change, however, is the sorting of the tests in the
on disk JSON file, those remain unsorted.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
framework/profile.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/framework/profile.py b/framework/profile.py
index 4940b11..9a117a2 100644
@@ -63,13 +63,14 @@ class TestDict(collections.MutableMapping):
# This is because it had special __setitem__ and __getitem__ protocol
# methods, and simply passing *args and **kwargs into self.__container
- # will bypass these methods
+ # will bypass these methods. It will also break the ordering, since a
+ # regular dictionary or keyword arguments are inherintly unordered
# This counter is incremented once when the allow_reassignment context
# manager is opened, and decremented each time it is closed. This
# allows stacking of the context manager
self.__allow_reassignment = 0
- self.__container = dict()
+ self.__container = collections.OrderedDict()
def __setitem__(self, key, value):
"""Enforce types on set operations.
More information about the Piglit