Utilities: fix exiqgrep perl syntax, add testcases. Bug 2821
[exim.git] / test / runtest
index 06e4401154f4d4ae2dbe9b422380ed7d53822145..f0fc25f75e5ad74e85e2e9d924f574a866e4eca7 100755 (executable)
@@ -964,6 +964,9 @@ RESET_AFTER_EXTRA_LINE_READ:
   # MIME boundaries in RFC3461 DSN messages
   s/\d{8,10}-eximdsn-\d+/NNNNNNNNNN-eximdsn-MMMMMMMMMM/;
 
+  # Cyrus SASL library version differences (rejectlog)
+  s/Cyrus SASL permanent failure: \Kuser not found$/generic failure/;
+
   # ==========================================================
   # Some munging is specific to the specific file types
 
@@ -1107,6 +1110,10 @@ RESET_AFTER_EXTRA_LINE_READ:
     next if /^GnuTLS<2>: Intel (AES|GCM) accelerator was detected/;
     next if /^Added \d{3} certificate authorities/;
     next if /^TLS: not preloading CRL for server/;
+    next if /^GnuTLS<3>: ASSERT: extensions.c\[_gnutls_get_extension/;
+    next if /^GnuTLS<3>: ASSERT: \.\.\/\.\.\/\.\.\/lib\/x509\//;
+    next if /^GnuTLS<2>: Initializing PKCS #11 modules/;
+
 
     # only kevent platforms (FreeBSD, OpenBSD) say this
     next if /^watch dir/;
@@ -1290,7 +1297,7 @@ RESET_AFTER_EXTRA_LINE_READ:
       }
 
     # Different builds will have different lookup types included
-    s/^search_type \K\d+ \((\w+)\) quoting -1 \(none\)$/NN ($1) quoting -1 (none)/;
+    s/^\s*search_type \K\d+ \((\w+)\) quoting -1 \(none\)$/NN ($1) quoting -1 (none)/;
 
     # DISABLE_OCSP
     next if /in hosts_requ(est|ire)_ocsp\? (no|yes)/;
@@ -2031,7 +2038,7 @@ if (! $message_skip)
 
   foreach $mail (@mails)
     {
-    next if $mail eq "test-mail/oncelog";
+    next if $mail =~ /^test-mail\/oncelog(.(dir|pag|db))?$/;
 
     $saved_mail = substr($mail, 10);               # Remove "test-mail/"
     $saved_mail =~ s/^$parm_caller(\/|$)/CALLER/;  # Convert caller name
@@ -2409,6 +2416,17 @@ if (/^exigrep\s+(.*)/)
   }
 
 
+# The "exiqgrep" command runs exiqgrep on the current spool
+
+if (/^exiqgrep(\s+.*)?/)
+  {
+  run_system("(./eximdir/exiqgrep -E ./eximdir/exim -C $parm_cwd/test-config" . ($1 || '') . ";" .
+    "echo exiqgrep exit code = \$?)" .
+    ">>test-stdout");
+  return 1;
+  }
+
+
 # The "eximstats" command runs eximstats on the current mainlog
 
 if (/^eximstats\s+(.*)/)
@@ -3791,7 +3809,7 @@ if (defined $parm_lookups{dbm} && not cp("$parm_exim_dir/exim_dbmbuild", "eximdi
   $dbm_build_deleted = 1;
   }
 
-foreach my $tool (qw(exim_dumpdb exim_lock exinext exigrep eximstats)) {
+foreach my $tool (qw(exim_dumpdb exim_lock exinext exigrep eximstats exiqgrep)) {
   cp("$parm_exim_dir/$tool" => "eximdir/$tool")
     or tests_exit(-1, "Failed to make a copy of $tool: $!");
 }
@@ -3799,7 +3817,7 @@ foreach my $tool (qw(exim_dumpdb exim_lock exinext exigrep eximstats)) {
 # Collect some version information
 print '-' x 78, "\n";
 print "Perl version for runtest: $]\n";
-foreach (map { "./eximdir/$_" } qw(exigrep exinext eximstats)) {
+foreach (map { "./eximdir/$_" } qw(exigrep exinext eximstats exiqgrep)) {
   # fold (or unfold?) multiline output into a one-liner
   print join(', ', map { chomp; $_ } `$_ --version`), "\n";
 }