diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-09-06 22:35:45 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-09-06 22:35:45 +0300 |
commit | 2f4c391958b70ab4be622eb7010d7029363e9529 (patch) | |
tree | 1aada0415af36291bce1e47ec0a092c9f27b5a37 /mysql-test/include | |
parent | 3bfafd133f9cb9de143ac051de9ed72a67bbc2d9 (diff) | |
parent | a0631e72210931182e950734b73c7a090c637261 (diff) | |
download | mariadb-git-2f4c391958b70ab4be622eb7010d7029363e9529.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'mysql-test/include')
-rw-r--r-- | mysql-test/include/search_pattern_in_file.inc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/mysql-test/include/search_pattern_in_file.inc b/mysql-test/include/search_pattern_in_file.inc index 21192b55efb..6bead628fb0 100644 --- a/mysql-test/include/search_pattern_in_file.inc +++ b/mysql-test/include/search_pattern_in_file.inc @@ -18,6 +18,11 @@ # Optionally, SEARCH_ABORT can be set to "FOUND" or "NOT FOUND" and this # will abort if the search result doesn't match the requested one. # +# Optionally, SEARCH_OUTPUT can be set to control the format of output. +# Supported formats: +# - (default) : "FOUND n /pattern/ in FILE " or "NOT FOUND ..." +# - "matches" : Each match is printed, on a separate line +# # In case of # - SEARCH_FILE and/or SEARCH_PATTERN is not set # - SEARCH_FILE cannot be opened @@ -75,7 +80,14 @@ perl; my @matches=($content =~ m/$search_pattern/gs); my $res=@matches ? "FOUND " . scalar(@matches) : "NOT FOUND"; $ENV{SEARCH_FILE} =~ s{^.*?([^/\\]+)$}{$1}; - print "$res /$search_pattern/ in $ENV{SEARCH_FILE}\n"; + + if ($ENV{SEARCH_OUTPUT} eq "matches") { + foreach (@matches) { + print $_ . "\n"; + } + } else { + print "$res /$search_pattern/ in $ENV{SEARCH_FILE}\n"; + } die "$ENV{SEARCH_ABORT}\n" - if $ENV{SEARCH_ABORT} && $res =~ /^$ENV{SEARCH_ABORT}/; + if $ENV{SEARCH_ABORT} && $res =~ /^$ENV{SEARCH_ABORT}/; EOF |