Skip to content
Snippets Groups Projects
Commit caa52411 authored by Sam Thursfield's avatar Sam Thursfield Committed by Tristan Van Berkom
Browse files

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.
parent 3ec1cab1
No related branches found
No related tags found
1 merge request!295Avoid compose element dropping files that are staged inside directory symlinks
Pipeline #
......@@ -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):]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment