|
1
|
+#
|
|
2
|
+# Copyright (C) 2018 Codethink Limited
|
|
3
|
+#
|
|
4
|
+# This program is free software; you can redistribute it and/or
|
|
5
|
+# modify it under the terms of the GNU Lesser General Public
|
|
6
|
+# License as published by the Free Software Foundation; either
|
|
7
|
+# version 2 of the License, or (at your option) any later version.
|
|
8
|
+#
|
|
9
|
+# This library is distributed in the hope that it will be useful,
|
|
10
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
12
|
+# Lesser General Public License for more details.
|
|
13
|
+#
|
|
14
|
+# You should have received a copy of the GNU Lesser General Public
|
|
15
|
+# License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+#
|
|
17
|
+# Authors: Tristan Maat <tristan maat codethink co uk>
|
|
18
|
+#
|
|
19
|
+
|
|
20
|
+import os
|
|
21
|
+import pytest
|
|
22
|
+
|
|
23
|
+from buildstream import _yaml
|
|
24
|
+
|
|
25
|
+from test.testutils import cli_integration as cli
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+pytestmark = pytest.mark.integration
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+# Project directory
|
|
32
|
+DATA_DIR = os.path.join(
|
|
33
|
+ os.path.dirname(os.path.realpath(__file__)),
|
|
34
|
+ "project",
|
|
35
|
+)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+@pytest.mark.integration
|
|
39
|
+@pytest.mark.datafiles(DATA_DIR)
|
|
40
|
+def test_disable_message_lines(cli, tmpdir, datafiles):
|
|
41
|
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
42
|
+ element_path = os.path.join(project, 'elements')
|
|
43
|
+ element_name = 'message.bst'
|
|
44
|
+
|
|
45
|
+ element = {
|
|
46
|
+ 'kind': 'manual',
|
|
47
|
+ 'depends': [{
|
|
48
|
+ 'filename': 'base.bst'
|
|
49
|
+ }],
|
|
50
|
+ 'config': [
|
|
51
|
+ {'build-commands':
|
|
52
|
+ ['echo "Silly message"'],
|
|
53
|
+ 'strip-commands': []
|
|
54
|
+ }
|
|
55
|
+ ]
|
|
56
|
+ }
|
|
57
|
+
|
|
58
|
+ os.makedirs(os.path.dirname(os.path.join(element_path, element_name)), exist_ok=True)
|
|
59
|
+ _yaml.dump(element, os.path.join(element_path, element_name))
|
|
60
|
+
|
|
61
|
+ # First we check that we get the "Silly message"
|
|
62
|
+ result = cli.run(project=project, args=["build", element_name])
|
|
63
|
+ assert result.exit_code == 0
|
|
64
|
+ assert result.stderr.contains("Silly message")
|
|
65
|
+
|
|
66
|
+ # Let's now build it again, but with --message-lines 0
|
|
67
|
+ result = cli.run(project=project, args=["--message-lines 0",
|
|
68
|
+ "build", element_name])
|
|
69
|
+ assert result.exit_code == 0
|
|
70
|
+ assert not result.stderr.contains("Silly message")
|