summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/bblogging.py
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2022-02-17 18:14:15 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-21 21:53:52 +0000
commit42243c9e22e073eda08a354bcbe091d173f3b4ae (patch)
treef62ef43c9236c197782d49bfdf242afbf3477d3d /meta/lib/oeqa/selftest/cases/bblogging.py
parent528686b9801146a7ebcae99764795680e467429a (diff)
downloadpoky-42243c9e22e073eda08a354bcbe091d173f3b4ae.tar.gz
oeqa/selftest/bblogging: Add logging tests for bb.build.exec_func with shell/python code
The situation regarding logging is different when a function called by bb.build.exec_func() fails compared to when the task code fails directly. There is a recent fix in bitbake to solve that and these tests will hopefully prevent regressions. (From OE-Core rev: 50ccfaa8b3ed340ee7f906934b211a1c73eb8db5) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/bblogging.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/bblogging.py69
1 files changed, 68 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/cases/bblogging.py b/meta/lib/oeqa/selftest/cases/bblogging.py
index ea6c3c8c77..6b0bbfe1c1 100644
--- a/meta/lib/oeqa/selftest/cases/bblogging.py
+++ b/meta/lib/oeqa/selftest/cases/bblogging.py
@@ -30,7 +30,7 @@ class BitBakeLogging(OESelftestTestCase):
30 self.write_config('BBINCLUDELOGS = ""') 30 self.write_config('BBINCLUDELOGS = ""')
31 result = bitbake("logging-test -c shelltest -f -v", ignore_status = True) 31 result = bitbake("logging-test -c shelltest -f -v", ignore_status = True)
32 self.assertIn("ERROR: Logfile of failure stored in:", result.output) 32 self.assertIn("ERROR: Logfile of failure stored in:", result.output)
33 # two copies due to set +x 33 # two copies due to set +x
34 self.assertCount(result.output, "This is shell stdout", 2) 34 self.assertCount(result.output, "This is shell stdout", 2)
35 self.assertCount(result.output, "This is shell stderr", 2) 35 self.assertCount(result.output, "This is shell stderr", 2)
36 36
@@ -42,6 +42,41 @@ class BitBakeLogging(OESelftestTestCase):
42 self.assertCount(result.output, "This is shell stdout", 2) 42 self.assertCount(result.output, "This is shell stdout", 2)
43 self.assertCount(result.output, "This is shell stderr", 2) 43 self.assertCount(result.output, "This is shell stderr", 2)
44 44
45 def test_python_exec_func_shell_logging(self):
46 # no logs, no verbose
47 self.write_config('BBINCLUDELOGS = ""')
48 result = bitbake("logging-test -c pythontest_exec_func_shell -f",
49 ignore_status = True)
50 self.assertIn("ERROR: Logfile of failure stored in:", result.output)
51 self.assertNotIn("This is shell stdout", result.output)
52 self.assertNotIn("This is shell stderr", result.output)
53
54 # logs, no verbose
55 self.write_config('BBINCLUDELOGS = "yes"')
56 result = bitbake("logging-test -c pythontest_exec_func_shell -f",
57 ignore_status = True)
58 self.assertIn("ERROR: Logfile of failure stored in:", result.output)
59 self.assertCount(result.output, "This is shell stdout", 1)
60 self.assertCount(result.output, "This is shell stderr", 1)
61
62 # no logs, verbose
63 self.write_config('BBINCLUDELOGS = ""')
64 result = bitbake("logging-test -c pythontest_exec_func_shell -f -v",
65 ignore_status = True)
66 self.assertIn("ERROR: Logfile of failure stored in:", result.output)
67 # two copies due to set +x
68 self.assertCount(result.output, "This is shell stdout", 2)
69 self.assertCount(result.output, "This is shell stderr", 2)
70
71 # logs, verbose
72 self.write_config('BBINCLUDELOGS = "yes"')
73 result = bitbake("logging-test -c pythontest_exec_func_shell -f -v",
74 ignore_status = True)
75 self.assertIn("ERROR: Logfile of failure stored in:", result.output)
76 # two copies due to set +x
77 self.assertCount(result.output, "This is shell stdout", 2)
78 self.assertCount(result.output, "This is shell stderr", 2)
79
45 def test_python_exit_logging(self): 80 def test_python_exit_logging(self):
46 # no logs, no verbose 81 # no logs, no verbose
47 self.write_config('BBINCLUDELOGS = ""') 82 self.write_config('BBINCLUDELOGS = ""')
@@ -70,6 +105,38 @@ class BitBakeLogging(OESelftestTestCase):
70 # python tasks don't log output with -v currently 105 # python tasks don't log output with -v currently
71 #self.assertCount(result.output, "This is python stdout", 1) 106 #self.assertCount(result.output, "This is python stdout", 1)
72 107
108 def test_python_exec_func_python_logging(self):
109 # no logs, no verbose
110 self.write_config('BBINCLUDELOGS = ""')
111 result = bitbake("logging-test -c pythontest_exec_func_python -f",
112 ignore_status = True)
113 self.assertIn("ERROR: Logfile of failure stored in:", result.output)
114 self.assertNotIn("This is python stdout", result.output)
115
116 # logs, no verbose
117 self.write_config('BBINCLUDELOGS = "yes"')
118 result = bitbake("logging-test -c pythontest_exec_func_python -f",
119 ignore_status = True)
120 self.assertIn("ERROR: Logfile of failure stored in:", result.output)
121 # A sys.exit() should include the output
122 self.assertCount(result.output, "This is python stdout", 1)
123
124 # no logs, verbose
125 self.write_config('BBINCLUDELOGS = ""')
126 result = bitbake("logging-test -c pythontest_exec_func_python -f -v",
127 ignore_status = True)
128 self.assertIn("ERROR: Logfile of failure stored in:", result.output)
129 # python tasks don't log output with -v currently
130 #self.assertCount(result.output, "This is python stdout", 1)
131
132 # logs, verbose
133 self.write_config('BBINCLUDELOGS = "yes"')
134 result = bitbake("logging-test -c pythontest_exec_func_python -f -v",
135 ignore_status = True)
136 self.assertIn("ERROR: Logfile of failure stored in:", result.output)
137 # python tasks don't log output with -v currently
138 #self.assertCount(result.output, "This is python stdout", 1)
139
73 def test_python_fatal_logging(self): 140 def test_python_fatal_logging(self):
74 # no logs, no verbose 141 # no logs, no verbose
75 self.write_config('BBINCLUDELOGS = ""') 142 self.write_config('BBINCLUDELOGS = ""')