summaryrefslogtreecommitdiff
path: root/mysql-test/include
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-09-06 22:35:45 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-09-06 22:35:45 +0300
commit2f4c391958b70ab4be622eb7010d7029363e9529 (patch)
tree1aada0415af36291bce1e47ec0a092c9f27b5a37 /mysql-test/include
parent3bfafd133f9cb9de143ac051de9ed72a67bbc2d9 (diff)
parenta0631e72210931182e950734b73c7a090c637261 (diff)
downloadmariadb-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.inc16
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