From: Dan Scott Date: Sat, 13 Oct 2012 03:50:07 +0000 (-0400) Subject: Add Perl-Critic-Progressive unit test X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1b1d88070d540477843027c5c15d6422e4dfbce7;p=working%2FEvergreen.git Add Perl-Critic-Progressive unit test This runs Perl::Critic at the 'gentle' level, recording the results in the $HOME/evergreen directory. Each subsequent commit is checked against the previous results; if the number of Perl::Critic violations increases, then the test fails ... and the committer gets to clean things up :) Signed-off-by: Dan Scott --- diff --git a/Open-ILS/src/perlmods/t/21-perl-critic.t b/Open-ILS/src/perlmods/t/21-perl-critic.t new file mode 100644 index 0000000000..188d94d636 --- /dev/null +++ b/Open-ILS/src/perlmods/t/21-perl-critic.t @@ -0,0 +1,23 @@ +use strict; +use warnings; +use File::Spec; +use Test::More; + +eval { require Test::Perl::Critic::Progressive }; +plan skip_all => 'T::P::C::Progressive required for this test' if $@; + +my ($vol, $dir, $file) = File::Spec->splitpath(__FILE__); + +# History needs to be stored somewhere that will persist between +# runs. In a CI environment, the source directory is likely to be +# purged between runs - so pollute the user's home directory instead. +my $history = $ENV{HOME} . '/.evergreen-tests'; +my $history_file = "$history/perlcritic-history"; + +use Test::Perl::Critic::Progressive ( ':all' ); +set_critic_args(-profile => "$dir/../t/perlcriticrc"); +if (!-d $history) { + `mkdir $history`; +} +set_history_file($history_file); +progressive_critic_ok("$dir/.."); diff --git a/Open-ILS/src/perlmods/t/perlcriticrc b/Open-ILS/src/perlmods/t/perlcriticrc new file mode 100644 index 0000000000..2c3506daac --- /dev/null +++ b/Open-ILS/src/perlmods/t/perlcriticrc @@ -0,0 +1 @@ +severity = gentle