summaryrefslogtreecommitdiff
path: root/tests/remoteexecution/simple.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/remoteexecution/simple.py')
-rw-r--r--tests/remoteexecution/simple.py56
1 files changed, 56 insertions, 0 deletions
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'