"Fossies" - the Fresh Open Source Software Archive

Member "koha-19.11.15/misc/devel/coverage.pl" (23 Feb 2021, 1628 Bytes) of package /linux/misc/koha-19.11.15.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "coverage.pl" see the Fossies "Dox" file reference documentation.

    1 #!/usr/bin/perl
    2 
    3 # Copyright 2015 BibLibre
    4 #
    5 # This file is part of Koha.
    6 #
    7 # Koha is free software; you can redistribute it and/or modify it under the
    8 # terms of the GNU General Public License as published by the Free Software
    9 # Foundation; either version 3 of the License, or (at your option) any later
   10 # version.
   11 #
   12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
   13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
   14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   15 #
   16 # You should have received a copy of the GNU General Public License along
   17 # with Koha; if not, see <http://www.gnu.org/licenses>.
   18 
   19 =head1 NAME
   20 
   21 coverage.pl
   22 
   23 =head1 SYNOPSIS
   24 
   25     misc/devel/coverage.pl [-h|--help]
   26 
   27 This script must be run from your Koha source tree.
   28 
   29 =head1 DESCRIPTION
   30 
   31 This script runs all Koha tests and generates a coverage report on the
   32 cover_db directory.
   33 
   34 =cut
   35 
   36 =head1 OPTIONS
   37 
   38 =over 8
   39 
   40 =item B<-h|--help>
   41 
   42 prints this help text
   43 
   44 =back
   45 
   46 =cut
   47 
   48 use Modern::Perl;
   49 
   50 use C4::Context;
   51 use Cwd;
   52 use Getopt::Long;
   53 use Pod::Usage;
   54 
   55 my $help;
   56 
   57 GetOptions(
   58     "h|help"      => \$help
   59 );
   60 
   61 pod2usage(1) if defined $help;
   62 
   63 #Die if you are not in your Koha src directory
   64 my $KOHA_PATH = C4::Context->config("intranetdir");
   65 die "ERROR : You are not in Koha src/ directory"
   66   unless $KOHA_PATH eq getcwd;
   67 
   68 # Delete old coverage
   69 system("cover -delete");
   70 
   71 #Start the cover
   72 system("PERL5OPT=-MDevel::Cover /usr/bin/prove -r t/");
   73 
   74 #Create the HTML output
   75 system("cover");
   76 say("file://$KOHA_PATH/cover_db/coverage.html")
   77   unless !-e "$KOHA_PATH/cover_db/coverage.html";
   78 
   79 1;