Phillip Smyth pushed to branch issue_640-Build-All at BuildStream / buildstream
Commits:
20 changed files:
- NEWS
- tests/frontend/buildcheckout.py
- + tests/frontend/project_default/elements/target.bst
- + tests/frontend/project_default/elements/target2.bst
- + tests/frontend/project_default/project.conf
- + tests/frontend/project_world/elements/compose-all.bst
- + tests/frontend/project_world/elements/compose-exclude-dev.bst
- + tests/frontend/project_world/elements/compose-include-bin.bst
- + tests/frontend/project_world/elements/import-bin.bst
- + tests/frontend/project_world/elements/import-dev.bst
- + tests/frontend/project_world/elements/rebuild-target.bst
- + tests/frontend/project_world/elements/source-bundle/source-bundle-hello.bst
- + tests/frontend/project_world/elements/target.bst
- + tests/frontend/project_world/files/bar
- + tests/frontend/project_world/files/bin-files/usr/bin/hello
- + tests/frontend/project_world/files/build-files/buildstream/build/test
- + tests/frontend/project_world/files/dev-files/usr/include/pony.h
- + tests/frontend/project_world/files/foo
- + tests/frontend/project_world/files/source-bundle/llamas.txt
- + tests/frontend/project_world/project.conf
Changes:
... | ... | @@ -12,6 +12,10 @@ buildstream 1.3.1 |
12 | 12 |
specific. Recommendation if you are building in Linux is to use the
|
13 | 13 |
ones being used in freedesktop-sdk project, for example
|
14 | 14 |
|
15 |
+ o Running `bst build` without elements specified will now attempt to build
|
|
16 |
+ the default element defined in the projcet configuration.
|
|
17 |
+ If no default element is defined, all elements in the project will be built
|
|
18 |
+ |
|
15 | 19 |
o All elements must now be suffixed with `.bst`
|
16 | 20 |
Attempting to use an element that does not have the `.bst` extension,
|
17 | 21 |
will result in a warning.
|
... | ... | @@ -2,6 +2,7 @@ import os |
2 | 2 |
import tarfile
|
3 | 3 |
import hashlib
|
4 | 4 |
import pytest
|
5 |
+import subprocess
|
|
5 | 6 |
from tests.testutils import cli, create_repo, ALL_REPO_KINDS, generate_junction
|
6 | 7 |
|
7 | 8 |
from buildstream import _yaml
|
... | ... | @@ -60,6 +61,35 @@ def test_build_checkout(datafiles, cli, strict, hardlinks): |
60 | 61 |
assert os.path.exists(filename)
|
61 | 62 |
|
62 | 63 |
|
64 |
+@pytest.mark.datafiles(DATA_DIR + "_world")
|
|
65 |
+def test_build_default_all(datafiles, cli):
|
|
66 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
67 |
+ result = cli.run(project=project, silent=True, args=['build'])
|
|
68 |
+ |
|
69 |
+ result.assert_success()
|
|
70 |
+ target_dir = os.path.join(cli.directory, DATA_DIR + "_world", "elements")
|
|
71 |
+ output_dir = os.path.join(cli.directory, "logs", "test")
|
|
72 |
+ |
|
73 |
+ expected = subprocess.Popen(('ls', target_dir), stdout=subprocess.PIPE)
|
|
74 |
+ expected = subprocess.check_output(("wc", "-w"), stdin=expected.stdout)
|
|
75 |
+ |
|
76 |
+ results = subprocess.Popen(('ls', output_dir), stdout=subprocess.PIPE)
|
|
77 |
+ results = subprocess.check_output(("wc", "-w"), stdin=results.stdout)
|
|
78 |
+ |
|
79 |
+ assert results == expected
|
|
80 |
+ |
|
81 |
+ |
|
82 |
+@pytest.mark.datafiles(DATA_DIR + "_default")
|
|
83 |
+def test_build_default(cli, datafiles):
|
|
84 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
85 |
+ result = cli.run(project=project, silent=True, args=['build'])
|
|
86 |
+ |
|
87 |
+ result.assert_success()
|
|
88 |
+ results = cli.get_element_state(project, "target2.bst")
|
|
89 |
+ expected = "cached"
|
|
90 |
+ assert results == expected
|
|
91 |
+ |
|
92 |
+ |
|
63 | 93 |
@pytest.mark.datafiles(DATA_DIR)
|
64 | 94 |
@pytest.mark.parametrize("strict,hardlinks", [
|
65 | 95 |
("non-strict", "hardlinks"),
|
1 |
+kind: stack
|
|
2 |
+description: |
|
|
3 |
+ |
|
4 |
+ Main stack target for the bst build test
|
1 |
+kind: stack
|
|
2 |
+description: |
|
|
3 |
+ |
|
4 |
+ Main stack target for the bst build test
|
1 |
+# Project config for frontend build test
|
|
2 |
+name: test
|
|
3 |
+ |
|
4 |
+element-path: elements
|
|
5 |
+ |
|
6 |
+fatal-warnings:
|
|
7 |
+- bad-element-suffix
|
|
8 |
+ |
|
9 |
+defaults:
|
|
10 |
+ target-element: target2.bst
|
1 |
+kind: compose
|
|
2 |
+ |
|
3 |
+depends:
|
|
4 |
+- filename: import-bin.bst
|
|
5 |
+ type: build
|
|
6 |
+- filename: import-dev.bst
|
|
7 |
+ type: build
|
|
8 |
+ |
|
9 |
+config:
|
|
10 |
+ # Dont try running the sandbox, we dont have a
|
|
11 |
+ # runtime to run anything in this context.
|
|
12 |
+ integrate: False
|
1 |
+kind: compose
|
|
2 |
+ |
|
3 |
+depends:
|
|
4 |
+- filename: import-bin.bst
|
|
5 |
+ type: build
|
|
6 |
+- filename: import-dev.bst
|
|
7 |
+ type: build
|
|
8 |
+ |
|
9 |
+config:
|
|
10 |
+ # Dont try running the sandbox, we dont have a
|
|
11 |
+ # runtime to run anything in this context.
|
|
12 |
+ integrate: False
|
|
13 |
+ |
|
14 |
+ # Exclude the dev domain
|
|
15 |
+ exclude:
|
|
16 |
+ - devel
|
1 |
+kind: compose
|
|
2 |
+ |
|
3 |
+depends:
|
|
4 |
+- filename: import-bin.bst
|
|
5 |
+ type: build
|
|
6 |
+- filename: import-dev.bst
|
|
7 |
+ type: build
|
|
8 |
+ |
|
9 |
+config:
|
|
10 |
+ # Dont try running the sandbox, we dont have a
|
|
11 |
+ # runtime to run anything in this context.
|
|
12 |
+ integrate: False
|
|
13 |
+ |
|
14 |
+ # Only include the runtim
|
|
15 |
+ include:
|
|
16 |
+ - runtime
|
1 |
+kind: import
|
|
2 |
+sources:
|
|
3 |
+- kind: local
|
|
4 |
+ path: files/bin-files
|
1 |
+kind: import
|
|
2 |
+sources:
|
|
3 |
+- kind: local
|
|
4 |
+ path: files/dev-files
|
1 |
+kind: compose
|
|
2 |
+ |
|
3 |
+build-depends:
|
|
4 |
+- target.bst
|
1 |
+kind: import
|
|
2 |
+description: the kind of this element must implement generate_script() method
|
|
3 |
+ |
|
4 |
+sources:
|
|
5 |
+- kind: local
|
|
6 |
+ path: files/source-bundle
|
1 |
+kind: stack
|
|
2 |
+description: |
|
|
3 |
+ |
|
4 |
+ Main stack target for the bst build test
|
|
5 |
+ |
|
6 |
+depends:
|
|
7 |
+- import-bin.bst
|
|
8 |
+- compose-all.bst
|
1 |
+#!/bin/bash
|
|
2 |
+ |
|
3 |
+echo "Hello !"
|
1 |
+test
|
1 |
+#ifndef __PONY_H__
|
|
2 |
+#define __PONY_H__
|
|
3 |
+ |
|
4 |
+#define PONY_BEGIN "Once upon a time, there was a pony."
|
|
5 |
+#define PONY_END "And they lived happily ever after, the end."
|
|
6 |
+ |
|
7 |
+#define MAKE_PONY(story) \
|
|
8 |
+ PONY_BEGIN \
|
|
9 |
+ story \
|
|
10 |
+ PONY_END
|
|
11 |
+ |
|
12 |
+#endif /* __PONY_H__ */
|
1 |
+llamas
|
1 |
+# Project config for frontend build test
|
|
2 |
+name: test
|
|
3 |
+ |
|
4 |
+element-path: elements
|