scripts/*syscalls.py: sort os.walk() for a more deterministic build
Found by "disordered --shuffle-dirents=yes".
Sorting os.walk() in scripts/subfolder_list.py removes the randomness in
the following files:
build/zephyr/misc/generated/syscalls_subdirs.txt
build/zephyr/CMakeFiles/syscall_list_h_target.dir/ or build.ninja
Sorting os.walk() in scripts/parse_syscalls.py removes the randomness
in:
build/zephyr/misc/generated/syscalls.json
build/zephyr/include/generated/syscall_dispatch.c
build/zephyr/include/generated/syscall_list.h
Note my (limited so far) testing did *not* observe any randomness in any
object file that this would address; the main purpose here is to remove
a very large amount of noise in diffoscope.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
diff --git a/scripts/parse_syscalls.py b/scripts/parse_syscalls.py
index 462989d..bd712a5 100644
--- a/scripts/parse_syscalls.py
+++ b/scripts/parse_syscalls.py
@@ -23,7 +23,9 @@
ret = []
for base_path in multiple_directories:
- for root, dirs, files in os.walk(base_path):
+ for root, dirs, files in os.walk(base_path, topdown=True):
+ dirs.sort()
+ files.sort()
for fn in files:
# toolchain/common.h has the definition of __syscall which we
@@ -52,7 +54,9 @@
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("-i", "--include", required=True, action='append',
- help="Base include directory")
+ help='''include directories recursively scanned
+ for .h files. Can be specified multiple times:
+ -i topdir1 -i topdir2 ...''')
parser.add_argument(
"-j", "--json-file", required=True,
help="Write system call prototype information as json to file")