2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-16 09:37:08 +00:00
qpdf/libtests/qtest/sha2.test
Jay Berkenbilt 1639d972ea 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.
2019-11-09 09:53:42 -05:00

39 lines
744 B
Perl

#!/usr/bin/env perl
require 5.008;
BEGIN { $^W = 1; }
use strict;
chdir("sha2") or die "chdir testdir failed: $!\n";
require TestDriver;
my $td = new TestDriver('sha2');
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->runtest("sha2 ($p)",
{$td->COMMAND => "sha2"},
{$td->FILE => "sha2.out",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
}
$td->report(scalar(@providers));