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