Commit 3675fb88 authored by Ben Laurie's avatar Ben Laurie
Browse files

More progress towards working tests.

parent 3b4d86bf
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -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

+4 −2
Original line number Diff line number Diff line
@@ -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);
	}
+73 −11
Original line number Diff line number Diff line
@@ -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 (!$prev)
      {
      if ($t =~ /^@/)
	{
        $t =~ s/^@/\@cd \$(TEST_D) && /;
        }
    else
      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', '');
  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 "$copies\n$tests\n$all\n\n$each";
  return "$scripts\n$copies\n$tests\n$all\n\n$each";
  }

1;