|
1
|
+import os
|
|
2
|
+import pytest
|
|
3
|
+
|
|
4
|
+from tests.testutils import cli_integration as cli
|
|
5
|
+from tests.testutils.integration import assert_contains
|
|
6
|
+from tests.testutils.site import IS_LINUX
|
|
7
|
+
|
|
8
|
+pytestmark = pytest.mark.integration
|
|
9
|
+
|
|
10
|
+DATA_DIR = os.path.join(
|
|
11
|
+ os.path.dirname(os.path.realpath(__file__)), '..', '..', 'doc', 'examples', 'cmake'
|
|
12
|
+)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+# Tests a build of the autotools amhello project on a alpine-linux base runtime
|
|
16
|
+@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux')
|
|
17
|
+@pytest.mark.datafiles(DATA_DIR)
|
|
18
|
+def test_autotools_build(cli, tmpdir, datafiles):
|
|
19
|
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
20
|
+ checkout = os.path.join(cli.directory, 'checkout')
|
|
21
|
+
|
|
22
|
+ # Check that the project can be built correctly.
|
|
23
|
+ result = cli.run(project=project, args=['build', 'hello.bst'])
|
|
24
|
+ result.assert_success()
|
|
25
|
+
|
|
26
|
+ result = cli.run(project=project, args=['checkout', 'hello.bst', checkout])
|
|
27
|
+ result.assert_success()
|
|
28
|
+
|
|
29
|
+ assert_contains(checkout, ['/usr', '/usr/lib', '/usr/bin',
|
|
30
|
+ '/usr/share',
|
|
31
|
+ '/usr/bin/hello_buildstream'])
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+# Test running an executable built with autotools.
|
|
35
|
+@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux')
|
|
36
|
+@pytest.mark.datafiles(DATA_DIR)
|
|
37
|
+def test_autotools_run(cli, tmpdir, datafiles):
|
|
38
|
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
39
|
+
|
|
40
|
+ result = cli.run(project=project, args=['build', 'hello.bst'])
|
|
41
|
+ result.assert_success()
|
|
42
|
+
|
|
43
|
+ result = cli.run(project=project, args=['shell', 'hello.bst', 'hello_buildstream'])
|
|
44
|
+ result.assert_success()
|
|
45
|
+ assert result.output == 'Hello, World!\n'
|
|
46
|
+
|