aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/qtest/sha2.test
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-11-06 03:29:34 +0100
committerJay Berkenbilt <ejb@ql.org>2019-11-09 15:53:42 +0100
commit1639d972ea0b30711b9a762fe4475cdb2b229be1 (patch)
treeabbbaf84565b729e7b535a21692db39235264a09 /libtests/qtest/sha2.test
parent127a957aee7bf7ae242a606d035e9e3d9b300307 (diff)
downloadqpdf-1639d972ea0b30711b9a762fe4475cdb2b229be1.tar.zst
Run libtests for crypto with all available providers
If QPDF_CRYPTO_PROVIDER is set, just run the tests for the given provider. This is to support cases of running the entire test suite for each provider. If QPDF_CRYPTO_PROVIDER is not set, run the tests that exercise the cyrpto provider for each available provider.
Diffstat (limited to 'libtests/qtest/sha2.test')
-rw-r--r--libtests/qtest/sha2.test32
1 files changed, 26 insertions, 6 deletions
diff --git a/libtests/qtest/sha2.test b/libtests/qtest/sha2.test
index 34d668f7..432f7157 100644
--- a/libtests/qtest/sha2.test
+++ b/libtests/qtest/sha2.test
@@ -9,10 +9,30 @@ require TestDriver;
my $td = new TestDriver('sha2');
-$td->runtest("sha2",
- {$td->COMMAND => "sha2"},
- {$td->FILE => "sha2.out",
- $td->EXIT_STATUS => 0},
- $td->NORMALIZE_NEWLINES);
+my @providers = ();
+if (exists $ENV{'QPDF_CRYPTO_PROVIDER'})
+{
+ push(@providers, $ENV{'QPDF_CRYPTO_PROVIDER'});
+}
+else
+{
+ open(Q, "qpdf --show-crypto|") or die;
+ while (<Q>)
+ {
+ s/\s+$//s;
+ push(@providers, $_);
+ }
+ close(Q);
+}
+foreach my $p (@providers)
+{
+ $ENV{'QPDF_CRYPTO_PROVIDER'} = $p;
-$td->report(1);
+ $td->runtest("sha2 ($p)",
+ {$td->COMMAND => "sha2"},
+ {$td->FILE => "sha2.out",
+ $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+}
+
+$td->report(scalar(@providers));