From 0826cf6451b123652c9ed2633c591be1e8d1e4ff Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Fri, 12 Aug 2016 18:35:55 -0400 Subject: [PATCH] Bug 16554 - DO NOT PUSH - Follow up to testing script Made it so that it really does fail or not based on testing. Also, added printing of files it is loading as it goes along. Forced a fail test for the files that don't load so they will get summarized at the end. Signed-off-by: Mark Tompsett --- t/db_dependent/Test_installer.t | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/t/db_dependent/Test_installer.t b/t/db_dependent/Test_installer.t index 9cda68e..e051ff6 100644 --- a/t/db_dependent/Test_installer.t +++ b/t/db_dependent/Test_installer.t @@ -25,8 +25,8 @@ my @global_files = ( ); my $kohastructure = $sample_dir . '/kohastructure.sql'; -#for my $lang ( qw ( de-DE en es-ES fr-CA fr-FR it-IT nb-NO pl-PL ru-RU uk-UA ) ) { -for my $lang ( qw ( it-IT nb-NO ) ) { +my $failure = 0; +for my $lang ( qw ( de-DE en es-ES fr-CA fr-FR it-IT nb-NO pl-PL ru-RU uk-UA ) ) { for my $marcflavour ( qw( marc21 unimarc ) ) { say "loading kohastructure for $lang | not $marcflavour"; recreate_db( $db_name ); @@ -37,18 +37,23 @@ for my $lang ( qw ( it-IT nb-NO ) ) { push @sample_files, $File::Find::name if $_ =~ m|\.sql$|; }, $sample_dir . $lang . '/' ); - @sample_files = ( @global_files, sort @sample_files ); + @sample_files = grep { $_ !~ $marcflavour } ( @global_files, sort @sample_files ); my $i = 1; for my $sql_file ( @sample_files ) { - print $i++ . "/" . scalar @sample_files . "\r"; flush STDOUT; - next if $sql_file =~ $marcflavour; #my $content = read_file( $sql_file ); #my @tables = uniq map { $_ =~ s/insert\s*(ignore)?\s*into\s*`?(\w+)`?.*/$2/xmsi; $_ } grep {/insert\s*(ignore)?\s*into/xmsi} split '\n', $content; my $error = C4::Installer->new->load_sql( $sql_file ); - warn $error if $error; + if ($error) { + $failure = 1; + fail(sprintf("%s: %s",$sql_file,$error)); + } + note(sprintf("%02d/%02d: %s",$i,scalar @sample_files,$sql_file)); + $i++; } } } +is(0,$failure,"No failures"); +done_testing(); sub recreate_db { my $dbname = shift; -- 2.7.4