summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Dawson <phil.dawson@codethink.co.uk>2018-06-14 11:30:48 +0100
committerPhil Dawson <phil.dawson@codethink.co.uk>2018-06-14 11:57:53 +0100
commit772e5a3ed85a43f6ccc8c54f3fab373fd4a89020 (patch)
tree2748591e357ebe6735bab8a428f27b5174923342
parent1195df75e58d19cb77081a0ff57ca0668160b7d2 (diff)
downloadbuildstream-772e5a3ed85a43f6ccc8c54f3fab373fd4a89020.tar.gz
tests/examples: Add integration tests for alpine-autotools example
These: - Tests the project builds successfully - Tests that amhello.bst will run as expected in its sandbox This is work towards issue #103
-rw-r--r--tests/examples/alpine-autotools.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/examples/alpine-autotools.py b/tests/examples/alpine-autotools.py
new file mode 100644
index 000000000..694574870
--- /dev/null
+++ b/tests/examples/alpine-autotools.py
@@ -0,0 +1,47 @@
+import os
+import pytest
+
+from tests.testutils import cli_integration as cli
+from tests.testutils.integration import assert_contains
+from tests.testutils.site import IS_LINUX
+
+pytestmark = pytest.mark.integration
+
+DATA_DIR = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)), '..', '..', 'doc', 'examples', 'alpine-autotools'
+)
+
+
+# Tests a build of the autotools amhello project on a alpine-linux base runtime
+@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux')
+@pytest.mark.datafiles(DATA_DIR)
+def test_amhello_build(cli, tmpdir, datafiles):
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ checkout = os.path.join(cli.directory, 'checkout')
+
+ # Check that the project can be built correctly.
+ result = cli.run(project=project, args=['build', 'amhello.bst'])
+ result.assert_success()
+
+ result = cli.run(project=project, args=['checkout', 'amhello.bst', checkout])
+ result.assert_success()
+
+ assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin',
+ '/usr/share', '/usr/lib/debug',
+ '/usr/lib/debug/hello', '/usr/bin/hello',
+ '/usr/share/doc', '/usr/share/doc/amhello',
+ '/usr/share/doc/amhello/README'])
+
+
+# Test running an executable built with autotools.
+@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux')
+@pytest.mark.datafiles(DATA_DIR)
+def test_autotools_run(cli, tmpdir, datafiles):
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+
+ result = cli.run(project=project, args=['build', 'amhello.bst'])
+ result.assert_success()
+
+ result = cli.run(project=project, args=['shell', 'amhello.bst', 'hello'])
+ result.assert_success()
+ assert result.output == 'Hello World!\nThis is amhello 1.0.\n'