X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/001bf8f58763581d117edaa391aa13ac139eb39b..4b7a5d8aea1153d5204ba2a2bd1cabc3cbfe5056:/test/runtest diff --git a/test/runtest b/test/runtest index 229581005..10f5e4415 100755 --- a/test/runtest +++ b/test/runtest @@ -29,10 +29,11 @@ use File::Basename; use Pod::Usage; use Getopt::Long; use FindBin qw'$RealBin'; +use File::Copy; use lib "$RealBin/lib"; use Exim::Runtest; -use Exim::Utils qw(uniq numerically); +use Exim::Utils qw(uniq numerically cp); use if $ENV{DEBUG} && scalar($ENV{DEBUG} =~ /\bruntest\b/) => 'Smart::Comments' => '####'; use if $ENV{DEBUG} && scalar($ENV{DEBUG} =~ /\bruntest\b/) => 'Data::Dumper'; @@ -407,7 +408,7 @@ RESET_AFTER_EXTRA_LINE_READ: #s/Exim \K\d+[._]\d+[\w_-]*/x.yz/i; # Replace Exim message ids by a unique series - s/((?:[^\W_]{6}-){2}[^\W_]{2}) + s/(\d[^\W_]{5}-[^\W_]{6}-[^\W_]{2}) /new_value($1, "10Hm%s-0005vi-00", \$next_msgid)/egx; # The names of lock files appear in some error and debug messages @@ -598,11 +599,13 @@ RESET_AFTER_EXTRA_LINE_READ: # LibreSSL # TLSv1:AES256-GCM-SHA384:256 # TLSv1:ECDHE-RSA-CHACHA20-POLY1305:256 + # TLS1.3:AEAD-AES256-GCM-SHA384:256 # # ECDHE-RSA-CHACHA20-POLY1305 # AES256-GCM-SHA384 s/(?>/; next if /SSL verify error: depth=0 error=certificate not trusted/; + # OpenSSL 3.0.0 + s/TLS error \(D-H param setting .* error:\K.*dh key too small/xxxxxxxx:SSL routines::dh key too small/; + # ======== Maildir things ======== # timestamp output in maildir processing s/(timestamp=|\(timestamp_only\): )\d+/$1ddddddd/g; @@ -1006,7 +1012,8 @@ RESET_AFTER_EXTRA_LINE_READ: s/conversion: german.xn--strae-oqa.de/conversion: german.straße.de/; # subsecond timstamp info in reported header-files - s/^(-received_time_usec \.)\d{6}$/$1uuuuuu/; + s/^-received_time_usec \.\K\d{6}$/uuuuuu/; + s/^-received_time_complete \K\d+\.\d{6}$/tttt.uuuuuu/; # Postgres server takes varible time to shut down; lives in various places s/^waiting for server to shut down\.+ done$/waiting for server to shut down.... done/; @@ -1018,6 +1025,9 @@ RESET_AFTER_EXTRA_LINE_READ: # ARC is not always supported by the build next if /^arc_sign =/; + # LIMITS is not always supported by the build + next if /^limits_advertise_hosts =/; + # TLS resumption is not always supported by the build next if /^tls_resumption_hosts =/; next if /^-tls_resumption/; @@ -1089,11 +1099,16 @@ RESET_AFTER_EXTRA_LINE_READ: next if /^GnuTLS<2>: added \d+ protocols, \d+ ciphersuites, \d+ sig algos and \d+ groups into priority list$/; next if /^GnuTLS<2>: (Disabling X.509 extensions|signing structure using RSA-SHA256)/; next if /^GnuTLS.*(wrap_nettle_mpi_print|gnutls_subject_alt_names_get|get_alt_name)/; + next if /^GnuTLS<[23]>: (p11|ASSERT: pkcs11.c|Initializing needed PKCS #11 modules)/; + 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/; # only kevent platforms (FreeBSD, OpenBSD) say this next if /^watch dir/; next if /^watch file .*\/usr\/local/; next if /^watch file .*\/etc\/ssl/; + next if /^closing watch fd:/; # TLS preload # there happen in different orders for OpenSSL/GnuTLS/noTLS @@ -1105,7 +1120,7 @@ RESET_AFTER_EXTRA_LINE_READ: next if /^Lookups \(built-in\):/; next if /^Loading lookup modules from/; next if /^Loaded \d+ lookup modules/; - next if /^Total \d+ lookups/; + next if /^(?:\d\d:\d\d:\d\d \d+ )?Total \d+ lookups/; # drop compiler information next if /^Compiler:/; @@ -1169,14 +1184,16 @@ RESET_AFTER_EXTRA_LINE_READ: next; } - # Non-TLS bulds have a different Recieved: header expansion - s/^((.*)\t}}}}by \$primary_hostname \$\{if def:received_protocol \{with \$received_protocol }})\(Exim \$version_number\)$/$1\${if def:tls_in_cipher_std { tls \$tls_in_cipher_std\n$2\t}}(Exim \$version_number)/; - s/^((\s*).*considering: with \$received_protocol }})\(Exim \$version_number\)$/$1\${if def:tls_in_cipher_std { tls \$tls_in_cipher_std\n$2\t}}(Exim \$version_number)/; - if (/condition: def:tls_in_cipher_std$/) + # Non-TLS builds have a different default Recieved: header expansion + s/^((.*)\t}}}}by \$primary_hostname \$\{if def:received_protocol \{with \$received_protocol }})\(Exim \$version_number\)$/$1\${if def:tls_in_ver { (\$tls_in_ver)}}\${if def:tls_in_cipher_std { tls \$tls_in_cipher_std\n$2\t}}(Exim \$version_number)/; + s/^((\s*).*considering: with \$received_protocol }})\(Exim \$version_number\)$/$1\${if def:tls_in_ver { (\$tls_in_ver)}}\${if def:tls_in_cipher_std { tls \$tls_in_cipher_std\n$2\t}}(Exim \$version_number)/; + if (/condition: def:tls_in_ver$/) { $_= ; $_= ; $_= ; $_= ; $_= ; $_= ; $_= ; $_= ; - $_= ; $_= ; $_= ; next; + $_= ; $_= ; $_= ; $_= ; + $_= ; $_= ; $_= ; $_= ; + $_= ; $_= ; $_= ; $_= ; $_= ; next; } @@ -1268,6 +1285,9 @@ RESET_AFTER_EXTRA_LINE_READ: $_ = $line . $_; } + # Different builds will have different lookup types included + 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)/; @@ -1283,6 +1303,9 @@ RESET_AFTER_EXTRA_LINE_READ: # Experimental_REQUIRETLS next if / in tls_advertise_requiretls?\? no \(end of list\)/; + # Experimental_LIMITS + next if / in limits_advertise_hosts?\? no \(matched "!\*"\)/; + # TCP Fast Open next if /^(ppppp )?setsockopt FASTOPEN: Network Error/; @@ -1385,8 +1408,13 @@ RESET_AFTER_EXTRA_LINE_READ: s/^errno = \d+$/errno = EEE/; s/^writing error \d+: /writing error EEE: /; - # Some platforms have to flip to slow-mode taint-checking - next if /switching to slow-mode taint checking/; + # Time-only, in debug output + # we have to handle double lines from the DBOPEN, hence placed down here and /mg + s/^\d\d:\d\d:\d\d\s/01:01:01 /mg; + + # pid in debug lines + s/^(\d\d:\d\d:\d\d)(\s\d+\s)/"$1 " . new_value($2, "%s", \$next_pid) . " "/mgxe; + s/(?>/; + s/\(gnutls_handshake\): No common application protocol could be negotiated./(SSL_accept): error: <>/; } # ======== mail ======== @@ -1795,7 +1825,7 @@ if (-e $sf_current) if (-s $mf) { my $sf = /^u/i ? $sf_current : $sf_flavour; - tests_exit(-1, "Failed to cp $mf $sf") if system("cp '$mf' '$sf'") != 0; + copy($mf, $sf) or tests_exit(-1, "Failed to copy $mf $sf"); } else { @@ -1898,7 +1928,8 @@ $munges = 'debuglog_stdout' => { 'stdout' => 's/^\d\d:\d\d:\d\d\s+\d+ //; - s/Process \d+ is ready for new message/Process pppp is ready for new message/' + s/Process \d+ is ready for new message/Process pppp is ready for new message/; + s/^(?:daemon-accept forked for daemon-accept-delivery:|forked delivery process) \K\d+$/pppp/;' }, 'timeout_errno' => # actual errno differs Solaris vs. Linux @@ -2158,7 +2189,7 @@ if ($debug) $prcmd =~ s/; /;\n>> /; print ">> $prcmd\n"; } -system("$cmd"); +system($cmd); } @@ -2941,6 +2972,7 @@ GetOptions( 'valgrind' => \$valgrind, 'range=s{2}' => \my @range_wanted, 'test=i@' => \my @tests_wanted, + 'fail-any!' => \my $fail_any, 'flavor|flavour=s' => \$flavour, 'help' => sub { pod2usage(-exit => 0) }, 'man' => sub { @@ -3744,37 +3776,16 @@ system("sudo cp eximdir/exim eximdir/exim_exim;" . ($parm_exim_dir) = $parm_exim =~ m?^(.*)/exim?; $dbm_build_deleted = 0; -if (defined $parm_lookups{dbm} && - system("cp $parm_exim_dir/exim_dbmbuild eximdir") != 0) +if (defined $parm_lookups{dbm} && not cp("$parm_exim_dir/exim_dbmbuild", "eximdir/exim_dbmbuild")) { delete $parm_lookups{dbm}; $dbm_build_deleted = 1; } -if (system("cp $parm_exim_dir/exim_dumpdb eximdir") != 0) - { - tests_exit(-1, "Failed to make a copy of exim_dumpdb: $!"); - } - -if (system("cp $parm_exim_dir/exim_lock eximdir") != 0) - { - tests_exit(-1, "Failed to make a copy of exim_lock: $!"); - } - -if (system("cp $parm_exim_dir/exinext eximdir") != 0) - { - tests_exit(-1, "Failed to make a copy of exinext: $!"); - } - -if (system("cp $parm_exim_dir/exigrep eximdir") != 0) - { - tests_exit(-1, "Failed to make a copy of exigrep: $!"); - } - -if (system("cp $parm_exim_dir/eximstats eximdir") != 0) - { - tests_exit(-1, "Failed to make a copy of eximstats: $!"); - } +foreach my $tool (qw(exim_dumpdb exim_lock exinext exigrep eximstats)) { + cp("$parm_exim_dir/$tool" => "eximdir/$tool") + or tests_exit(-1, "Failed to make a copy of $tool: $!"); +} # Collect some version information print '-' x 78, "\n"; @@ -4167,6 +4178,7 @@ if (not $force_continue) { } +my $failures = 0; foreach $test (@test_list) { state $lasttestdir = ''; @@ -4213,15 +4225,15 @@ foreach $test (@test_list) # the test-mail directory for appendfile deliveries. system "sudo /bin/rm -rf spool test-*"; - system "mkdir test-mail 2>/dev/null"; + mkdir "test-mail"; # A privileged Exim will normally make its own spool directory, but some of # the tests run in unprivileged modes that don't always work if the spool # directory isn't already there. What is more, we want anybody to be able # to read it in order to find the daemon's pid. - system "mkdir spool; " . - "sudo chown $parm_eximuser:$parm_eximgroup spool; " . + mkdir "spool"; + system "sudo chown $parm_eximuser:$parm_eximgroup spool; " . "sudo chmod 0755 spool"; # Empty the cache that keeps track of things like message id mappings, and @@ -4400,10 +4412,12 @@ foreach $test (@test_list) print "\nshow stdErr, show stdOut, Retry, Continue (without file comparison), or Quit? [Q] "; $_ = $force_continue ? "c" : ; tests_exit(1) if /^q?$/i; - if (/^c$/ && $force_continue) { - log_failure($log_failed_filename, $testno, "exit code unexpected"); - log_test($log_summary_filename, $testno, 'F') - } + if (/^c$/ && $force_continue) + { + log_failure($log_failed_filename, $testno, "exit code unexpected"); + log_test($log_summary_filename, $testno, 'F'); + $failures++; + } if ($force_continue) { print "\nstdout tail:\n"; @@ -4456,7 +4470,7 @@ foreach $test (@test_list) { if (($? & 0xff) == 0) { printf("Server return code %d for test %d starting line %d", $?/256, - $testno, $subtest_startline); } + $testno, $subtest_startline); } elsif (($? & 0xff00) == 0) { printf("Server killed by signal %d", $? & 255); } else @@ -4467,10 +4481,12 @@ foreach $test (@test_list) print "\nShow server stdout, Retry, Continue, or Quit? [Q] "; $_ = $force_continue ? "c" : ; tests_exit(1) if /^q?$/i; - if (/^c$/ && $force_continue) { - log_failure($log_failed_filename, $testno, "exit code unexpected"); - log_test($log_summary_filename, $testno, 'F') - } + if (/^c$/ && $force_continue) + { + log_failure($log_failed_filename, $testno, "exit code unexpected"); + log_test($log_summary_filename, $testno, 'F'); + $failures++; + } print "... continue forced\n" if $force_continue; last if /^[rc]$/i; @@ -4505,7 +4521,14 @@ foreach $test (@test_list) { sleep 1 if $slow; my $rc = check_output($TEST_STATE->{munge}); - log_test($log_summary_filename, $testno, 'P') if ($rc == 0); + if ($rc == 0) + { + log_test($log_summary_filename, $testno, 'P'); + } + else + { + $failures++; + } if ($rc < 2) { print (" Script completed\n"); @@ -4524,7 +4547,7 @@ foreach $test (@test_list) ################################################## tests_exit(-1, "No runnable tests selected") if not @test_list; -tests_exit(0); +tests_exit($fail_any ? $failures : 0); __END__