From ec3734b6c19d162d44243766c6bcbd7513d5bb80 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Fri, 12 Oct 2012 23:50:07 -0400 Subject: [PATCH] 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 --- Open-ILS/src/perlmods/t/21-perl-critic.t | 23 +++++++++++++++++++++++ Open-ILS/src/perlmods/t/perlcriticrc | 1 + 2 files changed, 24 insertions(+) create mode 100644 Open-ILS/src/perlmods/t/21-perl-critic.t create mode 100644 Open-ILS/src/perlmods/t/perlcriticrc 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 -- 2.11.0