From 43d7c523a8f092282a1db6a643e476eef0de8675 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 4 Jul 2013 09:51:31 +0200 Subject: [PATCH] Bug 10539: Followup for removing KohaTest unit tests Makefile.PL: Section for creating file t/test-config.txt removed. Removes t/Makefile and t/rewrite-config-test too. Modifies XISBN.t to remove two commented lines. Test plan: Grep for KohaTest, database_dependent, config-test, t/Makefile. Run perl Makefile.PL and include running the test suite. This may fail on t/00-valid-xml.t and t/QueryParser.t, but that is not the result of this patch. Same for t/00-load.t with potential error on Koha::Plugins::Base. I had this result: Test Summary Report: t/00-valid-xml.t (Wstat: 1792 Tests: 381 Failed: 7) Failed tests: 10, 30-31, 169, 181, 201-202 Non-zero exit status: 7 t/QueryParser.t (Wstat: 512 Tests: 0 Failed: 0) Non-zero exit status: 2 Parse errors: No plan found in TAP output Files=92, Tests=12385, 45 wallclock secs ( 1.74 usr 0.15 sys + 26.61 cusr 1.92 csys = 30.42 CPU) Result: FAIL Failed 2/92 test programs. 7/12385 subtests failed. Signed-off-by: Jared Camins-Esakov All tests pass, and I find no mention of the removed test code. Signed-off-by: Jonathan Druart --- Makefile.PL | 23 ------ t/Makefile | 111 ---------------------------- t/db_dependent/XISBN.t | 3 - t/rewrite-config-test.PL | 179 ---------------------------------------------- 4 files changed, 316 deletions(-) delete mode 100644 t/Makefile delete mode 100644 t/rewrite-config-test.PL diff --git a/Makefile.PL b/Makefile.PL index a61072f..57bb108 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1602,29 +1602,6 @@ sub postamble { $env .= join("\n", map { "export __${_}__ := $config{$_}" } keys %config); } - if ( $config{'RUN_DATABASE_TESTS'} eq 'yes' ) { - if ( open( my $confhandle, '>', 't/test-config.txt' ) ) { - print $confhandle "# This configuration file lets the t/Makefile prepare a test koha-conf.xml file.\n"; - print $confhandle "# It is generated by the top-level Makefile.PL.\n"; - print $confhandle "# It is separate from the standard koha-conf.xml so that you can edit this by hand and test with different configurations.\n"; - - # these directories will be relocated to the 't' directory - foreach my $dirname ( keys %$target_directories ) { - my $dir = main::_strip_destdir( $target_directories->{$dirname} ); - if ( exists $test_suite_override_dirs{$dirname} ) { - $dir = main::get_test_dir($dirname); - } - print $confhandle "$dirname = $dir\n" - } - print $confhandle "\n"; - - print $confhandle join( "\n", map { "$_ = $config{$_}" } keys( %config ) ), "\n"; - close( $confhandle ); - } else { - warn 'unable to open conf file for database dependent tests: $!'; - } - - } return "$env\n"; } diff --git a/t/Makefile b/t/Makefile deleted file mode 100644 index 5a4a5b1..0000000 --- a/t/Makefile +++ /dev/null @@ -1,111 +0,0 @@ - -SHELL = /bin/sh -NOOP = $(SHELL) -c true -NOECHO = @ -ECHO = echo -MKDIR = /bin/mkdir -CP = cp -SED = /bin/sed -CHMOD = chmod -RM = /bin/rm - -# some of these are pretty questionable. -PERL = /usr/bin/perl -# TEST_FILES = *.t -TEST_FILES = database_dependent.pl -TEST_CLASS = -RUN_EXPENSIVE_TESTS = 0 -PROVE = /usr/bin/prove -PROVE_FLAGS = -v -PERL5LIB = .. -KOHA_CONF_DIR = ../etc -CONF_FILE_TEMPLATE = $(KOHA_CONF_DIR)/koha-conf.xml -TEST_CONF_FILE = run/etc/koha-conf.xml -MKPATH = $(PERL) "-MExtUtils::Command" -e mkpath - -TEST_REWRITE_SCRIPT = rewrite-config-test.PL -REAL_REWRITE_SCRIPT = ../rewrite-config.PL - -ZEBRA_CONF_DIR = run/etc/zebradb -ZEBRA_CONF_FILES = $(ZEBRA_CONF_DIR)/etc/passwd $(ZEBRA_CONF_DIR)/zebra-biblios.cfg $(ZEBRA_CONF_DIR)/zebra-authorities.cfg $(ZEBRA_CONF_DIR)/zebra-authorities-dom.cfg $(ZEBRA_CONF_DIR)/explain-authorities.xml $(ZEBRA_CONF_DIR)/explain-biblios.xml $(ZEBRA_CONF_DIR)/retrieval-info-auth-grs1.xml $(ZEBRA_CONF_DIR)/retrieval-info-auth-dom.xml $(ZEBRA_CONF_DIR)/ccl.properties $(ZEBRA_CONF_DIR)/cql.properties $(ZEBRA_CONF_DIR)/pqf.properties - -SCRIPTS = koha-zebra-ctl.sh koha-pazpar2-ctl.sh koha-index-daemon-ctl.sh -SRC_SCRIPT_DIR = ../misc/bin -TEST_SCRIPT_DIR = run/bin - -SMOLDER_SERVER = 72.232.235.42:8000 -SMOLDER_REPORT_FILENAME = kohatests.txt -SMOLDER_REPORT_TARBALL = kohatests.tar.gz -SMOLDER_PROJECT_NAME = Koha -SMOLDER_SMOKE_SIGNAL = ./smolder_smoke_signal - -all :: - $(NOECHO) $(ECHO) RUNNING THIS MAKEFILE MAY CAUSE LOSS OF DATA - $(NOECHO) $(ECHO) - $(NOECHO) $(ECHO) This makefile is completely beta. - $(NOECHO) $(ECHO) Please read it first and edit the variables at the top. - $(NOECHO) $(ECHO) Then, you can run \'make test\' - -config_file :: $(CONF_FILE_TEMPLATE) test_run_dirs - $(CP) $(CONF_FILE_TEMPLATE) $(TEST_CONF_FILE) - $(PERL) $(TEST_REWRITE_SCRIPT) --file $(TEST_CONF_FILE) - $(PERL) $(REAL_REWRITE_SCRIPT) $(TEST_CONF_FILE) - -zebra_conf_files :: test_run_dirs $(ZEBRA_CONF_FILES) - - -$(ZEBRA_CONF_FILES) :: - $(PERL) $(TEST_REWRITE_SCRIPT) --file $@ - $(PERL) $(REAL_REWRITE_SCRIPT) $@ - -$(SCRIPTS) :: - $(SED) s/--user=\$$USER.\$$GROUP// $(SRC_SCRIPT_DIR)/$@ > $(TEST_SCRIPT_DIR)/$@ - $(PERL) $(TEST_REWRITE_SCRIPT) --file $(TEST_SCRIPT_DIR)/$@ - $(PERL) $(REAL_REWRITE_SCRIPT) $(TEST_SCRIPT_DIR)/$@ - $(CHMOD) 755 $(TEST_SCRIPT_DIR)/$@ - -test :: config_file $(ZEBRA_CONF_FILES) $(SCRIPTS) - KOHA_CONF=$(TEST_CONF_FILE) PERL5LIB=$(PERL5LIB) TEST_CLASS=$(TEST_CLASS) RUN_EXPENSIVE_TESTS=$(RUN_EXPENSIVE_TESTS) \ - $(PROVE) $(PROVE_FLAGS) $(TEST_FILES) - -test-single :: config_file $(ZEBRA_CONF_FILES) $(SCRIPTS) - KOHA_CONF=$(TEST_CONF_FILE) PERL5LIB=$(PERL5LIB) RUN_EXPENSIVE_TESTS=1 SINGLE_TEST=1 \ - $(PROVE) $(PROVE_FLAGS) -Ilib $(TEST_FILES) - -fulltest :: RUN_EXPENSIVE_TESTS = 1 -fulltest :: test - -test_run_dirs :: - $(MKPATH) run/etc - $(CP) -a ../etc/zebradb run/etc - $(MKPATH) run/etc/zebradb/etc - $(MKPATH) run/var/lib/zebradb/biblios/key - $(MKPATH) run/var/lib/zebradb/biblios/register - $(MKPATH) run/var/lib/zebradb/biblios/shadow - $(MKPATH) run/var/lib/zebradb/biblios/tmp - $(MKPATH) run/var/lib/zebradb/authorities/key - $(MKPATH) run/var/lib/zebradb/authorities/register - $(MKPATH) run/var/lib/zebradb/authorities/shadow - $(MKPATH) run/var/lib/zebradb/authorities/tmp - $(MKPATH) run/var/lock/zebradb/biblios - $(MKPATH) run/var/lock/zebradb/authorities - $(MKPATH) run/var/run/zebradb - $(MKPATH) run/var/log/zebradb - $(MKPATH) run/bin - -submit_report :: $(SMOLDER_REPORT_TARBALL) - $(SMOLDER_SMOKE_SIGNAL) --server $(SMOLDER_SERVER) --file $(SMOLDER_REPORT_TARBALL) --project $(SMOLDER_PROJECT_NAME) --anonymous -# $(RM) $(SMOLDER_REPORT_TARBALL) - -submit :: submit_report - -$(SMOLDER_REPORT_TARBALL) :: $(SMOLDER_REPORT_FILENAME) - tar zcvf $(SMOLDER_REPORT_TARBALL) kohatests.txt - $(RM) $(SMOLDER_REPORT_FILENAME) - -$(SMOLDER_REPORT_FILENAME) :: report - -report :: config_file $(ZEBRA_CONF_FILES) $(SCRIPTS) - -KOHA_CONF=$(TEST_CONF_FILE) PERL5LIB=$(PERL5LIB) TEST_CLASS=$(TEST_CLASS) RUN_EXPENSIVE_TESTS=$(RUN_EXPENSIVE_TESTS) \ - $(PERL) $(TEST_FILES) > $(SMOLDER_REPORT_FILENAME) - diff --git a/t/db_dependent/XISBN.t b/t/db_dependent/XISBN.t index a952484..e63bb2a 100755 --- a/t/db_dependent/XISBN.t +++ b/t/db_dependent/XISBN.t @@ -21,9 +21,6 @@ BEGIN { local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /redefined/ }; *C4::Search::SimpleSearch = \&Mock_SimpleSearch; -# KohaTest::clear_test_database(); -# KohaTest::create_test_database(); - my $context = C4::Context->new; my ( $biblionumber_tag, $biblionumber_subfield ) = diff --git a/t/rewrite-config-test.PL b/t/rewrite-config-test.PL deleted file mode 100644 index 06150f0..0000000 --- a/t/rewrite-config-test.PL +++ /dev/null @@ -1,179 +0,0 @@ -# Copyright 2008 LibLime -# -# This file is part of Koha. -# -# Koha is free software; you can redistribute it and/or modify it under the -# terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. -# -# Koha is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR -# A PARTICULAR PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with Koha; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -use strict; -use warnings; - -use Sys::Hostname; -use Socket; -use Getopt::Long; -use Pod::Usage; -use Data::Dumper; - -# These variables get set from command line options -my ( $fname ); -GetOptions( 'file=s', \$fname ) - or pod2usage(); - - -=head1 NAME - -rewrite-test-config.PL - helper for the Koha packager and installer - -=head1 SYNOPSIS - - perl rewrite-test-config.PL configurationfile - -=head1 DESCRIPTION - -This helper script replaces keywords in the -configuration file with value either supplied through -the environment - -I intend to make this part of hte normal make process eventually. - -=head2 KEYWORDS - -The following configuration keywords are available: - -=head1 EXAMPLES - -=cut - -my $configfile = 'test-config.txt'; -my $configuration = read_config_file( $configfile ); - -# Override configuration from the environment -foreach my $key (keys %$configuration) { - if (defined($ENV{$key})) { - $configuration->{$key} = $ENV{$key}; - } -} - -$configuration = add_underscores( $configuration ); -my %configuration = replace_test_params( $configuration ); - -my $file = read_file($fname); -$file =~ s/__.*?__/exists $configuration{$&} ? $configuration{$&} : $&/seg; - -# At this point, file is in 'blib' and by default -# has mode a-w. Therefore, must change permission -# to make it writable. Note that stat and chmod -# (the Perl functions) should work on Win32 -my $old_perm; -$old_perm = (stat $fname)[2] & 07777; -my $new_perm = $old_perm | 0200; -chmod $new_perm, $fname; - -open(OUTPUT,">$fname") || die "Can't open $fname for write: $!"; -print OUTPUT $file; -close(OUTPUT); - -chmod $old_perm, $fname; - -=head2 read_config_file - - takes the filename pointing to the configuration file that the - top-level Makefile wrote - - returns a hashref that contains the configuration determined by - that file. - -=cut - -sub read_config_file { - my $config_file = shift; - if ( not -e $config_file ) { - die "unable to find configuration file: $config_file"; - } - my $config; - if ( open( my $confighandle, '<', $config_file ) ) { - while ( my $line = <$confighandle> ) { - chomp $line; - next if ( $line eq '' ); - next if ( $line =~ /^\s*#/ ); - my ( $var, $value ) = split( /\s*=\s*/, $line ); - $config->{ $var } = $value; - } - } else { - warn "unable to open configuration file: $config_file"; - return; - } - return $config; -} - -=head2 add_underscores - -=cut - -sub add_underscores { - my $config = shift; - - my $newconfig; - foreach my $key ( keys %$config ) { - $newconfig->{ '__' . $key . '__' } = $config->{ $key }; - } - return $newconfig; -} - - -=head2 replace_test_params - -=cut - -sub replace_test_params { - my $config = shift; - - my $testconfig; - foreach my $key ( keys %$config ) { - if ( $key =~ /^__TEST_/ ) { - my $newkey = $key; - $newkey =~ s/^__TEST_/__/; - $testconfig->{ $newkey } = $config->{ $key }; - } - } - # override variables with the "TEST_" variety. - my %newconfig = ( %$config, %$testconfig ); - return %newconfig; -} - -# Idea taken from perlfaq5 -sub read_file { - local(*INPUT,$/); - open(INPUT,$_[0]) || die "Can't open $_[0] for read"; - my $file = ; - return $file; -} - -__END__ - - -=head1 SEE ALSO - -Makefile.PL, ExtUtils::MakeMaker(3) - -=head1 ACKNOWLEDGEMENTS - -based on rewrite-config.PL by MJ Ray. - -=head1 AUTHOR - -Andrew Moore - -=cut - -- 1.7.10.4