summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam@droopy.dyn.ducie.codethink.co.uk>2018-02-28 17:25:10 +0000
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-04-23 13:37:06 +0000
commitcaa52411c8039a19954b83d3bfa015c44a594661 (patch)
treed1df378075f484749bfa772a27012fecff95360e
parent3ec1cab15db686a77240b3d30d238c66be505a81 (diff)
downloadbuildstream-caa52411c8039a19954b83d3bfa015c44a594661.tar.gz
tests/testutils/integration.py: Avoid inconsistent symlink handling
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.py5
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):]