diff --git a/test/Makefile b/test/Makefile index 6c68282d5450a086edf7398ebb3966cbdb659b90..9a4cabcc8bdc8f1cfff35a4dc3933eeb8f81ca98 100644 --- a/test/Makefile +++ b/test/Makefile @@ -249,10 +249,10 @@ test_rand: $(RANDTEST) test_gost2814789: $(GOST2814789TEST) ../util/shlib_wrap.sh ./$(GOST2814789TEST) -test_enc: ../apps/openssl +test_enc: ../apps/openssl 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 sh ./tx509 2>/dev/null echo test first x509v3 certificate @@ -264,17 +264,17 @@ test_rsa: $(RSATEST)$(EXE_EXT) ../apps/openssl @sh ./trsa 2>/dev/null ../util/shlib_wrap.sh ./$(RSATEST) -test_crl: ../apps/openssl +test_crl: ../apps/openssl tcrl testcrl.pem @sh ./tcrl 2>/dev/null -test_sid: ../apps/openssl +test_sid: ../apps/openssl tsid @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 testreq2.pem 2>/dev/null -test_pkcs7: ../apps/openssl +test_pkcs7: ../apps/openssl tpkcs7 tpkcs7d @sh ./tpkcs7 2>/dev/null @sh ./tpkcs7d 2>/dev/null @@ -313,12 +313,12 @@ test_dsa: $(DSATEST) ../util/shlib_wrap.sh ./$(DSATEST) ../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" @sh ./testgen 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" @sh ./testss @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 \ @sh ./testsslproxy keyP1.ss certP1.ss intP1.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 \ echo "skipping CA.sh test -- requires RSA"; \ else \ @@ -348,7 +348,7 @@ test_aes: #$(AESTEST) # @echo "test Rijndael" # ../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 \ echo "skipping testtsa test -- requires RSA"; \ else \ @@ -375,7 +375,7 @@ test_v3name: $(V3NAMETEST)$(EXE_EXT) @echo "Test X509v3_check_*" ../util/shlib_wrap.sh ./$(V3NAMETEST) -test_ocsp: ../apps/openssl +test_ocsp: ../apps/openssl tocsp @echo "Test OCSP" @sh ./tocsp diff --git a/util/mk1mf.pl b/util/mk1mf.pl index 7860375c56adca1a483c618f481b3dbd79ac04f0..fb13f2e11faf6e73acd56922c2d6525b1b5550bb 100755 --- a/util/mk1mf.pl +++ b/util/mk1mf.pl @@ -610,6 +610,7 @@ EOF } $defs= <<"EOF"; +# N.B. You MUST use -j on FreeBSD. # This makefile has been automatically generated from the OpenSSL distribution. # This single makefile will build the complete OpenSSL distribution and # by default leave the 'intertesting' output files in .${o}out and the stuff @@ -754,7 +755,7 @@ $banner # This needs to be invoked once, when the makefile is first constructed, or # 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) @@ -1371,7 +1372,8 @@ sub do_copy_rule if ($n =~ /bss_file/) { $pp=".c"; } 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); } diff --git a/util/pl/unix.pl b/util/pl/unix.pl index 7d901f0f145b7c85ee9a61db69c4e99898d5d691..8e7318232c70f3db05e95afade8416034c56dd1d 100644 --- a/util/pl/unix.pl +++ b/util/pl/unix.pl @@ -211,26 +211,48 @@ sub fixrules { my ($str) = @_; + # Compatible with -j... + $str =~ s/^(\s+@?)/$1cd \$(TEST_D) && /; return $str; + # Compatible with not -j. my @t = split("\n", $str); $str = ''; + my $prev; foreach my $t (@t) { $t =~ s/^\s+//; - if ($t =~ /^@/) + if (!$prev) { - $t =~ s/^@/\@cd \$(TEST_D) && /; - } - else - { - $t = 'cd $(TEST_D) && ' . $t; + if ($t =~ /^@/) + { + $t =~ s/^@/\@cd \$(TEST_D) && /; + } + elsif ($t !~ /^\s*#/) + { + $t = 'cd $(TEST_D) && ' . $t; + } } $str .= "\t$t\n"; + $prev = $t =~/\\$/; } 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 { my ($makefile) = @_; @@ -308,21 +330,61 @@ sub get_tests my $d = $deps{$t}; $d =~ s/\.\.\/apps/\$(BIN_D)/g; + $d =~ s/\.\.\/util/\$(TEST_D)/g; $d = fixtests($d, \%tests); $d = fixdeps($d); 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 = 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 - my $copies = do_copy_rule('$(TEST_D)', 'test/bctest test/evptests.txt test/testgen test/cms-test.pl', ''); - - return "$copies\n$tests\n$all\n\n$each"; + my @copies = ( 'bctest', + 'evptests.txt', + '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;