From 196e3a971209857ee8966d0aa4433b04d524052f Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 3 Nov 2018 09:07:28 -0400 Subject: [PATCH] Tests: Reduce timeout when single-threaded testing. --- test_regress/driver.pl | 24 +++++++++++++++++------- test_regress/t/t_dist_tabs.pl | 3 ++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/test_regress/driver.pl b/test_regress/driver.pl index fbd664abe..2d5e5622a 100755 --- a/test_regress/driver.pl +++ b/test_regress/driver.pl @@ -1104,8 +1104,9 @@ sub _run { # Read the log file a couple of times to allow for NFS delays if ($param{check_finished} || $param{expect}) { - for (my $try=7; $try>=0; $try--) { - sleep 1 if ($try!=7); + my $tries = $self->tries; + for (my $try=$tries-1; $try>=0; $try--) { + sleep 1 if ($try!=$tries-1); my $moretry = $try!=0; my $fh = IO::File->new("<$param{logfile}"); @@ -1114,17 +1115,18 @@ sub _run { my $wholefile = <$fh>; $fh->close(); - # Strip debugging comments - $wholefile =~ s/^- [^\n]+\n//mig; - $wholefile =~ s/^- [a-z.0-9]+:\d+:[^\n]+\n//mig; - $wholefile =~ s/^dot [^\n]+\n//mig; - # Finished? if ($param{check_finished} && $wholefile !~ /\*\-\* All Finished \*\-\*/) { next if $moretry; $self->error("Missing All Finished\n"); } if ($param{expect}) { + # Strip debugging comments + # See also files_identical + $wholefile =~ s/^- [^\n]+\n//mig; + $wholefile =~ s/^- [a-z.0-9]+:\d+:[^\n]+\n//mig; + $wholefile =~ s/^dot [^\n]+\n//mig; + # Compare my $quoted = quotemeta ($param{expect}); my $ok = ($wholefile eq $param{expect} @@ -1693,6 +1695,14 @@ sub cfg_with_threaded { return ($_Cfg_With_Threaded =~ /yes/i) ? 1:0; } +sub tries { + # Number of retries when reading logfiles, generally only need many + # retries when system is busy running a lot of tests + return 2 if !$::Fork->running; + return 7 if (scalar($::Fork->running)) > 1; + return 2; +} + sub file_grep_not { my $self = (ref $_[0]? shift : $Self); my $filename = shift; diff --git a/test_regress/t/t_dist_tabs.pl b/test_regress/t/t_dist_tabs.pl index a3c4619b2..c6f72422b 100755 --- a/test_regress/t/t_dist_tabs.pl +++ b/test_regress/t/t_dist_tabs.pl @@ -59,7 +59,8 @@ if (!-r "$root/.git") { elsif ($line =~ m!^\+(.*)!) { ++$lineno; my $len = length($1); - if ($len >= 100) { + if ($len >= 100 + && $file !~ /\.out$/) { print" Wide $line\n" if $Self->{verbose}; $warns{$file} = "File modification adds a new >100 column line: $file:$lineno"; }