diff options
-rw-r--r-- | tests/remoteexecution/project/elements/autotools/amhello.bst | 10 | ||||
-rw-r--r-- | tests/remoteexecution/project/elements/base.bst | 5 | ||||
-rw-r--r-- | tests/remoteexecution/project/elements/base/base-alpine.bst | 17 | ||||
-rw-r--r-- | tests/remoteexecution/project/files/amhello.tar.gz | bin | 0 -> 30555 bytes | |||
-rw-r--r-- | tests/remoteexecution/project/project.conf | 23 | ||||
-rw-r--r-- | tests/remoteexecution/simple.py | 56 |
6 files changed, 111 insertions, 0 deletions
diff --git a/tests/remoteexecution/project/elements/autotools/amhello.bst b/tests/remoteexecution/project/elements/autotools/amhello.bst new file mode 100644 index 000000000..ee3a029d8 --- /dev/null +++ b/tests/remoteexecution/project/elements/autotools/amhello.bst @@ -0,0 +1,10 @@ +kind: autotools +description: Autotools test + +depends: +- base.bst + +sources: +- kind: tar + url: project_dir:/files/amhello.tar.gz + ref: 9ba123fa4e660929e9a0aa99f0c487b7eee59c5e7594f3284d015640b90f5590 diff --git a/tests/remoteexecution/project/elements/base.bst b/tests/remoteexecution/project/elements/base.bst new file mode 100644 index 000000000..428afa736 --- /dev/null +++ b/tests/remoteexecution/project/elements/base.bst @@ -0,0 +1,5 @@ +# elements/base.bst + +kind: stack +depends: + - base/base-alpine.bst diff --git a/tests/remoteexecution/project/elements/base/base-alpine.bst b/tests/remoteexecution/project/elements/base/base-alpine.bst new file mode 100644 index 000000000..c5833095d --- /dev/null +++ b/tests/remoteexecution/project/elements/base/base-alpine.bst @@ -0,0 +1,17 @@ +kind: import + +description: | + Alpine Linux base for tests + + Generated using the `tests/integration-tests/base/generate-base.sh` script. + +sources: + - kind: tar + base-dir: '' + (?): + - arch == "x86-64": + ref: 3eb559250ba82b64a68d86d0636a6b127aa5f6d25d3601a79f79214dc9703639 + url: "alpine:integration-tests-base.v1.x86_64.tar.xz" + - arch == "aarch64": + ref: 431fb5362032ede6f172e70a3258354a8fd71fcbdeb1edebc0e20968c792329a + url: "alpine:integration-tests-base.v1.aarch64.tar.xz" diff --git a/tests/remoteexecution/project/files/amhello.tar.gz b/tests/remoteexecution/project/files/amhello.tar.gz Binary files differnew file mode 100644 index 000000000..afe189908 --- /dev/null +++ b/tests/remoteexecution/project/files/amhello.tar.gz diff --git a/tests/remoteexecution/project/project.conf b/tests/remoteexecution/project/project.conf new file mode 100644 index 000000000..ddfe47b6d --- /dev/null +++ b/tests/remoteexecution/project/project.conf @@ -0,0 +1,23 @@ +# Project config for frontend build test +name: test +element-path: elements +aliases: + alpine: https://bst-integration-test-images.ams3.cdn.digitaloceanspaces.com/ + project_dir: file://{project_dir} +options: + linux: + type: bool + description: Whether to expect a linux platform + default: True + arch: + type: arch + description: Current architecture + values: + - x86-64 + - aarch64 +split-rules: + test: + - | + /tests + - | + /tests/* diff --git a/tests/remoteexecution/simple.py b/tests/remoteexecution/simple.py new file mode 100644 index 000000000..152a40e31 --- /dev/null +++ b/tests/remoteexecution/simple.py @@ -0,0 +1,56 @@ +import os +import pytest + +from buildstream.plugintestutils import cli_remote_execution as cli +from buildstream.plugintestutils.integration import assert_contains + + +pytestmark = pytest.mark.remoteexecution + + +DATA_DIR = os.path.join( + os.path.dirname(os.path.realpath(__file__)), + "project" +) + + +# Test building an executable with remote-execution: +@pytest.mark.datafiles(DATA_DIR) +def test_remote_autotools_build(cli, datafiles): + project = str(datafiles) + checkout = os.path.join(cli.directory, 'checkout') + element_name = 'autotools/amhello.bst' + + services = cli.ensure_services() + assert set(services) == set(['action-cache', 'execution', 'storage']) + + result = cli.run(project=project, args=['build', element_name]) + result.assert_success() + + result = cli.run(project=project, args=['artifact', 'checkout', element_name, '--directory', checkout]) + result.assert_success() + + assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin', + '/usr/share', + '/usr/bin/hello', '/usr/share/doc', + '/usr/share/doc/amhello', + '/usr/share/doc/amhello/README']) + + +# Test running an executable built with remote-execution: +@pytest.mark.datafiles(DATA_DIR) +def test_remote_autotools_run(cli, datafiles): + project = str(datafiles) + element_name = 'autotools/amhello.bst' + + services = cli.ensure_services() + assert set(services) == set(['action-cache', 'execution', 'storage']) + + services = cli.ensure_services() + + result = cli.run(project=project, args=['build', element_name]) + result.assert_success() + + result = cli.run(project=project, args=['shell', element_name, '/usr/bin/hello']) + result.assert_success() + assert result.output == 'Hello World!\nThis is amhello 1.0.\n' |