提交 c5fc6754 编写于 作者: D Dr. David von Oheimb

Move CMP CLI test output files to BLDTOP/test-runs/test_cmp_cli/

Reviewed-by: NTomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12934)
上级 bd60ac48
...@@ -14,7 +14,7 @@ use warnings; ...@@ -14,7 +14,7 @@ use warnings;
use POSIX; use POSIX;
use File::Spec::Functions qw/catfile/; use File::Spec::Functions qw/catfile/;
use File::Compare qw/compare_text/; use File::Compare qw/compare_text/;
use OpenSSL::Test qw/:DEFAULT with data_file data_dir srctop_dir bldtop_dir/; use OpenSSL::Test qw/:DEFAULT with data_file data_dir srctop_dir bldtop_dir result_dir result_file/;
use OpenSSL::Test::Utils; use OpenSSL::Test::Utils;
use Data::Dumper; # for debugging purposes only use Data::Dumper; # for debugging purposes only
...@@ -64,13 +64,12 @@ my @cmp_basic_tests = ( ...@@ -64,13 +64,12 @@ my @cmp_basic_tests = (
[ "bad int: out of range", [ "-config", '""', "-days", "2147483648" ], 1 ], [ "bad int: out of range", [ "-config", '""', "-days", "2147483648" ], 1 ],
); );
my $rsp_cert = "signer_only.crt";
my $outfile = "test.certout.pem";
my $secret = "pass:test";
# this uses the mock server directly in the cmp app, without TCP # this uses the mock server directly in the cmp app, without TCP
sub use_mock_srv_internally sub use_mock_srv_internally
{ {
my $secret = "pass:test";
my $rsp_cert = "signer_only.crt";
my $outfile = result_file("test.certout.pem");
ok(run(cmd([bldtop_dir($app), ok(run(cmd([bldtop_dir($app),
"-config", '""', "-config", '""',
"-use_mock_srv", "-srv_ref", "mock server", "-use_mock_srv", "-srv_ref", "mock server",
...@@ -84,7 +83,7 @@ sub use_mock_srv_internally ...@@ -84,7 +83,7 @@ sub use_mock_srv_internally
"-recipient", "/O=openssl_cmp", # if given must be consistent with sender "-recipient", "/O=openssl_cmp", # if given must be consistent with sender
"-secret", $secret, "-secret", $secret,
"-ref", "client under test", "-ref", "client under test",
"-certout" , $outfile])) "-certout", $outfile]))
&& compare_text($outfile, $rsp_cert) == 0, && compare_text($outfile, $rsp_cert) == 0,
"CMP app with -use_mock_srv and -poll_count 1"); "CMP app with -use_mock_srv and -poll_count 1");
# not unlinking $outfile # not unlinking $outfile
...@@ -200,9 +199,18 @@ sub test_cmp_cli_aspect { ...@@ -200,9 +199,18 @@ sub test_cmp_cli_aspect {
} }
} }
}; };
# not unlinking test.certout_*.pem, test.cacerts.pem, and test.extracerts.pem # not unlinking test.certout*.pem, test.cacerts.pem, and test.extracerts.pem
} }
# The input files for the tests done here dynamically depend on the test server
# selected (where the Mock server used by default is just one possibility).
# On the other hand the main test configuration file test.cnf, which references
# several server-dependent input files by relative file names, is static.
# Moreover the tests use much greater variety of input files than output files.
# Therefore we chose the current directory as a subdirectory of $SRCTOP and it
# was simpler to prepend the output file names by BLDTOP than doing the tests
# from $BLDTOP/test-runs/test_cmp_cli and prepending the input files by SRCTOP.
indir data_dir() => sub { indir data_dir() => sub {
plan tests => 1 + @server_configurations * @all_aspects plan tests => 1 + @server_configurations * @all_aspects
+ (grep(/^Mock$/, @server_configurations) + (grep(/^Mock$/, @server_configurations)
...@@ -248,6 +256,7 @@ sub load_tests { ...@@ -248,6 +256,7 @@ sub load_tests {
my $aspect = shift; my $aspect = shift;
my $test_config = $ENV{OPENSSL_CMP_CONFIG} // "$server_name/test.cnf"; my $test_config = $ENV{OPENSSL_CMP_CONFIG} // "$server_name/test.cnf";
my $file = data_file("test_$aspect.csv"); my $file = data_file("test_$aspect.csv");
my $result_dir = result_dir();
my @result; my @result;
open(my $data, '<', $file) || die "Cannot open $file for reading: $!"; open(my $data, '<', $file) || die "Cannot open $file for reading: $!";
...@@ -266,6 +275,7 @@ sub load_tests { ...@@ -266,6 +275,7 @@ sub load_tests {
$line =~ s{_PBM_PORT}{$pbm_port}g; $line =~ s{_PBM_PORT}{$pbm_port}g;
$line =~ s{_PBM_REF}{$pbm_ref}g; $line =~ s{_PBM_REF}{$pbm_ref}g;
$line =~ s{_PBM_SECRET}{$pbm_secret}g; $line =~ s{_PBM_SECRET}{$pbm_secret}g;
$line =~ s{_RESULT_DIR}{$result_dir}g;
next LOOP if $server_tls == 0 && $line =~ m/,\s*-tls_used\s*,/; next LOOP if $server_tls == 0 && $line =~ m/,\s*-tls_used\s*,/;
my $noproxy = $no_proxy; my $noproxy = $no_proxy;
...@@ -280,6 +290,7 @@ sub load_tests { ...@@ -280,6 +290,7 @@ sub load_tests {
} else { } else {
$line =~ s{-section,,}{-section,,-proxy,$proxy,}; $line =~ s{-section,,}{-section,,-proxy,$proxy,};
} }
$line =~ s{-section,,}{-section,,-certout,$result_dir/test.cert.pem,};
$line =~ s{-section,,}{-config,../$test_config,-section,$server_name $aspect,}; $line =~ s{-section,,}{-config,../$test_config,-section,$server_name $aspect,};
my @fields = grep /\S/, split ",", $line; my @fields = grep /\S/, split ",", $line;
......
...@@ -6,7 +6,7 @@ newkey = new.key ...@@ -6,7 +6,7 @@ newkey = new.key
newkeypass = newkeypass =
cmd = ir cmd = ir
out_trusted = root.crt out_trusted = root.crt
certout = test.cert.pem #certout = test.cert.pem
policies = certificatePolicies policies = certificatePolicies
#policy_oids = 1.2.3.4 #policy_oids = 1.2.3.4
#policy_oids_critical = 1 #policy_oids_critical = 1
......
...@@ -9,38 +9,38 @@ expected,description, -section,val, -cmd,val,val2, -cacertsout,val,val2, -infoty ...@@ -9,38 +9,38 @@ expected,description, -section,val, -cmd,val,val2, -cacertsout,val,val2, -infoty
1,cmd incomplete, -section,, -cmd,i,,BLANK,,,BLANK,,,BLANK,,BLANK, 1,cmd incomplete, -section,, -cmd,i,,BLANK,,,BLANK,,,BLANK,,BLANK,
,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,
0,no cacertsout, -section,, -cmd,ir,,BLANK,,,BLANK,,,BLANK,,BLANK, 0,no cacertsout, -section,, -cmd,ir,,BLANK,,,BLANK,,,BLANK,,BLANK,
0,cacertsout given, -section,, -cmd,ir,, -cacertsout,test.cacerts.pem,,BLANK,,,BLANK,,BLANK, 0,cacertsout given, -section,, -cmd,ir,, -cacertsout,_RESULT_DIR/test.cacerts.pem,,BLANK,,,BLANK,,BLANK,
1,cacertsout missing arg, -section,, -cmd,ir,, -cacertsout,,,BLANK,,,BLANK,,BLANK, 1,cacertsout missing arg, -section,, -cmd,ir,, -cacertsout,,,BLANK,,,BLANK,,BLANK,
,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,
0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK, 0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK,
0,revreason unspecified, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,0 0,revreason unspecified, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,0
0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK, 0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK,
0,revreason keyCompromise, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,1 0,revreason keyCompromise, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,1
0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK, 0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK,
0,revreason CACompromise, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,2 0,revreason CACompromise, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,2
0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK, 0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK,
0,revreason affiliationChanged, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,3 0,revreason affiliationChanged, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,3
0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK, 0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK,
0,revreason superseded, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,4 0,revreason superseded, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,4
0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK, 0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK,
0,revreason cessationOfOperation, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,5 0,revreason cessationOfOperation, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,5
0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK, 0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK,
0,revreason certificateHold, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,6 0,revreason certificateHold, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,6
0,revreason removeFromCRL, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,8 0,revreason removeFromCRL, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,8
1,revreason 7 (invalid), -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,7 1,revreason 7 (invalid), -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,7
0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK, 0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK,
0,revreason priviligeWithdrawn, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,9 0,revreason priviligeWithdrawn, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,9
0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK, 0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK,
0,revreason AACompromise, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,10 0,revreason AACompromise, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,10
0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK, 0, --- get certificate for revocation ----, -section,, -cmd,cr,,BLANK,,,BLANK,,,BLANK,,BLANK,
1,without oldcert, -section,, -cmd,rr,,BLANK,,,BLANK,,,BLANK,,BLANK, 1,without oldcert, -section,, -cmd,rr,,BLANK,,,BLANK,,,BLANK,,BLANK,
1,oldcert is directory, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,dir/,BLANK, 1,oldcert is directory, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,dir/,BLANK,
1,oldcert file nonexistent, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,idontexist,BLANK, 1,oldcert file nonexistent, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,idontexist,BLANK,
1,empty oldcert file, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,empty.txt,BLANK, 1,empty oldcert file, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,empty.txt,BLANK,
1,oldcert and key do not match, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,trusted.crt, -revreason,0 1,oldcert and key do not match, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,trusted.crt, -revreason,0
1,revreason 11 (invalid), -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,11 1,revreason 11 (invalid), -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,11
1,revreason string, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,abc 1,revreason string, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,abc
1,revreason out of integer range, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,test.cert.pem, -revreason,010000000000000000000 1,revreason out of integer range, -section,, -cmd,rr,,BLANK,,,BLANK,,, -oldcert,_RESULT_DIR/test.cert.pem, -revreason,010000000000000000000
,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,
0,ir + infotype, -section,, -cmd,ir,,BLANK,,, -infotype,signKeyPairTypes,,BLANK,,BLANK, 0,ir + infotype, -section,, -cmd,ir,,BLANK,,, -infotype,signKeyPairTypes,,BLANK,,BLANK,
1,genm with missing infotype value, -section,, -cmd,genm,,BLANK,,, -infotype,,,BLANK,,BLANK, 1,genm with missing infotype value, -section,, -cmd,genm,,BLANK,,, -infotype,,,BLANK,,BLANK,
......
...@@ -45,7 +45,7 @@ expected,description, -section,val, -recipient,val, -expect_sender,val, -srvcert ...@@ -45,7 +45,7 @@ expected,description, -section,val, -recipient,val, -expect_sender,val, -srvcert
0,no unprotected errors - no errors, -section,, -recipient,_CA_DN,BLANK,,BLANK,, -trusted,trusted.crt,BLANK,,BLANK,BLANK,BLANK,,,,,,,, 0,no unprotected errors - no errors, -section,, -recipient,_CA_DN,BLANK,,BLANK,, -trusted,trusted.crt,BLANK,,BLANK,BLANK,BLANK,,,,,,,,
1,unprotected_errors with parameter, -section,, -recipient,_CA_DN,BLANK,,BLANK,, -trusted,trusted.crt,BLANK,,BLANK,BLANK,BLANK,,, -unprotected_errors,123,,,, 1,unprotected_errors with parameter, -section,, -recipient,_CA_DN,BLANK,,BLANK,, -trusted,trusted.crt,BLANK,,BLANK,BLANK,BLANK,,, -unprotected_errors,123,,,,
,,,,,,,,,,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,,,,,,,,,,
0,extracertsout, -section,, -recipient,_CA_DN,BLANK,,BLANK,, -trusted,trusted.crt,BLANK,,BLANK, -unprotected_errors, -extracertsout,test.extracerts.pem,,,,,,, 0,extracertsout, -section,, -recipient,_CA_DN,BLANK,,BLANK,, -trusted,trusted.crt,BLANK,,BLANK, -unprotected_errors, -extracertsout,_RESULT_DIR/test.extracerts.pem,,,,,,,
1,extracertsout no parameter, -section,, -recipient,_CA_DN,BLANK,,BLANK,, -trusted,trusted.crt,BLANK,,BLANK, -unprotected_errors, -extracertsout,,,,,,,, 1,extracertsout no parameter, -section,, -recipient,_CA_DN,BLANK,,BLANK,, -trusted,trusted.crt,BLANK,,BLANK, -unprotected_errors, -extracertsout,,,,,,,,
1,extracertsout directory, -section,, -recipient,_CA_DN,BLANK,,BLANK,, -trusted,trusted.crt,BLANK,,BLANK, -unprotected_errors, -extracertsout,directory/,,,,,,, 1,extracertsout directory, -section,, -recipient,_CA_DN,BLANK,,BLANK,, -trusted,trusted.crt,BLANK,,BLANK, -unprotected_errors, -extracertsout,directory/,,,,,,,
1,extracertsout multiple arguments, -section,, -recipient,_CA_DN,BLANK,,BLANK,, -trusted,trusted.crt,BLANK,,BLANK, -unprotected_errors, -extracertsout,abc,def,,,,,, 1,extracertsout multiple arguments, -section,, -recipient,_CA_DN,BLANK,,BLANK,, -trusted,trusted.crt,BLANK,,BLANK, -unprotected_errors, -extracertsout,abc,def,,,,,,
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册