+ if echo_lines:
+ terminal.EchoPrintTestLines()
+ return iter(terminal.GetPrintTestLines())
+
+ def _CheckOutput(self, lines, list_error_boards=False,
+ filter_dtb_warnings=False,
+ filter_migration_warnings=False):
+ """Check for expected output from the build summary
+
+ Args:
+ lines: Iterator containing the lines returned from the summary
+ list_error_boards: Adjust the check for output produced with the
+ --list-error-boards flag
+ filter_dtb_warnings: Adjust the check for output produced with the
+ --filter-dtb-warnings flag
+ """
+ def add_line_prefix(prefix, boards, error_str, colour):
+ """Add a prefix to each line of a string
+
+ The training \n in error_str is removed before processing
+
+ Args:
+ prefix: String prefix to add
+ error_str: Error string containing the lines
+ colour: Expected colour for the line. Note that the board list,
+ if present, always appears in magenta
+
+ Returns:
+ New string where each line has the prefix added
+ """
+ lines = error_str.strip().splitlines()
+ new_lines = []
+ for line in lines:
+ if boards:
+ expect = self._col.Color(colour, prefix + '(')
+ expect += self._col.Color(self._col.MAGENTA, boards,
+ bright=False)
+ expect += self._col.Color(colour, ') %s' % line)
+ else:
+ expect = self._col.Color(colour, prefix + line)
+ new_lines.append(expect)
+ return '\n'.join(new_lines)