summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2018-09-14 09:51:49 +0100
committerRichard Maw <richard.maw@codethink.co.uk>2018-09-14 09:53:14 +0100
commitf06f234a964b15ed35554739affb43f084d32604 (patch)
treeb3dd4602f754c9fa242dfc30f3bea6cca3fdb1c7
parent233a7d8372d4df5ee85edd902c1c54d7d658b202 (diff)
downloadbuildstream-f06f234a964b15ed35554739affb43f084d32604.tar.gz
tests: cover builds that make sockets
-rw-r--r--tests/integration/project/elements/sockets/make-builddir-socket.bst14
-rw-r--r--tests/integration/project/elements/sockets/make-install-root-socket.bst16
-rw-r--r--tests/integration/sockets.py33
3 files changed, 63 insertions, 0 deletions
diff --git a/tests/integration/project/elements/sockets/make-builddir-socket.bst b/tests/integration/project/elements/sockets/make-builddir-socket.bst
new file mode 100644
index 000000000..c19cd85b0
--- /dev/null
+++ b/tests/integration/project/elements/sockets/make-builddir-socket.bst
@@ -0,0 +1,14 @@
+kind: manual
+
+depends:
+- filename: base.bst
+ type: build
+
+config:
+ build-commands:
+ - |
+ python3 -c '
+ from socket import socket, AF_UNIX, SOCK_STREAM
+ s = socket(AF_UNIX, SOCK_STREAM)
+ s.bind("testsocket")
+ '
diff --git a/tests/integration/project/elements/sockets/make-install-root-socket.bst b/tests/integration/project/elements/sockets/make-install-root-socket.bst
new file mode 100644
index 000000000..85171bf54
--- /dev/null
+++ b/tests/integration/project/elements/sockets/make-install-root-socket.bst
@@ -0,0 +1,16 @@
+kind: manual
+
+depends:
+- filename: base.bst
+ type: build
+
+config:
+ install-commands:
+ - |
+ python3 -c '
+ from os.path import join
+ from sys import argv
+ from socket import socket, AF_UNIX, SOCK_STREAM
+ s = socket(AF_UNIX, SOCK_STREAM)
+ s.bind(join(argv[1], "testsocket"))
+ ' %{install-root}
diff --git a/tests/integration/sockets.py b/tests/integration/sockets.py
new file mode 100644
index 000000000..a2685062d
--- /dev/null
+++ b/tests/integration/sockets.py
@@ -0,0 +1,33 @@
+import os
+import pytest
+
+from buildstream import _yaml
+
+from tests.testutils import cli_integration as cli
+from tests.testutils.integration import assert_contains
+
+
+pytestmark = pytest.mark.integration
+
+DATA_DIR = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)),
+ "project"
+)
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_builddir_socket_ignored(cli, tmpdir, datafiles):
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ element_name = 'sockets/make-builddir-socket.bst'
+
+ result = cli.run(project=project, args=['build', element_name])
+ assert result.exit_code == 0
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_install_root_socket_ignored(cli, tmpdir, datafiles):
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ element_name = 'sockets/make-install-root-socket.bst'
+
+ result = cli.run(project=project, args=['build', element_name])
+ assert result.exit_code == 0