xref: /linux/tools/perf/tests/shell/common/check_all_patterns_found.pl (revision 8e1bb4a41aa78d6105e59186af3dcd545fc66e70)
1#!/usr/bin/perl
2# SPDX-License-Identifier: GPL-2.0
3
4@regexps = @ARGV;
5
6$quiet = 1;
7$quiet = 0 if (defined $ENV{TESTLOG_VERBOSITY} && $ENV{TESTLOG_VERBOSITY} ge 2);
8
9%found = ();
10$passed = 1;
11
12while (<STDIN>)
13{
14	s/\n//;
15
16	for $r (@regexps)
17	{
18		if (/$r/)
19		{
20			$found{$r} = 1;	# FIXME: maybe add counters -- how many times was the regexp matched
21		}
22	}
23}
24
25for $r (@regexps)
26{
27	unless (exists $found{$r})
28	{
29		print "Regexp not found: \"$r\"\n" unless $quiet;
30		$passed = 0;
31	}
32}
33
34exit ($passed == 0);
35