From 72a65613dd371f41cab595c52c7208abb2d621e0 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Thu, 13 Dec 2018 02:18:33 -0500 Subject: [PATCH] reduce use of globals and pass more data to the rss generator Signed-off-by: Jason Etheridge --- qa/test_output_webifier.pl | 49 +++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/qa/test_output_webifier.pl b/qa/test_output_webifier.pl index 0949eed0f..f0416f050 100755 --- a/qa/test_output_webifier.pl +++ b/qa/test_output_webifier.pl @@ -37,11 +37,12 @@ while (my $line = <>) { } if ($line =~ /_\.-~= (.*)$/) { $prev_subpage = $subpage; - $subpage = $1; + $prev_subpage_count = $subpage_count; $state = 'outputting'; print STDOUT "outputting $prev_subpage with error_count = $error_count\n"; - print_pass_or_fail($prev_subpage); + print_pass_or_fail($prev_subpage,$prev_subpage_count,$error_count,$subpage_return_value); $error_count = 0; + $subpage = $1; $subpage_count++; print MAIN_PAGE qq^\n
  • $subpage^; open SUB_PAGE, ">test.$subpage_count.html"; @@ -149,31 +150,34 @@ sub html_footer { } sub print_pass_or_fail { - my $subpage = shift; + my $p_subpage = shift; + my $p_subpage_count = shift; + my $p_error_count = shift; + my $p_subpage_return_value = shift; my $exception = {}; # keyed on subpage, value = # of expected errors $exception{'Log Output: osrfsys.log'} = 3; # open-ils.cstore ERROR from live_t/08-lp1366964-libdbi-error.t (and related) $exception{'Running Evergreen browser client build/test'} = 6; # Cannot connect to offline DB: Error: http://google.github.io/lovefield/error_lookup/src/error_lookup.html - if (! defined $exception{$subpage}) { - $exception{$subpage} = 0; + if (! defined $exception{$p_subpage}) { + $exception{$p_subpage} = 0; } # just consider the final Return Value for the following subpages: - if ($subpage eq 'Installing Evergreen pre-requisites') { - $error_count = 0; - if ($subpage_return_value ne '0') { - $error_count = 1; + if ($p_subpage eq 'Installing Evergreen pre-requisites') { + $p_error_count = 0; + if ($p_subpage_return_value ne '0') { + $p_error_count = 1; } } - #print "subpage = <$subpage> error_count = $error_count\n"; - if ($error_count && $error_count != $exception{$subpage} ) { + #print "subpage = <$p_subpage> error_count = $p_error_count\n"; + if ($p_error_count && $p_error_count != $exception{$p_subpage} ) { print MAIN_PAGE ' - Failed'; - print PASS_FAIL "Failed $subpage"; - if ($exception{$subpage} > 0) { - print MAIN_PAGE " - Expected $exception{$subpage} errors but encountered $error_count."; - print PASS_FAIL " - Expected $exception{$subpage} errors but encountered $error_count."; + print PASS_FAIL "$p_subpage_count $p_error_count Failed $p_subpage"; + if ($exception{$p_subpage} > 0) { + print MAIN_PAGE " - Expected $exception{$p_subpage} errors but encountered $p_error_count."; + print PASS_FAIL " - Expected $exception{$p_subpage} errors but encountered $p_error_count."; } print PASS_FAIL "\n"; } else { - if ($subpage_count) { + if ($p_subpage_count) { print MAIN_PAGE ' - Passed'; print PASS_FAIL "Passed\n"; } @@ -238,13 +242,18 @@ sub update_rss { } my $fidx = 0; foreach my $f (split /\n/, $fail) { + if ($f =~ /^(\d+) (\d+) (.+)$/) { + $f_subpage_count = $1; + $f_error_count = $2; + $f_details = $3; + } print RSS_FILE q^ - ^ . $f . q^ - - http://testing.evergreen-ils.org/~live#^ . `date -Ins` . '-' . ($fidx++) . q^ + ^ . $f_details . q^ + + http://testing.evergreen-ils.org/~live/test.^ . $f_subpage_count . q^.html#^ . `date -Ins` . '-' . ($fidx++) . q^ ^ . `date -Iseconds` . q^ - ^ . $f . q^ + ^ . $f_details . q^ ^; } -- 2.11.0