Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts/*syscalls.py: sort os.walk() for a more deterministic build #13446

Merged

Conversation

marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Feb 16, 2019

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 [email protected]

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 <[email protected]>
@codecov-io
Copy link

Codecov Report

Merging #13446 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #13446   +/-   ##
=======================================
  Coverage    52.5%    52.5%           
=======================================
  Files         318      318           
  Lines       46526    46526           
  Branches    10754    10754           
=======================================
  Hits        24429    24429           
  Misses      17198    17198           
  Partials     4899     4899

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f0a20c6...68623c2. Read the comment docs.

marc-hb referenced this pull request Feb 16, 2019
Previously the syscall list was generated only from the include
folder. This is a limitation when the application tries to create
system calls. This patch create a simple way to include these
new syscalls without the application touching the kernel.

This can be enabled by a Kconfig CONFIG_APPLICATION_DEFINED_SYSCALL.
Once enabled the application source directory will be scanned to
find all application defined syscalls.

Signed-off-by: Adithya Baglody <[email protected]>
@nashif nashif requested a review from agross-oss February 16, 2019 20:07
@nashif nashif added this to the v1.14.0 milestone Feb 16, 2019
@agross-oss
Copy link
Collaborator

Seems like a good change.

@nashif nashif merged commit d5b2834 into zephyrproject-rtos:master Feb 17, 2019
@SebastianBoe
Copy link
Collaborator

Very nice.

@marc-hb marc-hb deleted the deterministic/build/syscalls branch February 19, 2019 23:43
@marc-hb
Copy link
Collaborator Author

marc-hb commented Feb 20, 2019

BTW it's possible right now to entirely nullify the output of diffoscope --exclude-directory-metadata hello_world/build.1/ hello_world/build.2/ where build.1 and build.2 are two consecutive hello_world/build/ with just this hack:

--- a/cmake/app/boilerplate.cmake
+++ b/cmake/app/boilerplate.cmake
@@ -28,6 +28,9 @@ cmake_minimum_required(VERSION 3.13.1)
 # CMP0002: "Logical target names must be globally unique"
 cmake_policy(SET CMP0002 NEW)
 
+SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -qcD <TARGET> <LINK_FLAGS> <OBJECTS>")
+SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -D <TARGET>")
+
 if(NOT (${CMAKE_VERSION} VERSION_LESS "3.13.0"))
   # Use the old CMake behaviour until 3.13.x is required and the build
   # scripts have been ported to the new behaviour.

It's unrelated to disordered --shuffle-dirents=yes and needed either way.

@marc-hb
Copy link
Collaborator Author

marc-hb commented Feb 21, 2019

Another determinism fix if you liked this one: PR #13608 git describe --abbrev=12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants