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=1109fdfd00d3881ee0adcffdc66095a540b08ee4

commit 1109fdfd00d3881ee0adcffdc66095a540b08ee4
Author: Guillem Jover <[email protected]>
AuthorDate: Thu Feb 6 10:36:42 2025 +0100

    test: Add OpenPGP cmdv testing support
    
    List the cmdv programs to use for each backend, and generate
    combinations to test for with cmd and cmdv.
---
 scripts/Test/Dpkg.pm     | 29 ++++++++++++++++++++++++++---
 scripts/t/Dpkg_OpenPGP.t | 15 ++++++++++-----
 2 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/scripts/Test/Dpkg.pm b/scripts/Test/Dpkg.pm
index 470bb3025..07fee4d94 100644
--- a/scripts/Test/Dpkg.pm
+++ b/scripts/Test/Dpkg.pm
@@ -201,30 +201,37 @@ my @openpgp_backends = (
     {
         backend => 'gpg',
         cmd => 'gpg-sq',
+        cmdv => 'gpgv-sq',
     },
     {
         backend => 'gpg',
         cmd => 'gpg',
+        cmdv => 'gpgv',
     },
     {
         backend => 'sq',
         cmd => 'sq',
+        cmdv => 'none',
     },
     {
         backend => 'sop',
         cmd => 'sqop',
+        cmdv => 'none',
     },
     {
         backend => 'sop',
         cmd => 'rsop',
+        cmdv => 'none',
     },
     {
         backend => 'sop',
         cmd => 'gosop',
+        cmdv => 'none',
     },
     {
         backend => 'sop',
         cmd => 'pgpainless-cli',
+        cmdv => 'none',
     },
 );
 
@@ -234,23 +241,39 @@ sub test_needs_openpgp_backend
     foreach my $backend (@openpgp_backends) {
         my $name = $backend->{backend};
         my $cmd = $backend->{cmd};
+        my $cmdv = $backend->{cmdv};
 
         my $have_cmd = $cmd eq 'none' ? 0 : can_run($cmd);
+        my $have_cmdv = $cmdv eq 'none' ? 0 : can_run($cmdv);
 
-        next unless $have_cmd;
+        next unless ($have_cmd || $have_cmdv);
 
         my $have_backend = {
             backend => $name,
         };
         $have_backend->{cmd} = $cmd if $have_cmd;
+        $have_backend->{cmdv} = $cmdv if $have_cmdv;
 
         push @have_backends, $have_backend;
+
+        if ($have_cmd && $have_cmdv) {
+            push @have_backends, {
+                backend => $name,
+                cmd => $cmd,
+                cmdv => 'none',
+            };
+            push @have_backends, {
+                backend => $name,
+                cmd => 'none',
+                cmdv => $cmdv,
+            };
+        }
     }
     if (@have_backends == 0) {
         my @cmds = grep {
-            defined
+            $_ ne 'none'
         } map {
-            $_->{cmd}
+            ( $_->{cmd}, $_->{cmdv} )
         } @openpgp_backends;
         plan skip_all => "requires >= 1 openpgp command: @cmds";
     }
diff --git a/scripts/t/Dpkg_OpenPGP.t b/scripts/t/Dpkg_OpenPGP.t
index 506984ee0..01d87a09f 100644
--- a/scripts/t/Dpkg_OpenPGP.t
+++ b/scripts/t/Dpkg_OpenPGP.t
@@ -29,6 +29,7 @@ my @backends = test_needs_openpgp_backend();
 unshift @backends, {
     backend => 'auto',
     cmd => 'auto',
+    cmdv => 'auto',
 };
 
 plan tests => 2 + 15 * scalar @backends;
@@ -55,12 +56,16 @@ foreach my $backend_opts (@backends) {
 
     my $backend = $backend_opts->{backend};
     my $cmd = $backend_opts->{cmd} || 'none';
+    my $cmdv = $backend_opts->{cmdv} || $cmd;
+    if ($cmd ne 'none' && $cmdv eq 'none') {
+        $cmdv = $cmd;
+    }
     my $openpgp = Dpkg::OpenPGP->new(%{$backend_opts});
 
     my $certfile = "$datadir/dpkg-test-pub.asc";
     my $keyfile  = "$datadir/dpkg-test-sec.asc";
 
-    note("openpgp backend=$backend cmd=$cmd");
+    note("openpgp backend=$backend cmd=$cmd cmdv=$cmdv");
 
     SKIP: {
         skip 'missing backend command', 9
@@ -93,14 +98,14 @@ foreach my $backend_opts (@backends) {
             unless $openpgp->{backend}->has_verify_cmd();
 
         ok($openpgp->inline_verify("$datadir/sign-file-inline.asc", undef, 
$certfile) == OPENPGP_OK(),
-            "($backend:$cmd) verify OpenPGP ASCII Armor inline signature");
+            "($backend:$cmdv) verify OpenPGP ASCII Armor inline signature");
         ok($openpgp->inline_verify("$datadir/sign-file-inline.sig", undef, 
$certfile) == OPENPGP_OK(),
-            "($backend:$cmd) verify OpenPGP binary inline signature");
+            "($backend:$cmdv) verify OpenPGP binary inline signature");
 
         ok($openpgp->verify("$datadir/sign-file", "$datadir/sign-file.asc", 
$certfile) == OPENPGP_OK(),
-        "($backend:$cmd) verify OpenPGP ASCII Armor detached signature");
+            "($backend:$cmdv) verify OpenPGP ASCII Armor detached signature");
         ok($openpgp->verify("$datadir/sign-file", "$datadir/sign-file.sig", 
$certfile) == OPENPGP_OK(),
-            "($backend:$cmd) verify OpenPGP binary detached signature");
+            "($backend:$cmdv) verify OpenPGP binary detached signature");
     };
 
     my $key = Dpkg::OpenPGP::KeyHandle->new(

-- 
Dpkg.Org's dpkg

Reply via email to