提交 3675fb88 编写于 作者: B Ben Laurie

More progress towards working tests.

上级 3b4d86bf
...@@ -249,10 +249,10 @@ test_rand: $(RANDTEST) ...@@ -249,10 +249,10 @@ test_rand: $(RANDTEST)
test_gost2814789: $(GOST2814789TEST) test_gost2814789: $(GOST2814789TEST)
../util/shlib_wrap.sh ./$(GOST2814789TEST) ../util/shlib_wrap.sh ./$(GOST2814789TEST)
test_enc: ../apps/openssl test_enc: ../apps/openssl testenc
@sh ./testenc @sh ./testenc
test_x509: ../apps/openssl test_x509: ../apps/openssl tx509 testx509.pem v3-cert1.pem v3-cert2.pem
echo test normal x509v1 certificate echo test normal x509v1 certificate
sh ./tx509 2>/dev/null sh ./tx509 2>/dev/null
echo test first x509v3 certificate echo test first x509v3 certificate
...@@ -264,17 +264,17 @@ test_rsa: $(RSATEST)$(EXE_EXT) ../apps/openssl ...@@ -264,17 +264,17 @@ test_rsa: $(RSATEST)$(EXE_EXT) ../apps/openssl
@sh ./trsa 2>/dev/null @sh ./trsa 2>/dev/null
../util/shlib_wrap.sh ./$(RSATEST) ../util/shlib_wrap.sh ./$(RSATEST)
test_crl: ../apps/openssl test_crl: ../apps/openssl tcrl testcrl.pem
@sh ./tcrl 2>/dev/null @sh ./tcrl 2>/dev/null
test_sid: ../apps/openssl test_sid: ../apps/openssl tsid
@sh ./tsid 2>/dev/null @sh ./tsid 2>/dev/null
test_req: ../apps/openssl test_req: ../apps/openssl treq testreq.pem testreq2.pem
@sh ./treq 2>/dev/null @sh ./treq 2>/dev/null
@sh ./treq testreq2.pem 2>/dev/null @sh ./treq testreq2.pem 2>/dev/null
test_pkcs7: ../apps/openssl test_pkcs7: ../apps/openssl tpkcs7 tpkcs7d
@sh ./tpkcs7 2>/dev/null @sh ./tpkcs7 2>/dev/null
@sh ./tpkcs7d 2>/dev/null @sh ./tpkcs7d 2>/dev/null
...@@ -313,12 +313,12 @@ test_dsa: $(DSATEST) ...@@ -313,12 +313,12 @@ test_dsa: $(DSATEST)
../util/shlib_wrap.sh ./$(DSATEST) ../util/shlib_wrap.sh ./$(DSATEST)
../util/shlib_wrap.sh ./$(DSATEST) -app2_1 ../util/shlib_wrap.sh ./$(DSATEST) -app2_1
test_gen: ../apps/openssl testgen test_gen: ../apps/openssl testgen test.cnf
@echo "Generate and verify a certificate request" @echo "Generate and verify a certificate request"
@sh ./testgen @sh ./testgen
test_ss keyU.ss certU.ss certCA.ss certP1.ss keyP1.ss certP2.ss keyP2.ss \ test_ss keyU.ss certU.ss certCA.ss certP1.ss keyP1.ss certP2.ss keyP2.ss \
intP1.ss intP2.ss: testss intP1.ss intP2.ss: testss CAss.cnf Uss.cnf P1ss.cnf P2ss.cnf
@echo "Generate and certify a test certificate" @echo "Generate and certify a test certificate"
@sh ./testss @sh ./testss
@cat certCA.ss certU.ss > intP1.ss @cat certCA.ss certU.ss > intP1.ss
...@@ -336,7 +336,7 @@ test_ssl: keyU.ss certU.ss certCA.ss certP1.ss keyP1.ss certP2.ss keyP2.ss \ ...@@ -336,7 +336,7 @@ test_ssl: keyU.ss certU.ss certCA.ss certP1.ss keyP1.ss certP2.ss keyP2.ss \
@sh ./testsslproxy keyP1.ss certP1.ss intP1.ss @sh ./testsslproxy keyP1.ss certP1.ss intP1.ss
@sh ./testsslproxy keyP2.ss certP2.ss intP2.ss @sh ./testsslproxy keyP2.ss certP2.ss intP2.ss
test_ca: ../apps/openssl test_ca: ../apps/openssl testca CAss.cnf Uss.cnf
@if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then \ @if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then \
echo "skipping CA.sh test -- requires RSA"; \ echo "skipping CA.sh test -- requires RSA"; \
else \ else \
...@@ -348,7 +348,7 @@ test_aes: #$(AESTEST) ...@@ -348,7 +348,7 @@ test_aes: #$(AESTEST)
# @echo "test Rijndael" # @echo "test Rijndael"
# ../util/shlib_wrap.sh ./$(AESTEST) # ../util/shlib_wrap.sh ./$(AESTEST)
test_tsa: ../apps/openssl test_tsa: ../apps/openssl testtsa CAtsa.cnf ../util/shlib_wrap.sh
@if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then \ @if ../util/shlib_wrap.sh ../apps/openssl no-rsa; then \
echo "skipping testtsa test -- requires RSA"; \ echo "skipping testtsa test -- requires RSA"; \
else \ else \
...@@ -375,7 +375,7 @@ test_v3name: $(V3NAMETEST)$(EXE_EXT) ...@@ -375,7 +375,7 @@ test_v3name: $(V3NAMETEST)$(EXE_EXT)
@echo "Test X509v3_check_*" @echo "Test X509v3_check_*"
../util/shlib_wrap.sh ./$(V3NAMETEST) ../util/shlib_wrap.sh ./$(V3NAMETEST)
test_ocsp: ../apps/openssl test_ocsp: ../apps/openssl tocsp
@echo "Test OCSP" @echo "Test OCSP"
@sh ./tocsp @sh ./tocsp
......
...@@ -610,6 +610,7 @@ EOF ...@@ -610,6 +610,7 @@ EOF
} }
$defs= <<"EOF"; $defs= <<"EOF";
# N.B. You MUST use -j on FreeBSD.
# This makefile has been automatically generated from the OpenSSL distribution. # This makefile has been automatically generated from the OpenSSL distribution.
# This single makefile will build the complete OpenSSL distribution and # This single makefile will build the complete OpenSSL distribution and
# by default leave the 'intertesting' output files in .${o}out and the stuff # by default leave the 'intertesting' output files in .${o}out and the stuff
...@@ -754,7 +755,7 @@ $banner ...@@ -754,7 +755,7 @@ $banner
# This needs to be invoked once, when the makefile is first constructed, or # This needs to be invoked once, when the makefile is first constructed, or
# after cleaning. # after cleaning.
init: \$(TMP_D) \$(LIB_D) headers init: \$(TMP_D) \$(LIB_D) \$(INC_D) \$(INCO_D) \$(BIN_D) \$(TEST_D) headers
headers: \$(HEADER) \$(EXHEADER) headers: \$(HEADER) \$(EXHEADER)
...@@ -1371,7 +1372,8 @@ sub do_copy_rule ...@@ -1371,7 +1372,8 @@ sub do_copy_rule
if ($n =~ /bss_file/) if ($n =~ /bss_file/)
{ $pp=".c"; } { $pp=".c"; }
else { $pp=$p; } else { $pp=$p; }
$ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp $to\n\t\$(PERL) \$(SRC_D)${o}util${o}copy-if-different.pl \"\$(SRC_D)$o$_$pp\" \"$to${o}$n$pp\"\n\n"; # $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(PERL) \$(SRC_D)${o}util${o}copy-if-different.pl \"\$(SRC_D)$o$_$pp\" \"$to${o}$n$pp\"\n\n";
$ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \"\$(SRC_D)$o$_$pp\" \"$to${o}$n$pp\"\n\n";
} }
return($ret); return($ret);
} }
......
...@@ -211,26 +211,48 @@ sub fixrules ...@@ -211,26 +211,48 @@ sub fixrules
{ {
my ($str) = @_; my ($str) = @_;
# Compatible with -j...
$str =~ s/^(\s+@?)/$1cd \$(TEST_D) && /;
return $str; return $str;
# Compatible with not -j.
my @t = split("\n", $str); my @t = split("\n", $str);
$str = ''; $str = '';
my $prev;
foreach my $t (@t) foreach my $t (@t)
{ {
$t =~ s/^\s+//; $t =~ s/^\s+//;
if ($t =~ /^@/) if (!$prev)
{ {
$t =~ s/^@/\@cd \$(TEST_D) && /; if ($t =~ /^@/)
} {
else $t =~ s/^@/\@cd \$(TEST_D) && /;
{ }
$t = 'cd $(TEST_D) && ' . $t; elsif ($t !~ /^\s*#/)
{
$t = 'cd $(TEST_D) && ' . $t;
}
} }
$str .= "\t$t\n"; $str .= "\t$t\n";
$prev = $t =~/\\$/;
} }
return $str; return $str;
} }
sub copy_scripts
{
my ($src, @targets) = @_;
my $s = '';
foreach my $t (@targets)
{
# Copy first so we get file modes...
$s .= "\$(TEST_D)/$t: \$(SRC_D)/$src/$t\n\tcp \$(SRC_D)/$src/$t \$(TEST_D)/$t\n\tsed -e 's/\\.\\.\\/apps/..\\/\$(OUT_D)/' -e 's/\\.\\.\\/util/..\\/\$(TEST_D)/' < \$(SRC_D)/$src/$t > \$(TEST_D)/$t\n\n";
}
return $s;
}
sub get_tests sub get_tests
{ {
my ($makefile) = @_; my ($makefile) = @_;
...@@ -308,21 +330,61 @@ sub get_tests ...@@ -308,21 +330,61 @@ sub get_tests
my $d = $deps{$t}; my $d = $deps{$t};
$d =~ s/\.\.\/apps/\$(BIN_D)/g; $d =~ s/\.\.\/apps/\$(BIN_D)/g;
$d =~ s/\.\.\/util/\$(TEST_D)/g;
$d = fixtests($d, \%tests); $d = fixtests($d, \%tests);
$d = fixdeps($d); $d = fixdeps($d);
my $r = $targets{$t}; my $r = $targets{$t};
$r =~ s/\.\.\/apps/\$(BIN_D)/g; $r =~ s/\.\.\/apps/..\/\$(BIN_D)/g;
$r =~ s/\.\.\/util/..\/\$(TEST_D)/g;
$r =~ s/\.\.\/(\S+)/\$(SRC_D)\/$1/g; $r =~ s/\.\.\/(\S+)/\$(SRC_D)\/$1/g;
$r = fixrules($r); $r = fixrules($r);
$each .= "$t: \$(TEST_D) $d\n\tcd \$(TEST_D)\n$r\n"; $each .= "$t: test_scripts $d\n$r\n";
} }
# FIXME: Might be a clever way to figure out what needs copying # FIXME: Might be a clever way to figure out what needs copying
my $copies = do_copy_rule('$(TEST_D)', 'test/bctest test/evptests.txt test/testgen test/cms-test.pl', ''); my @copies = ( 'bctest',
'evptests.txt',
return "$copies\n$tests\n$all\n\n$each"; 'testgen',
'cms-test.pl',
'tx509',
'test.cnf',
'testenc',
'tocsp',
'testca',
'CAss.cnf',
'testtsa',
'CAtsa.cnf',
'Uss.cnf',
'P1ss.cnf',
'P2ss.cnf',
'tcrl',
'tsid',
'treq',
'tpkcs7',
'tpkcs7d',
'testcrl.pem',
'testx509.pem',
'v3-cert1.pem',
'v3-cert2.pem',
'testreq2.pem',
);
my $copies = copy_scripts('test', @copies);
my @utils = ( 'shlib_wrap.sh',
'opensslwrap.sh',
);
$copies .= copy_scripts('util', @utils);
my @apps = ( 'CA.sh',
'openssl.cnf',
);
$copies .= copy_scripts('apps', @apps);
$scripts = "test_scripts: \$(TEST_D)/CA.sh \$(TEST_D)/opensslwrap.sh \$(TEST_D)/openssl.cnf\n";
return "$scripts\n$copies\n$tests\n$all\n\n$each";
} }
1; 1;
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册