From 73cb0bf30650a7396b15d4b4457c4f0921ddf50d Mon Sep 17 00:00:00 2001 From: Marc Herbert Date: Wed, 6 Mar 2019 11:43:37 -0800 Subject: [PATCH] extract_dts_includes.py: deterministic flash table with Python < 3.6 To reproduce the issue this addresses, run "cmake -B96b_nitrogen" twice with Python 3.5. Observe the order of the flash partition table changing in: "build{1,2}/zephyr/include/generated/generated_dts_board.conf" and "generated_dts_board_unfixed.h" Dictionaries are iterated in a random order by Python 3.5 and before. This could have caused "Unstable" CI in PR #13921 and maybe others. Anyway we want builds to be determimistic by default. Explicit randomness can be added for better coverage but not by default. Signed-off-by: Marc Herbert --- scripts/dts/extract_dts_includes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/dts/extract_dts_includes.py b/scripts/dts/extract_dts_includes.py index f7dd66f013eb28..5a8421f5432326 100755 --- a/scripts/dts/extract_dts_includes.py +++ b/scripts/dts/extract_dts_includes.py @@ -441,7 +441,9 @@ def yaml_inc_error(msg): def generate_defines(): # Generates #defines (and .conf file values) from DTS - for node_path in reduced.keys(): + # sorted() otherwise Python < 3.6 randomizes the order of the flash + # partition table + for node_path in sorted(reduced.keys()): generate_node_defines(node_path) if not defs: