Jürg Billeter pushed to branch master at BuildStream / buildstream
Commits:
2 changed files:
Changes:
| 1 |
+#
|
|
| 2 |
+# Copyright (C) 2018 Codethink Limited
|
|
| 3 |
+# Copyright (C) 2018 Bloomberg Finance LP
|
|
| 4 |
+#
|
|
| 5 |
+# This program is free software; you can redistribute it and/or
|
|
| 6 |
+# modify it under the terms of the GNU Lesser General Public
|
|
| 7 |
+# License as published by the Free Software Foundation; either
|
|
| 8 |
+# version 2 of the License, or (at your option) any later version.
|
|
| 9 |
+#
|
|
| 10 |
+# This library is distributed in the hope that it will be useful,
|
|
| 11 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 12 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
| 13 |
+# Lesser General Public License for more details.
|
|
| 14 |
+#
|
|
| 15 |
+# You should have received a copy of the GNU Lesser General Public
|
|
| 16 |
+# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
| 17 |
+#
|
|
| 18 |
+# Authors: Richard Maw <richard maw codethink co uk>
|
|
| 19 |
+#
|
|
| 20 |
+ |
|
| 21 |
+import os
|
|
| 22 |
+import pytest
|
|
| 23 |
+ |
|
| 24 |
+from buildstream.plugintestutils import cli
|
|
| 25 |
+ |
|
| 26 |
+ |
|
| 27 |
+# Project directory
|
|
| 28 |
+DATA_DIR = os.path.join(
|
|
| 29 |
+ os.path.dirname(os.path.realpath(__file__)),
|
|
| 30 |
+ "project",
|
|
| 31 |
+)
|
|
| 32 |
+ |
|
| 33 |
+ |
|
| 34 |
+@pytest.mark.datafiles(DATA_DIR)
|
|
| 35 |
+def test_artifact_log(cli, tmpdir, datafiles):
|
|
| 36 |
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
| 37 |
+ |
|
| 38 |
+ # Get the cache key of our test element
|
|
| 39 |
+ result = cli.run(project=project, silent=True, args=[
|
|
| 40 |
+ '--no-colors',
|
|
| 41 |
+ 'show', '--deps', 'none', '--format', '%{full-key}',
|
|
| 42 |
+ 'target.bst'
|
|
| 43 |
+ ])
|
|
| 44 |
+ key = result.output.strip()
|
|
| 45 |
+ |
|
| 46 |
+ # Ensure we have an artifact to read
|
|
| 47 |
+ result = cli.run(project=project, args=['build', 'target.bst'])
|
|
| 48 |
+ assert result.exit_code == 0
|
|
| 49 |
+ |
|
| 50 |
+ # Read the log via the element name
|
|
| 51 |
+ result = cli.run(project=project, args=['artifact', 'log', 'target.bst'])
|
|
| 52 |
+ assert result.exit_code == 0
|
|
| 53 |
+ log = result.output
|
|
| 54 |
+ |
|
| 55 |
+ # Read the log via the key
|
|
| 56 |
+ result = cli.run(project=project, args=['artifact', 'log', 'test/target/' + key])
|
|
| 57 |
+ assert result.exit_code == 0
|
|
| 58 |
+ assert log == result.output
|
|
| 59 |
+ |
|
| 60 |
+ # Read the log via glob
|
|
| 61 |
+ result = cli.run(project=project, args=['artifact', 'log', 'test/target/*'])
|
|
| 62 |
+ assert result.exit_code == 0
|
|
| 63 |
+ # The artifact is cached under both a strong key and a weak key
|
|
| 64 |
+ assert (log + log) == result.output
|
| ... | ... | @@ -37,40 +37,6 @@ DATA_DIR = os.path.join( |
| 37 | 37 |
)
|
| 38 | 38 |
|
| 39 | 39 |
|
| 40 |
-@pytest.mark.integration
|
|
| 41 |
-@pytest.mark.datafiles(DATA_DIR)
|
|
| 42 |
-def test_artifact_log(cli, tmpdir, datafiles):
|
|
| 43 |
- project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
| 44 |
- |
|
| 45 |
- # Get the cache key of our test element
|
|
| 46 |
- result = cli.run(project=project, silent=True, args=[
|
|
| 47 |
- '--no-colors',
|
|
| 48 |
- 'show', '--deps', 'none', '--format', '%{full-key}',
|
|
| 49 |
- 'base.bst'
|
|
| 50 |
- ])
|
|
| 51 |
- key = result.output.strip()
|
|
| 52 |
- |
|
| 53 |
- # Ensure we have an artifact to read
|
|
| 54 |
- result = cli.run(project=project, args=['build', 'base.bst'])
|
|
| 55 |
- assert result.exit_code == 0
|
|
| 56 |
- |
|
| 57 |
- # Read the log via the element name
|
|
| 58 |
- result = cli.run(project=project, args=['artifact', 'log', 'base.bst'])
|
|
| 59 |
- assert result.exit_code == 0
|
|
| 60 |
- log = result.output
|
|
| 61 |
- |
|
| 62 |
- # Read the log via the key
|
|
| 63 |
- result = cli.run(project=project, args=['artifact', 'log', 'test/base/' + key])
|
|
| 64 |
- assert result.exit_code == 0
|
|
| 65 |
- assert log == result.output
|
|
| 66 |
- |
|
| 67 |
- # Read the log via glob
|
|
| 68 |
- result = cli.run(project=project, args=['artifact', 'log', 'test/base/*'])
|
|
| 69 |
- assert result.exit_code == 0
|
|
| 70 |
- # The artifact is cached under both a strong key and a weak key
|
|
| 71 |
- assert (log + log) == result.output
|
|
| 72 |
- |
|
| 73 |
- |
|
| 74 | 40 |
# A test to capture the integration of the cachebuildtrees
|
| 75 | 41 |
# behaviour, which by default is to include the buildtree
|
| 76 | 42 |
# content of an element on caching.
|
