diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-11-06 03:29:34 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-11-09 15:53:42 +0100 |
commit | 1639d972ea0b30711b9a762fe4475cdb2b229be1 (patch) | |
tree | abbbaf84565b729e7b535a21692db39235264a09 /libtests/qtest/rc4.test | |
parent | 127a957aee7bf7ae242a606d035e9e3d9b300307 (diff) | |
download | qpdf-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/rc4.test')
-rw-r--r-- | libtests/qtest/rc4.test | 76 |
1 files changed, 48 insertions, 28 deletions
diff --git a/libtests/qtest/rc4.test b/libtests/qtest/rc4.test index 25a5ab45..e718478b 100644 --- a/libtests/qtest/rc4.test +++ b/libtests/qtest/rc4.test @@ -9,40 +9,60 @@ require TestDriver; my $td = new TestDriver('RC4'); -cleanup(); - +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); +} my @tests = ('0123456789abcdef', - '0123456789abcdef', - '0000000000000000', - 'ef012345', - '0123456789abcdef'); + '0123456789abcdef', + '0000000000000000', + 'ef012345', + '0123456789abcdef'); -my $n = 0; -foreach my $key (@tests) +foreach my $p (@providers) { - ++$n; - $td->runtest("test $n", - {$td->COMMAND => "rc4 $key test$n.in tmp1-$n.out"}, - {$td->STRING => "", $td->EXIT_STATUS => 0}); - $td->runtest("check output", - {$td->FILE => "tmp1-$n.out"}, - {$td->FILE => "test$n.out"}); - $td->runtest("test $n reverse", - {$td->COMMAND => "rc4 $key test$n.out tmp2-$n.out"}, - {$td->STRING => "", $td->EXIT_STATUS => 0}); - $td->runtest("check output", - {$td->FILE => "tmp2-$n.out"}, - {$td->FILE => "test$n.in"}); -} + $ENV{'QPDF_CRYPTO_PROVIDER'} = $p; + + cleanup(); -$td->runtest("other tests", - {$td->COMMAND => "rc4 other"}, - {$td->STRING => "passed\n", $td->EXIT_STATUS => 0}, - $td->NORMALIZE_NEWLINES); + my $n = 0; + foreach my $key (@tests) + { + ++$n; + $td->runtest("test $n ($p)", + {$td->COMMAND => "rc4 $key test$n.in tmp1-$n.out"}, + {$td->STRING => "", $td->EXIT_STATUS => 0}); + $td->runtest("check output", + {$td->FILE => "tmp1-$n.out"}, + {$td->FILE => "test$n.out"}); + $td->runtest("test $n reverse ($p)", + {$td->COMMAND => "rc4 $key test$n.out tmp2-$n.out"}, + {$td->STRING => "", $td->EXIT_STATUS => 0}); + $td->runtest("check output", + {$td->FILE => "tmp2-$n.out"}, + {$td->FILE => "test$n.in"}); + } -cleanup(); + $td->runtest("other tests ($p)", + {$td->COMMAND => "rc4 other"}, + {$td->STRING => "passed\n", $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); + + cleanup(); +} -$td->report(1 + (4 * scalar(@tests))); +$td->report((1 + (4 * scalar(@tests))) * scalar(@providers)); sub cleanup { |