fmap.py: sort the flags tuple The output of this function is arbitrary because it's based on the ordering of the dict keys of FMAP_FLAGS. This leads to the unittest sometimes passing & sometimes failing. Since this is meant for us humans, sort the tuple so it's stable and unittests are reliable. BUG=chromium:982465 TEST=`./fmap.py bin/example.bin` works Change-Id: Ida9e6768aa6662a400655c52bc2ba793197ab591 Reviewed-on: https://chromium-review.googlesource.com/1693887 Tested-by: Mike Frysinger <vapier@chromium.org> Commit-Ready: Mike Frysinger <vapier@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@google.com>
diff --git a/fmap.py b/fmap.py index 936b1ce..a5ec8ef 100755 --- a/fmap.py +++ b/fmap.py
@@ -131,7 +131,9 @@ def _fmap_decode_area_flags(area_flags): """(internal) Decodes a FMAP flags property""" - return tuple([name for name in FMAP_FLAGS if area_flags & FMAP_FLAGS[name]]) + # Since FMAP_FLAGS is a dict with arbitrary ordering, sort the list so the + # output is stable. Also sorting is nicer for humans. + return tuple(sorted(x for x in FMAP_FLAGS if area_flags & FMAP_FLAGS[x])) def _fmap_check_name(fmap, name):