brintos

brintos / linux-shallow public Read only

0
0
Text · 638 B · fded489 Raw
40 lines · plain
1#!/usr/bin/perl2# SPDX-License-Identifier: GPL-2.03 4@regexps = @ARGV;5 6$max_printed_lines = 20;7$max_printed_lines = $ENV{TESTLOG_ERR_MSG_MAX_LINES} if (defined $ENV{TESTLOG_ERR_MSG_MAX_LINES});8 9$quiet = 1;10$quiet = 0 if (defined $ENV{TESTLOG_VERBOSITY} && $ENV{TESTLOG_VERBOSITY} ge 2);11 12$passed = 1;13$lines_printed = 0;14 15while (<STDIN>)16{17	s/\n//;18 19	$line_matched = 0;20	for $r (@regexps)21	{22		if (/$r/)23		{24			$line_matched = 1;25			last;26		}27	}28 29	unless ($line_matched)30	{31		if ($lines_printed++ < $max_printed_lines)32		{33			print "Line did not match any pattern: \"$_\"\n" unless $quiet;34		}35		$passed = 0;36	}37}38 39exit ($passed == 0);40