diff options
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/project/elements/sandbox-bwrap/test-dev-shm.bst | 15 | ||||
-rw-r--r-- | tests/integration/project/files/test_shm.c | 29 | ||||
-rw-r--r-- | tests/integration/sandbox-bwrap.py | 11 |
3 files changed, 55 insertions, 0 deletions
diff --git a/tests/integration/project/elements/sandbox-bwrap/test-dev-shm.bst b/tests/integration/project/elements/sandbox-bwrap/test-dev-shm.bst new file mode 100644 index 000000000..03dc74a35 --- /dev/null +++ b/tests/integration/project/elements/sandbox-bwrap/test-dev-shm.bst @@ -0,0 +1,15 @@ +kind: manual + +depends: +- base.bst + +config: + build-commands: + - cc test_shm.c + + install-commands: + - ./a.out + +sources: +- kind: local + path: files/test_shm.c diff --git a/tests/integration/project/files/test_shm.c b/tests/integration/project/files/test_shm.c new file mode 100644 index 000000000..4ee71cb2b --- /dev/null +++ b/tests/integration/project/files/test_shm.c @@ -0,0 +1,29 @@ +#include <errno.h> +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <fcntl.h> + +int main () +{ + int fd = shm_open ("/foo", O_RDONLY | O_CREAT, S_IRWXU); + if (fd < 0) + { + fprintf (stderr, "Failed to open shm: %s\n", strerror (errno)); + exit(1); + } + + int success = shm_unlink ("/foo"); + if (success < 0) + { + fprintf (stderr, "Failed to close shm: %s\n", strerror (errno)); + exit(2); + } + + close (fd); + + return 0; +} diff --git a/tests/integration/sandbox-bwrap.py b/tests/integration/sandbox-bwrap.py index f48c75cbd..00fdd707c 100644 --- a/tests/integration/sandbox-bwrap.py +++ b/tests/integration/sandbox-bwrap.py @@ -60,3 +60,14 @@ def test_sandbox_bwrap_return_subprocess(cli, datafiles): result = cli.run(project=project, args=['build', element_name]) result.assert_task_error(error_domain=ErrorDomain.SANDBOX, error_reason="command-failed") assert "sandbox-bwrap/command-exit-42.bst|Command failed with exitcode 42" in result.stderr + +@pytest.mark.skipif(HAVE_SANDBOX != 'bwrap', reason='Only available with bubblewrap') +@pytest.mark.datafiles(DATA_DIR) +def test_sandbox_bwrap_dev_shm(cli, datafiles): + project = str(datafiles) + element_name = 'sandbox-bwrap/test-dev-shm.bst' + + result = cli.run(project=project, args=['build', element_name]) + assert result.exit_code == 0 + + |