diff options
author | Jay Berkenbilt <ejb@ql.org> | 2020-04-06 16:19:37 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2020-04-06 17:23:02 +0200 |
commit | 77198d5310d961ba3605db74fe1d213bb5d19f34 (patch) | |
tree | a92ae4e8056d6a8a5bf284c78460a6112710424e /libtests/qtest/random.test | |
parent | 52749b85df2e25c5ca35d5e0d07fbe4248b6f99b (diff) | |
download | qpdf-77198d5310d961ba3605db74fe1d213bb5d19f34.tar.zst |
Delegate random number generation to crypto provider (fixes #418)
Diffstat (limited to 'libtests/qtest/random.test')
-rw-r--r-- | libtests/qtest/random.test | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/libtests/qtest/random.test b/libtests/qtest/random.test index c3b4b9d7..f757b4a9 100644 --- a/libtests/qtest/random.test +++ b/libtests/qtest/random.test @@ -7,10 +7,30 @@ require TestDriver; my $td = new TestDriver('random'); -$td->runtest("Random Data Providers", - {$td->COMMAND => "random"}, - {$td->STRING => "random: end of tests\n", - $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("Random Data Providers ($p)", + {$td->COMMAND => "random"}, + {$td->STRING => "random: end of tests\n", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); +} + +$td->report(scalar(@providers)); |