diff options
author | Sam Thursfield <sam@droopy.dyn.ducie.codethink.co.uk> | 2018-02-28 17:25:10 +0000 |
---|---|---|
committer | Jim MacArthur <jim.macarthur@codethink.co.uk> | 2018-03-29 10:47:07 +0100 |
commit | bfff43be489bbd595f48f43c4340bd32e168965a (patch) | |
tree | 1a933e3aaf51b11d08c45fd54448f86d4e7e02eb | |
parent | 468b69d4b080bec95dec23d69acd446d6595e483 (diff) | |
download | buildstream-bfff43be489bbd595f48f43c4340bd32e168965a.tar.gz |
tests/testutils/integration.py: Avoid inconsistent symlink handlingsam/compose-symlinks-issue
The output of walk_dir() seemed to be inconsistent in how it traversed
symlinks. Presumably this is to do with differences in how the filesystem
return files. If we do an in-place sort of the list of files and directories
that we get, os.walk() will honour that order which should make the output
stable.
-rw-r--r-- | tests/testutils/integration.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/testutils/integration.py b/tests/testutils/integration.py index a6fa92871..b2cf9fba4 100644 --- a/tests/testutils/integration.py +++ b/tests/testutils/integration.py @@ -6,6 +6,11 @@ from buildstream import _yaml # Return a list of files relative to the given directory def walk_dir(root): for dirname, dirnames, filenames in os.walk(root): + # ensure consistent traversal order, needed for consistent + # handling of symlinks. + dirnames.sort() + filenames.sort() + # print path to all subdirectories first. for subdirname in dirnames: yield os.path.join(dirname, subdirname)[len(root):] |