summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorBen Laurie <ben@links.org>2013-04-01 18:22:58 +0100
committerBen Laurie <ben@links.org>2013-04-06 15:13:11 +0100
commit3675fb882c9f112d5e28c4d50aa4909fe567727b (patch)
tree7e2f11c4af8cfb152a929fbbe5f0172ce84e7346 /util
parent3b4d86bff5a8911a061a8a6e5ec1d21b1f651c18 (diff)
More progress towards working tests.
Diffstat (limited to 'util')
-rwxr-xr-xutil/mk1mf.pl6
-rw-r--r--util/pl/unix.pl84
2 files changed, 77 insertions, 13 deletions
diff --git a/util/mk1mf.pl b/util/mk1mf.pl
index 7860375c56..fb13f2e11f 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 7d901f0f14..8e7318232c 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;