diff options
author | albfan <albertofanjul@gmail.com> | 2018-05-11 03:11:30 +0200 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-05-16 16:51:31 +0900 |
commit | bb8bd1cf46538540ec042d37e8a5f29df6e9e0f2 (patch) | |
tree | bf6cca37b0962a446e8c15ecd993b3d545c4df44 /tests | |
parent | cb076de86ae9d7d38d09b50af5e8481acb0a46c0 (diff) | |
download | buildstream-bb8bd1cf46538540ec042d37e8a5f29df6e9e0f2.tar.gz |
doc: Add first example, building on a flatpak SDK
This adds:
o A ToC area for adding examples
o The instructive example page for the first example
o The example project under doc/examples
o The corresponding integration test in tests/examples
Diffstat (limited to 'tests')
-rw-r--r-- | tests/examples/flatpak-autotools.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/examples/flatpak-autotools.py b/tests/examples/flatpak-autotools.py new file mode 100644 index 000000000..8cda7d150 --- /dev/null +++ b/tests/examples/flatpak-autotools.py @@ -0,0 +1,49 @@ +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', 'flatpak-autotools' +) + + +# Test that a build upon flatpak runtime 'works' - we use the autotools sample +# amhello project for this. +@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux') +@pytest.mark.datafiles(DATA_DIR) +def test_autotools_build(cli, tmpdir, datafiles): + project = os.path.join(datafiles.dirname, datafiles.basename) + checkout = os.path.join(cli.directory, 'checkout') + + result = cli.run(project=project, args=['build', 'hello.bst']) + assert result.exit_code == 0 + + result = cli.run(project=project, args=['checkout', 'hello.bst', checkout]) + assert result.exit_code == 0 + + 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', 'hello.bst']) + assert result.exit_code == 0 + + result = cli.run(project=project, args=['shell', 'hello.bst', '/usr/bin/hello']) + assert result.exit_code == 0 + assert result.output == 'Hello World!\nThis is amhello 1.0.\n' |