diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2018-09-14 09:51:49 +0100 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2018-09-14 09:53:14 +0100 |
commit | f06f234a964b15ed35554739affb43f084d32604 (patch) | |
tree | b3dd4602f754c9fa242dfc30f3bea6cca3fdb1c7 | |
parent | 233a7d8372d4df5ee85edd902c1c54d7d658b202 (diff) | |
download | buildstream-f06f234a964b15ed35554739affb43f084d32604.tar.gz |
tests: cover builds that make sockets
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 |