Phillip Smyth pushed to branch issue_640-Build-All at BuildStream / buildstream
Commits:
-
5467c3b5
by Phillip Smyth at 2018-12-11T13:07:04Z
19 changed files:
- 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:
... | ... | @@ -60,6 +60,64 @@ def test_build_checkout(datafiles, cli, strict, hardlinks): |
60 | 60 |
assert os.path.exists(filename)
|
61 | 61 |
|
62 | 62 |
|
63 |
+@pytest.mark.datafiles(os.path.join(os.path.dirname(
|
|
64 |
+ os.path.realpath(__file__)),
|
|
65 |
+ "project_world",
|
|
66 |
+))
|
|
67 |
+@pytest.mark.parametrize("strict,hardlinks", [
|
|
68 |
+ ("strict", "copies"),
|
|
69 |
+ ("strict", "hardlinks"),
|
|
70 |
+ ("non-strict", "copies"),
|
|
71 |
+ ("non-strict", "hardlinks"),
|
|
72 |
+])
|
|
73 |
+def test_build_default_all_checkout(datafiles, cli, strict, hardlinks):
|
|
74 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
75 |
+ checkout = os.path.join(cli.directory, 'checkout')
|
|
76 |
+ |
|
77 |
+ # First build it
|
|
78 |
+ result = cli.run(project=project, args=strict_args(['build'], strict))
|
|
79 |
+ result.assert_success()
|
|
80 |
+ |
|
81 |
+ # Assert that after a successful build, the builddir is empty
|
|
82 |
+ builddir = os.path.join(cli.directory, 'build')
|
|
83 |
+ assert os.path.isdir(builddir)
|
|
84 |
+ assert not os.listdir(builddir)
|
|
85 |
+ |
|
86 |
+ # Prepare checkout args
|
|
87 |
+ checkout_args = strict_args(['checkout'], strict)
|
|
88 |
+ if hardlinks == "hardlinks":
|
|
89 |
+ checkout_args += ['--hardlinks']
|
|
90 |
+ checkout_args += ['target.bst', checkout]
|
|
91 |
+ |
|
92 |
+ # Now check it out
|
|
93 |
+ result = cli.run(project=project, args=checkout_args)
|
|
94 |
+ result.assert_success()
|
|
95 |
+ |
|
96 |
+ # Check that the executable hello file is found in the checkout
|
|
97 |
+ filename = os.path.join(checkout, 'usr', 'bin', 'hello')
|
|
98 |
+ assert os.path.exists(filename)
|
|
99 |
+ |
|
100 |
+ filename = os.path.join(checkout, 'usr', 'include', 'pony.h')
|
|
101 |
+ assert os.path.exists(filename)
|
|
102 |
+ |
|
103 |
+ |
|
104 |
+@pytest.mark.datafiles(DATA_DIR + "_default")
|
|
105 |
+def test_show_default(cli, datafiles):
|
|
106 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
107 |
+ prev_dir = os.getcwd()
|
|
108 |
+ os.chdir(project)
|
|
109 |
+ result = cli.run(project=project, silent=True, args=[
|
|
110 |
+ 'build'])
|
|
111 |
+ os.chdir(prev_dir)
|
|
112 |
+ |
|
113 |
+ result.assert_success()
|
|
114 |
+ results = cli.get_element_state(project, "target2.bst")
|
|
115 |
+ expected = "cached"
|
|
116 |
+ if results != expected:
|
|
117 |
+ raise AssertionError("Expected output:\n{}\nInstead received output:\n{}"
|
|
118 |
+ .format(expected, result))
|
|
119 |
+ |
|
120 |
+ |
|
63 | 121 |
@pytest.mark.datafiles(DATA_DIR)
|
64 | 122 |
@pytest.mark.parametrize("strict,hardlinks", [
|
65 | 123 |
("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
|