diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2016-06-13 22:12:47 +0900 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2016-06-13 22:12:47 +0900 |
commit | afcc9d9914bf9a779a95a0fb8520848e54729926 (patch) | |
tree | dfb5c3e643142bd14ef832b96de0c0a2cc918dba /dh_elpa_test | |
parent | a8a5936aafb711489d6420404b559c7b353bda40 (diff) |
fix DH_ELPA_TEST_ERT_EXCLUDE bug
Diffstat (limited to 'dh_elpa_test')
-rwxr-xr-x | dh_elpa_test | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/dh_elpa_test b/dh_elpa_test index b46875e..766cf81 100755 --- a/dh_elpa_test +++ b/dh_elpa_test @@ -95,10 +95,33 @@ 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 Debian::Debhelper::Dh_Lib; use Debian::Control; +# ---- Subroutines + +# like Find::File::Rule::name, but matches the whole path of the file +# (relative to cwd when search was started) against the glob, rather +# than just the basename (also, unlike Find::File::Rule::name, accepts +# a single glob and no regexps since that's all we need here) +sub long_name { + my $glob = shift; + + return sub { + ( undef, undef, my $fullname ) = @_; + + if ( $fullname =~ glob_to_regex($glob) ) { + return 1; + } else { + return 0; + } + } +} + +# ---- Script setup + # This checks whether the debhelper compat is 10 or above. With # debhelper compat below 9, dh_elpa_test will get run more in more # than one sequence, including inside fakeroot, which can cause tests @@ -146,7 +169,7 @@ $rule ->grep( "ert-deftest" ); if (defined $ENV{'DH_ELPA_TEST_ERT_EXCLUDE'}) { foreach my $glob (split(',', $ENV{'DH_ELPA_TEST_ERT_EXCLUDE'})) { - $rule->not_name($glob); + $rule->not_exec( long_name($glob) ); } } my @ert_files = $rule->in('.'); @@ -202,6 +225,7 @@ Here is an example of using the helper in a dh(1) style debian/rules #!/usr/bin/make -f export DH_ELPA_TEST_BUTTERCUP_LOAD_PATH=lib,other_lib + export DH_ELPA_TEST_ERT_EXCLUDE=broken-tests/*.el %: dh $@ --with elpa |