diff options
Diffstat (limited to 'dh_elpa_test')
-rwxr-xr-x | dh_elpa_test | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/dh_elpa_test b/dh_elpa_test index 766cf81..254cfb9 100755 --- a/dh_elpa_test +++ b/dh_elpa_test @@ -96,6 +96,7 @@ B<dh_elpa_test> invokes Emacs to run ERT tests. use File::Find::Rule; use Array::Utils qw{ array_minus }; use Text::Glob qw{ glob_to_regex }; +use Config::Tiny; use Debian::Debhelper::Dh_Lib; use Debian::Control; @@ -133,6 +134,30 @@ if ( get_buildoption("nocheck") || compat(9) ) { my $control = Debian::Control->new(); $control->read("debian/control"); +# note that we don't need package.elpa-test since we are testing all +# lisp we can find in the *source* package +my $options = Config::Tiny->new; +if ( -f "debian/elpa-test") { + verbose_print("I: Ignoring DH_ELPA_TEST_* envvars since debian/elpa-test exists"); + $options = Config::Tiny->read( "debian/elpa-test" ); +} else { + my @envvars = ("DH_ELPA_TEST_DISABLE", + "DH_ELPA_TEST_BUTTERCUP_LOAD_PATH", + "DH_ELPA_TEST_BUTTERCUP_PATTERNS", + "DH_ELPA_TEST_ERT_EXCLUDE", + "DH_ELPA_TEST_ERT_HELPER", + "DH_ELPA_TEST_ERT_EVAL", + "DH_ELPA_TEST_ERT_LOAD_PATH" + ); + foreach my $envvar ( @envvars ) { + if (defined $ENV{$envvar}) { + my $short = lc(substr($envvar, 13)); + print "W: environment variable $envvar is deprecated; see dh_elpa_test(1)\n"; + $options->{_}->{$short} = $ENV{$envvar}; + } + } +} + # these are from dh_elpa # TODO have dh_elpa export them so we can import them, instead of copy/paste my $dhelpadir="/usr/share/emacs/site-lisp/elpa"; @@ -142,13 +167,13 @@ my $elpadir="/usr/share/emacs/site-lisp/elpa-src"; if ($control->source->Build_Depends->has( "elpa-buttercup" )) { my @args = qw{ buttercup -L . }; - if (defined $ENV{'DH_ELPA_TEST_BUTTERCUP_LOAD_PATH'}) { - foreach my $dir (split(',', $ENV{'DH_ELPA_TEST_BUTTERCUP_LOAD_PATH'})) { + if (defined $options->{_}->{'buttercup_load_path'}) { + foreach my $dir (split(',', $options->{_}->{'buttercup_load_path'})) { push @args, ('-L', "$dir"); } } - if (defined $ENV{'DH_ELPA_TEST_BUTTERCUP_PATTERNS'}) { - foreach my $pattern (split(',', $ENV{'DH_ELPA_TEST_BUTTERCUP_PATTERNS'})) { + if (defined $options->{_}->{'buttercup_patterns'}) { + foreach my $pattern (split(',', $options->{_}->{'buttercup_patterns'})) { push @args, ('-p', "$pattern"); } } @@ -167,8 +192,8 @@ $rule ->file() ->name( '*.el' ) ->grep( "ert-deftest" ); -if (defined $ENV{'DH_ELPA_TEST_ERT_EXCLUDE'}) { - foreach my $glob (split(',', $ENV{'DH_ELPA_TEST_ERT_EXCLUDE'})) { +if (defined $options->{_}->{'ert_exclude'}) { + foreach my $glob (split(',', $options->{_}->{'ert_exclude'})) { $rule->not_exec( long_name($glob) ); } } @@ -188,8 +213,8 @@ if (@ert_files) { if ($control->source->Build_Depends->has( "dash-el" )); # add the user's load-path entries - if (defined $ENV{'DH_ELPA_TEST_ERT_LOAD_PATH'}) { - foreach my $dir (split(',', $ENV{'DH_ELPA_TEST_ERT_LOAD_PATH'})) { + if (defined $options->{_}->{'ert_load_path'}) { + foreach my $dir (split(',', $options->{_}->{'ert_load_path'})) { push @args, ('-L', "$dir"); } } @@ -202,13 +227,13 @@ if (@ert_files) { # TODO maybe we should just add all dirs containing files in @ert_files? # now finish adding the user's stuff - push @args, ("--eval", "$ENV{'DH_ELPA_TEST_ERT_EVAL'}") - if (defined $ENV{'DH_ELPA_TEST_ERT_EVAL'}); + push @args, ("--eval", $options->{_}->{'ert_eval'}) + if (defined $options->{_}->{'ert_eval'}); foreach my $ert_file (@ert_files) { push @args, ("-l", "$ert_file"); } - if (defined $ENV{'DH_ELPA_TEST_ERT_HELPER'}) { - push @args, ("-l", "$ENV{'DH_ELPA_TEST_ERT_HELPER'}"); + if (defined $options->{_}->{'ert_helper'}) { + push @args, ("-l", $options->{_}->{'ert_helper'}); } else { push @args, ("--eval", "(ert-run-tests-batch-and-exit)"); } |