summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2019-01-25 11:08:29 +0000
committerJonathan Maw <jonathan.maw@codethink.co.uk>2019-02-06 10:45:34 +0000
commitf4c8a0ecf76a303d76979bb5867f3537b12a815b (patch)
tree491658487d5392b8e51837129f44ace19021e783
parentd4d2f89793ab6b361883b844e5e6b547fa714ca3 (diff)
downloadbuildstream-jonathan/wsl-tests.tar.gz
tests: Fix test failures caused by unix sockets' path length limitjonathan/wsl-tests
The unix specification for unix sockets only allocates ~100 characters for the length of the path. This may be longer than the path for a CI runner, or the path to a user's buildstream directory.
-rw-r--r--tests/testutils/filetypegenerator.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/testutils/filetypegenerator.py b/tests/testutils/filetypegenerator.py
index 2dadb7e80..622f454a1 100644
--- a/tests/testutils/filetypegenerator.py
+++ b/tests/testutils/filetypegenerator.py
@@ -56,7 +56,14 @@ def generate_file_types(path):
yield
clean()
+ # Change directory because the full path may be longer than the ~100
+ # characters permitted for a unix socket
+ old_dir = os.getcwd()
+ parent, child = os.path.split(path)
+ os.chdir(parent)
+
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
- s.bind(path)
+ s.bind(child)
+ os.chdir(old_dir)
yield
clean()