aboutsummaryrefslogtreecommitdiffstats
path: root/util/pl
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/pl
parent3b4d86bff5a8911a061a8a6e5ec1d21b1f651c18 (diff)
downloadopenssl-3675fb882c9f112d5e28c4d50aa4909fe567727b.tar.gz
More progress towards working tests.
Diffstat (limited to 'util/pl')
-rw-r--r--util/pl/unix.pl84
1 files changed, 73 insertions, 11 deletions
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;