Skip to content

Instantly share code, notes, and snippets.

@juancarlospaco
Last active April 6, 2018 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juancarlospaco/4e54d036d355cb2aa9edaf6803eb2b73 to your computer and use it in GitHub Desktop.
Save juancarlospaco/4e54d036d355cb2aa9edaf6803eb2b73 to your computer and use it in GitHub Desktop.
Python Unittests with Reproducible Builds tools
Disclaimer

Python dont need a raw Binary unless you are distributing *.PYC without *.PY.

These tools were created for Building Binaries in a reproducible Build , here use use them to make reproducible Test.

Whatsoever creating more randomized environment for isolated unittests is always good and helps spot Bugs.

The rest of the tools for Reproducible Builds are more oriented to compiled language builds.

Disorderfs

Disorderfs is an overlay FUSE filesystem that introduces non-determinism into filesystem metadata. For example, it can randomize the order in which files and directories are read. This is useful for detecting non-determinism in the build/testing process. This checks that your software is filesystem-ordering agnostic.

Run on foreground, to see Debug, CTRL+C to stop and unmount:

disorderfs -d --shuffle-dirents=yes -o auto_unmount SOURCE_DIR DESTINATION_MOUNT_DIR

Run on background, for Travis CI, cant CTRL+C, cant stop or unmount:

disorderfs --shuffle-dirents=yes SOURCE_DIR DESTINATION_MOUNT_DIR

Stop and unmount on background, for Travis CI:

sudo umount --verbose /tmp/temp

Blocker

At the time of wrting this, Travis CI dont support Disorderfs, because its Ubuntu is too old. Can be run locally without problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment