This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=b3ccd6e7ed621aa58b3201ee3b9ea250e58c5932 commit b3ccd6e7ed621aa58b3201ee3b9ea250e58c5932 Author: Guillem Jover <[email protected]> AuthorDate: Wed Dec 7 18:26:17 2022 +0100 Test::Dpkg: Refactor OpenPGP requisite into test_needs_openpgp_backend() We will be using this in several tests, refactor to avoid duplication. --- scripts/Test/Dpkg.pm | 17 +++++++++++++++++ scripts/t/Dpkg_OpenPGP.t | 11 +---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/scripts/Test/Dpkg.pm b/scripts/Test/Dpkg.pm index c6e2bcf24..6d3d23dcf 100644 --- a/scripts/Test/Dpkg.pm +++ b/scripts/Test/Dpkg.pm @@ -30,6 +30,7 @@ our @EXPORT_OK = qw( test_needs_author test_needs_module test_needs_command + test_needs_openpgp_backend test_needs_srcdir_switch test_neutralize_checksums ); @@ -38,6 +39,7 @@ our %EXPORT_TAGS = ( test_needs_author test_needs_module test_needs_command + test_needs_openpgp_backend test_needs_srcdir_switch ) ], paths => [ qw( @@ -181,6 +183,21 @@ sub test_needs_command } } +sub test_needs_openpgp_backend +{ + my @backends = qw( + gpg + sq + pgpainless-cli + ); + my @cmds = grep { can_run($_) } @backends; + if (@cmds == 0) { + plan skip_all => "requires >= 1 openpgp command: @backends"; + } + + return @cmds; +} + sub test_needs_srcdir_switch { if (defined $ENV{srcdir}) { diff --git a/scripts/t/Dpkg_OpenPGP.t b/scripts/t/Dpkg_OpenPGP.t index ce05553b6..8c436825d 100644 --- a/scripts/t/Dpkg_OpenPGP.t +++ b/scripts/t/Dpkg_OpenPGP.t @@ -25,22 +25,13 @@ use Dpkg::ErrorHandling; use Dpkg::Path qw(find_command); use Dpkg::OpenPGP::KeyHandle; -my @backend_cmds = qw( - gpg - sq - pgpainless-cli -); my %backend_cmd = ( auto => 'auto', gpg => 'gpg', sq => 'sq', 'pgpainless-cli' => 'sop', ); -my @cmds = grep { find_command($_) } @backend_cmds; -if (@cmds == 0) { - plan skip_all => "requires at least one backend command: @backend_cmds"; -} - +my @cmds = test_needs_openpgp_backend(); unshift @cmds, 'auto'; plan tests => 2 + 15 * scalar @cmds; -- Dpkg.Org's dpkg

