summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/recipes/00-check_testexes.t8
-rwxr-xr-xtest/recipes/01-test_ordinals.t6
-rw-r--r--test/recipes/10-test_bn.t4
-rw-r--r--test/recipes/15-test_dsa.t10
-rw-r--r--test/recipes/15-test_ec.t10
-rw-r--r--test/recipes/15-test_rsa.t10
-rw-r--r--test/recipes/20-test_enc.t4
-rw-r--r--test/recipes/25-test_crl.t6
-rw-r--r--test/recipes/25-test_gen.t10
-rw-r--r--test/recipes/25-test_pkcs7.t8
-rw-r--r--test/recipes/25-test_req.t6
-rw-r--r--test/recipes/25-test_sid.t6
-rw-r--r--test/recipes/25-test_verify.t8
-rw-r--r--test/recipes/25-test_x509.t10
-rw-r--r--test/recipes/30-test_evp.t4
-rw-r--r--test/recipes/40-test_rehash.t4
-rwxr-xr-xtest/recipes/70-test_sslcertstatus.t6
-rwxr-xr-xtest/recipes/70-test_sslextension.t6
-rwxr-xr-xtest/recipes/70-test_sslsessiontick.t6
-rwxr-xr-xtest/recipes/70-test_sslskewith0p.t6
-rwxr-xr-xtest/recipes/70-test_sslvertol.t6
-rw-r--r--test/recipes/70-test_tlsextms.t6
-rw-r--r--test/recipes/70-test_verify_extra.t8
-rw-r--r--test/recipes/80-test_ca.t11
-rw-r--r--test/recipes/80-test_cms.t6
-rw-r--r--test/recipes/80-test_dane.t6
-rw-r--r--test/recipes/80-test_ocsp.t4
-rw-r--r--test/recipes/80-test_ssl.t32
-rw-r--r--test/recipes/80-test_tsa.t8
-rw-r--r--test/recipes/90-test_networking.t8
-rw-r--r--test/recipes/tconversion.pl2
-rw-r--r--test/run_tests.pl9
-rw-r--r--test/testlib/OpenSSL/Test.pm143
-rw-r--r--test/testlib/OpenSSL/Test/Utils.pm6
34 files changed, 229 insertions, 164 deletions
diff --git a/test/recipes/00-check_testexes.t b/test/recipes/00-check_testexes.t
index c086f7f8cc..9da85f26af 100644
--- a/test/recipes/00-check_testexes.t
+++ b/test/recipes/00-check_testexes.t
@@ -4,19 +4,19 @@ use strict;
use File::Spec::Functions;
use File::Basename;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT bldtop_file/;
setup("check_testexes");
my $OpenSSL_ver = "";
-my $Makefile = top_file("Makefile");
+my $Makefile = bldtop_file("Makefile");
if (open(FH, $Makefile)) {
$OpenSSL_ver =
(map { s/\R//; s/^VERSION=([^\s]*)\s*$//; $1 } grep { /^VERSION=/ } <FH>)[0];
close FH;
}
-my $MINFO = top_file("MINFO");
+my $MINFO = bldtop_file("MINFO");
plan skip_all => "because MINFO not found. If you want this test to run, please do 'perl util/mkfiles.pl > MINFO'"
unless open(FH,$MINFO);
@@ -50,7 +50,7 @@ my @expected_tests =
plan tests => scalar @expected_tests;
my @found_tests =
- map { basename($_) } glob(top_file("test", "recipes", "*.t"));
+ map { basename($_) } glob(bldtop_file("test", "recipes", "*.t"));
foreach my $test (sort @expected_tests) {
ok(scalar(grep(/^[0-9][0-9]-test_$test\.t$/, @found_tests)),
diff --git a/test/recipes/01-test_ordinals.t b/test/recipes/01-test_ordinals.t
index 6c5efff7df..ffda0f705c 100755
--- a/test/recipes/01-test_ordinals.t
+++ b/test/recipes/01-test_ordinals.t
@@ -53,14 +53,14 @@
# Hudson (tjh@cryptsoft.com).
use strict;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_ordinals");
plan tests => 2;
-ok(testordinals(top_file("util", "libeay.num")), "Test libeay.num");
-ok(testordinals(top_file("util", "ssleay.num")), "Test ssleay.num");
+ok(testordinals(srctop_file("util", "libeay.num")), "Test libeay.num");
+ok(testordinals(srctop_file("util", "ssleay.num")), "Test ssleay.num");
sub testordinals
{
diff --git a/test/recipes/10-test_bn.t b/test/recipes/10-test_bn.t
index a01d9bfef0..7e728f4e16 100644
--- a/test/recipes/10-test_bn.t
+++ b/test/recipes/10-test_bn.t
@@ -5,13 +5,13 @@ use warnings;
use Math::BigInt;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_bn");
plan tests => 3;
-require_ok(top_file("test","recipes","bc.pl"));
+require_ok(srctop_file("test","recipes","bc.pl"));
my $testresults = "tmp.bntest";
my $init = ok(run(test(["bntest"], stdout => $testresults)), 'initialize');
diff --git a/test/recipes/15-test_dsa.t b/test/recipes/15-test_dsa.t
index 5a1917dced..22f971cebf 100644
--- a/test/recipes/15-test_dsa.t
+++ b/test/recipes/15-test_dsa.t
@@ -4,14 +4,14 @@ use strict;
use warnings;
use File::Spec;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
use OpenSSL::Test::Utils;
setup("test_dsa");
plan tests => 6;
-require_ok(top_file('test','recipes','tconversion.pl'));
+require_ok(srctop_file('test','recipes','tconversion.pl'));
ok(run(test(["dsatest"])), "running dsatest");
ok(run(test(["dsatest", "-app2_1"])), "running dsatest -app2_1");
@@ -21,13 +21,13 @@ ok(run(test(["dsatest", "-app2_1"])), "running dsatest -app2_1");
if disabled("dsa");
subtest 'dsa conversions -- private key' => sub {
- tconversion("dsa", top_file("test","testdsa.pem"));
+ tconversion("dsa", srctop_file("test","testdsa.pem"));
};
subtest 'dsa conversions -- private key PKCS#8' => sub {
- tconversion("dsa", top_file("test","testdsa.pem"), "pkey");
+ tconversion("dsa", srctop_file("test","testdsa.pem"), "pkey");
};
subtest 'dsa conversions -- public key' => sub {
- tconversion("dsa", top_file("test","testdsapub.pem"), "dsa",
+ tconversion("dsa", srctop_file("test","testdsapub.pem"), "dsa",
"-pubin", "-pubout");
};
}
diff --git a/test/recipes/15-test_ec.t b/test/recipes/15-test_ec.t
index 4701dc80db..48b8ce8cda 100644
--- a/test/recipes/15-test_ec.t
+++ b/test/recipes/15-test_ec.t
@@ -4,14 +4,14 @@ use strict;
use warnings;
use File::Spec;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
use OpenSSL::Test::Utils;
setup("test_ec");
plan tests => 5;
-require_ok(top_file('test','recipes','tconversion.pl'));
+require_ok(srctop_file('test','recipes','tconversion.pl'));
ok(run(test(["ectest"])), "running ectest");
@@ -20,12 +20,12 @@ ok(run(test(["ectest"])), "running ectest");
if disabled("ec");
subtest 'ec conversions -- private key' => sub {
- tconversion("ec", top_file("test","testec-p256.pem"));
+ tconversion("ec", srctop_file("test","testec-p256.pem"));
};
subtest 'ec conversions -- private key PKCS#8' => sub {
- tconversion("ec", top_file("test","testec-p256.pem"), "pkey");
+ tconversion("ec", srctop_file("test","testec-p256.pem"), "pkey");
};
subtest 'ec conversions -- public key' => sub {
- tconversion("ec", top_file("test","testecpub-p256.pem"), "ec", "-pubin", "-pubout");
+ tconversion("ec", srctop_file("test","testecpub-p256.pem"), "ec", "-pubin", "-pubout");
};
}
diff --git a/test/recipes/15-test_rsa.t b/test/recipes/15-test_rsa.t
index 6418ff7edd..42bba1d0ba 100644
--- a/test/recipes/15-test_rsa.t
+++ b/test/recipes/15-test_rsa.t
@@ -4,14 +4,14 @@ use strict;
use warnings;
use File::Spec;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
use OpenSSL::Test::Utils;
setup("test_rsa");
plan tests => 5;
-require_ok(top_file('test','recipes','tconversion.pl'));
+require_ok(srctop_file('test','recipes','tconversion.pl'));
ok(run(test(["rsa_test"])), "running rsatest");
@@ -20,13 +20,13 @@ ok(run(test(["rsa_test"])), "running rsatest");
if disabled("rsa");
subtest 'rsa conversions -- private key' => sub {
- tconversion("rsa", top_file("test","testrsa.pem"));
+ tconversion("rsa", srctop_file("test","testrsa.pem"));
};
subtest 'rsa conversions -- private key PKCS#8' => sub {
- tconversion("rsa", top_file("test","testrsa.pem"), "pkey");
+ tconversion("rsa", srctop_file("test","testrsa.pem"), "pkey");
};
subtest 'rsa conversions -- public key' => sub {
- tconversion("rsa", top_file("test","testrsapub.pem"), "rsa",
+ tconversion("rsa", srctop_file("test","testrsapub.pem"), "rsa",
"-pubin", "-pubout");
};
}
diff --git a/test/recipes/20-test_enc.t b/test/recipes/20-test_enc.t
index 55f39421fe..2efcf70020 100644
--- a/test/recipes/20-test_enc.t
+++ b/test/recipes/20-test_enc.t
@@ -7,14 +7,14 @@ use File::Spec::Functions qw/catfile/;
use File::Copy;
use File::Compare qw/compare_text/;
use File::Basename;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_enc");
# We do it this way, because setup() may have moved us around,
# so the directory portion of $0 might not be correct any more.
# However, the name hasn't changed.
-my $testsrc = top_file("test","recipes",basename($0));
+my $testsrc = srctop_file("test","recipes",basename($0));
my $test = catfile(".", "p");
diff --git a/test/recipes/25-test_crl.t b/test/recipes/25-test_crl.t
index 6779a0b1af..8650bfc9f9 100644
--- a/test/recipes/25-test_crl.t
+++ b/test/recipes/25-test_crl.t
@@ -4,14 +4,14 @@ use strict;
use warnings;
use File::Spec;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_crl");
plan tests => 2;
-require_ok(top_file('test','recipes','tconversion.pl'));
+require_ok(srctop_file('test','recipes','tconversion.pl'));
subtest 'crl conversions' => sub {
- tconversion("crl", top_file("test","testcrl.pem"));
+ tconversion("crl", srctop_file("test","testcrl.pem"));
};
diff --git a/test/recipes/25-test_gen.t b/test/recipes/25-test_gen.t
index dc8ca6ac05..ce4a5ee260 100644
--- a/test/recipes/25-test_gen.t
+++ b/test/recipes/25-test_gen.t
@@ -4,7 +4,7 @@ use strict;
use warnings;
use File::Spec;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
use OpenSSL::Test::Utils;
setup("test_gen");
@@ -13,7 +13,7 @@ plan tests => 1;
my $T = "testcert";
my $KEY = 512;
-my $CA = top_file("certs", "testca.pem");
+my $CA = srctop_file("certs", "testca.pem");
unlink "$T.1", "$T.2", "$T.key";
open RND, ">>", ".rnd";
@@ -23,7 +23,7 @@ close RND;
subtest "generating certificate requests" => sub {
my @req_new;
if (disabled("rsa")) {
- @req_new = ("-newkey", "dsa:".top_file("apps", "dsa512.pem"));
+ @req_new = ("-newkey", "dsa:".srctop_file("apps", "dsa512.pem"));
} else {
@req_new = ("-new");
note("There should be a 2 sequences of .'s and some +'s.");
@@ -34,11 +34,11 @@ subtest "generating certificate requests" => sub {
plan tests => 2;
- ok(run(app(["openssl", "req", "-config", top_file("test", "test.cnf"),
+ ok(run(app(["openssl", "req", "-config", srctop_file("test", "test.cnf"),
@req_new, "-out", "testreq.pem"])),
"Generating request");
- ok(run(app(["openssl", "req", "-config", top_file("test", "test.cnf"),
+ ok(run(app(["openssl", "req", "-config", srctop_file("test", "test.cnf"),
"-verify", "-in", "testreq.pem", "-noout"])),
"Verifying signature on request");
};
diff --git a/test/recipes/25-test_pkcs7.t b/test/recipes/25-test_pkcs7.t
index 3a4dbb47bd..6e9b397175 100644
--- a/test/recipes/25-test_pkcs7.t
+++ b/test/recipes/25-test_pkcs7.t
@@ -4,17 +4,17 @@ use strict;
use warnings;
use File::Spec;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_pkcs7");
plan tests => 3;
-require_ok(top_file('test','recipes','tconversion.pl'));
+require_ok(srctop_file('test','recipes','tconversion.pl'));
subtest 'pkcs7 conversions -- pkcs7' => sub {
- tconversion("p7", top_file("test", "testp7.pem"), "pkcs7");
+ tconversion("p7", srctop_file("test", "testp7.pem"), "pkcs7");
};
subtest 'pkcs7 conversions -- pkcs7d' => sub {
- tconversion("p7d", top_file("test", "pkcs7-1.pem"), "pkcs7");
+ tconversion("p7d", srctop_file("test", "pkcs7-1.pem"), "pkcs7");
};
diff --git a/test/recipes/25-test_req.t b/test/recipes/25-test_req.t
index ce1f869e2b..fac97719e6 100644
--- a/test/recipes/25-test_req.t
+++ b/test/recipes/25-test_req.t
@@ -4,15 +4,15 @@ use strict;
use warnings;
use File::Spec;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_req");
plan tests => 3;
-require_ok(top_file('test','recipes','tconversion.pl'));
+require_ok(srctop_file('test','recipes','tconversion.pl'));
-my @openssl_args = ("req", "-config", "../apps/openssl.cnf");
+my @openssl_args = ("req", "-config", srctop_file("apps", "openssl.cnf"));
run_conversion('req conversions',
"testreq.pem");
diff --git a/test/recipes/25-test_sid.t b/test/recipes/25-test_sid.t
index b223c0dd4f..84444b3b61 100644
--- a/test/recipes/25-test_sid.t
+++ b/test/recipes/25-test_sid.t
@@ -4,14 +4,14 @@ use strict;
use warnings;
use File::Spec;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_sid");
plan tests => 2;
-require_ok(top_file('test','recipes','tconversion.pl'));
+require_ok(srctop_file('test','recipes','tconversion.pl'));
subtest 'sid conversions' => sub {
- tconversion("sid", top_file("test","testsid.pem"), "sess_id");
+ tconversion("sid", srctop_file("test","testsid.pem"), "sess_id");
};
diff --git a/test/recipes/25-test_verify.t b/test/recipes/25-test_verify.t
index 444f69b694..c1d222bb80 100644
--- a/test/recipes/25-test_verify.t
+++ b/test/recipes/25-test_verify.t
@@ -4,7 +4,7 @@ use strict;
use warnings;
use File::Spec::Functions qw/canonpath/;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_verify");
@@ -13,9 +13,9 @@ sub verify {
my @args = qw(openssl verify -purpose);
my @path = qw(test certs);
push(@args, "$purpose", @opts);
- for (@$trusted) { push(@args, "-trusted", top_file(@path, "$_.pem")) }
- for (@$untrusted) { push(@args, "-untrusted", top_file(@path, "$_.pem")) }
- push(@args, top_file(@path, "$cert.pem"));
+ for (@$trusted) { push(@args, "-trusted", srctop_file(@path, "$_.pem")) }
+ for (@$untrusted) { push(@args, "-untrusted", srctop_file(@path, "$_.pem")) }
+ push(@args, srctop_file(@path, "$cert.pem"));
run(app([@args]));
}
diff --git a/test/recipes/25-test_x509.t b/test/recipes/25-test_x509.t
index e2d795a6c4..1572a06d71 100644
--- a/test/recipes/25-test_x509.t
+++ b/test/recipes/25-test_x509.t
@@ -4,20 +4,20 @@ use strict;
use warnings;
use File::Spec;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_x509");
plan tests => 4;
-require_ok(top_file('test','recipes','tconversion.pl'));
+require_ok(srctop_file('test','recipes','tconversion.pl'));
subtest 'x509 -- x.509 v1 certificate' => sub {
- tconversion("x509", top_file("test","testx509.pem"));
+ tconversion("x509", srctop_file("test","testx509.pem"));
};
subtest 'x509 -- first x.509 v3 certificate' => sub {
- tconversion("x509", top_file("test","v3-cert1.pem"));
+ tconversion("x509", srctop_file("test","v3-cert1.pem"));
};
subtest 'x509 -- second x.509 v3 certificate' => sub {
- tconversion("x509", top_file("test","v3-cert2.pem"));
+ tconversion("x509", srctop_file("test","v3-cert2.pem"));
};
diff --git a/test/recipes/30-test_evp.t b/test/recipes/30-test_evp.t
index 9d5ce6f187..9ee24f46b4 100644
--- a/test/recipes/30-test_evp.t
+++ b/test/recipes/30-test_evp.t
@@ -3,10 +3,10 @@
use strict;
use warnings;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_evp");
plan tests => 1;
-ok(run(test(["evp_test", top_file("test", "evptests.txt")])),
+ok(run(test(["evp_test", srctop_file("test", "evptests.txt")])),
"running evp_test evptests.txt");
diff --git a/test/recipes/40-test_rehash.t b/test/recipes/40-test_rehash.t
index c4c6abcd93..f0a8faecd6 100644
--- a/test/recipes/40-test_rehash.t
+++ b/test/recipes/40-test_rehash.t
@@ -6,7 +6,7 @@ use warnings;
use File::Spec::Functions;
use File::Copy;
use File::Basename;
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT bldtop_file/;
setup("test_rehash");
@@ -51,7 +51,7 @@ indir "rehash.$$" => sub {
sub prepare {
my @sourcefiles =
- sort map { glob(top_file('certs', 'demo', "*.$_")) } ('pem',
+ sort map { glob(bldtop_file('certs', 'demo', "*.$_")) } ('pem',
'crt',
'cer',
'crl');
diff --git a/test/recipes/70-test_sslcertstatus.t b/test/recipes/70-test_sslcertstatus.t
index 814ca0abf1..a7f2d8a2b1 100755
--- a/test/recipes/70-test_sslcertstatus.t
+++ b/test/recipes/70-test_sslcertstatus.t
@@ -53,7 +53,7 @@
# Hudson (tjh@cryptsoft.com).
use strict;
-use OpenSSL::Test qw/:DEFAULT cmdstr top_file top_dir/;
+use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_dir/;
use OpenSSL::Test::Utils;
use TLSProxy::Proxy;
@@ -69,12 +69,12 @@ plan skip_all => "$test_name needs the engine feature enabled"
plan skip_all => "$test_name can only be performed with OpenSSL configured shared"
if disabled("shared");
-$ENV{OPENSSL_ENGINES} = top_dir("engines");
+$ENV{OPENSSL_ENGINES} = bldtop_dir("engines");
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
my $proxy = TLSProxy::Proxy->new(
\&certstatus_filter,
cmdstr(app(["openssl"])),
- top_file("apps", "server.pem")
+ srctop_file("apps", "server.pem")
);
plan tests => 1;
diff --git a/test/recipes/70-test_sslextension.t b/test/recipes/70-test_sslextension.t
index 3c9caadb97..f7ac9f4d58 100755
--- a/test/recipes/70-test_sslextension.t
+++ b/test/recipes/70-test_sslextension.t
@@ -53,7 +53,7 @@
# Hudson (tjh@cryptsoft.com).
use strict;
-use OpenSSL::Test qw/:DEFAULT cmdstr top_file top_dir/;
+use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_dir/;
use OpenSSL::Test::Utils;
use TLSProxy::Proxy;
@@ -69,12 +69,12 @@ plan skip_all => "$test_name needs the engine feature enabled"
plan skip_all => "$test_name can only be performed with OpenSSL configured shared"
if disabled("shared");
-$ENV{OPENSSL_ENGINES} = top_dir("engines");
+$ENV{OPENSSL_ENGINES} = bldtop_dir("engines");
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
my $proxy = TLSProxy::Proxy->new(
\&extension_filter,
cmdstr(app(["openssl"])),
- top_file("apps", "server.pem")
+ srctop_file("apps", "server.pem")
);
plan tests => 1;
diff --git a/test/recipes/70-test_sslsessiontick.t b/test/recipes/70-test_sslsessiontick.t
index 7e5ccad5aa..f2c00daece 100755
--- a/test/recipes/70-test_sslsessiontick.t
+++ b/test/recipes/70-test_sslsessiontick.t
@@ -53,7 +53,7 @@
# Hudson (tjh@cryptsoft.com).
use strict;
-use OpenSSL::Test qw/:DEFAULT cmdstr top_file top_dir/;
+use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_dir/;
use OpenSSL::Test::Utils;
use TLSProxy::Proxy;
use File::Temp qw(tempfile);
@@ -70,7 +70,7 @@ plan skip_all => "$test_name needs the engine feature enabled"
plan skip_all => "$test_name can only be performed with OpenSSL configured shared"
if disabled("shared");
-$ENV{OPENSSL_ENGINES} = top_dir("engines");
+$ENV{OPENSSL_ENGINES} = bldtop_dir("engines");
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
sub checkmessages($$$$$$);
@@ -84,7 +84,7 @@ my $ticketseen = 0;
my $proxy = TLSProxy::Proxy->new(
undef,
cmdstr(app(["openssl"])),
- top_file("apps", "server.pem")
+ srctop_file("apps", "server.pem")
);
plan tests => 8;
diff --git a/test/recipes/70-test_sslskewith0p.t b/test/recipes/70-test_sslskewith0p.t
index 8261238f00..0e6a780404 100755
--- a/test/recipes/70-test_sslskewith0p.t
+++ b/test/recipes/70-test_sslskewith0p.t
@@ -53,7 +53,7 @@
# Hudson (tjh@cryptsoft.com).
use strict;
-use OpenSSL::Test qw/:DEFAULT cmdstr top_file top_dir/;
+use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_dir/;
use OpenSSL::Test::Utils;
use TLSProxy::Proxy;
@@ -72,12 +72,12 @@ plan skip_all => "$test_name can only be performed with OpenSSL configured share
plan skip_all => "dh is not supported by this OpenSSL build"
if disabled("dh");
-$ENV{OPENSSL_ENGINES} = top_dir("engines");
+$ENV{OPENSSL_ENGINES} = bldtop_dir("engines");
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
my $proxy = TLSProxy::Proxy->new(
\&ske_0_p_filter,
cmdstr(app(["openssl"])),
- top_file("apps", "server.pem")
+ srctop_file("apps", "server.pem")
);
plan tests => 1;
diff --git a/test/recipes/70-test_sslvertol.t b/test/recipes/70-test_sslvertol.t
index e5eef31bc4..b12abee876 100755
--- a/test/recipes/70-test_sslvertol.t
+++ b/test/recipes/70-test_sslvertol.t
@@ -53,7 +53,7 @@
# Hudson (tjh@cryptsoft.com).
use strict;
-use OpenSSL::Test qw/:DEFAULT cmdstr top_file top_dir/;
+use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_dir/;
use OpenSSL::Test::Utils;
use TLSProxy::Proxy;
@@ -69,12 +69,12 @@ plan skip_all => "$test_name needs the engine feature enabled"
plan skip_all => "$test_name can only be performed with OpenSSL configured shared"
if disabled("shared");
-$ENV{OPENSSL_ENGINES} = top_dir("engines");
+$ENV{OPENSSL_ENGINES} = bldtop_dir("engines");
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
my $proxy = TLSProxy::Proxy->new(
\&vers_tolerance_filter,
cmdstr(app(["openssl"])),
- top_file("apps", "server.pem")
+ srctop_file("apps", "server.pem")
);
plan tests => 2;
diff --git a/test/recipes/70-test_tlsextms.t b/test/recipes/70-test_tlsextms.t
index 8e3b41434e..a4419f5d24 100644
--- a/test/recipes/70-test_tlsextms.t
+++ b/test/recipes/70-test_tlsextms.t
@@ -53,7 +53,7 @@
# Hudson (tjh@cryptsoft.com).
use strict;
-use OpenSSL::Test qw/:DEFAULT cmdstr top_file top_dir/;
+use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_dir/;
use OpenSSL::Test::Utils;
use TLSProxy::Proxy;
use File::Temp qw(tempfile);
@@ -70,7 +70,7 @@ plan skip_all => "$test_name needs the engine feature enabled"
plan skip_all => "$test_name can only be performed with OpenSSL configured shared"
if disabled("shared");
-$ENV{OPENSSL_ENGINES} = top_dir("engines");
+$ENV{OPENSSL_ENGINES} = bldtop_dir("engines");
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
sub checkmessages($$$$$);
@@ -86,7 +86,7 @@ my $fullhand = 0;
my $proxy = TLSProxy::Proxy->new(
\&extms_filter,
cmdstr(app(["openssl"])),
- top_file("apps", "server.pem"),
+ srctop_file("apps", "server.pem"),
1
);
diff --git a/test/recipes/70-test_verify_extra.t b/test/recipes/70-test_verify_extra.t
index eec8904ca9..8c213e8a2f 100644
--- a/test/recipes/70-test_verify_extra.t
+++ b/test/recipes/70-test_verify_extra.t
@@ -1,12 +1,12 @@
#! /usr/bin/perl
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
setup("test_verify_extra");
plan tests => 1;
ok(run(test(["verify_extra_test",
- top_file("test", "certs", "roots.pem"),
- top_file("test", "certs", "untrusted.pem"),
- top_file("test", "certs", "bad.pem")])));
+ srctop_file("test", "certs", "roots.pem"),
+ srctop_file("test", "certs", "untrusted.pem"),
+ srctop_file("test", "certs", "bad.pem")])));
diff --git a/test/recipes/80-test_ca.t b/test/recipes/80-test_ca.t
index e97a83fbc4..97e44c8d99 100644
--- a/test/recipes/80-test_ca.t
+++ b/test/recipes/80-test_ca.t
@@ -5,24 +5,24 @@ use warnings;
use POSIX;
use File::Path 2.00 qw/remove_tree/;
-use OpenSSL::Test qw/:DEFAULT cmdstr top_file/;
+use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file/;
setup("test_ca");
$ENV{OPENSSL} = cmdstr(app(["openssl"]));
-my $std_openssl_cnf = $^O eq "VMS"
- ? top_file("apps", "openssl-vms.cnf") : top_file("apps", "openssl.cnf");
+my $std_openssl_cnf =
+ srctop_file("apps", $^O eq "VMS" ? "openssl-vms.cnf" : "openssl.cnf");
remove_tree("demoCA", { safe => 0 });
plan tests => 4;
SKIP: {
- $ENV{OPENSSL_CONFIG} = "-config ".top_file("test", "CAss.cnf");
+ $ENV{OPENSSL_CONFIG} = "-config ".srctop_file("test", "CAss.cnf");
skip "failed creating CA structure", 3
if !ok(run(perlapp(["CA.pl","-newca"], stdin => undef, stderr => undef)),
'creating CA structure');
- $ENV{OPENSSL_CONFIG} = "-config ".top_file("test", "Uss.cnf");
+ $ENV{OPENSSL_CONFIG} = "-config ".srctop_file("test", "Uss.cnf");
skip "failed creating new certificate request", 2
if !ok(run(perlapp(["CA.pl","-newreq"], stderr => undef)),
'creating CA structure');
@@ -49,3 +49,4 @@ sub yes {
close PIPE;
return 0;
}
+
diff --git a/test/recipes/80-test_cms.t b/test/recipes/80-test_cms.t
index 5445311e66..e3722719ec 100644
--- a/test/recipes/80-test_cms.t
+++ b/test/recipes/80-test_cms.t
@@ -6,13 +6,13 @@ use warnings;
use POSIX;
use File::Spec::Functions qw/catfile/;
use File::Compare qw/compare_text/;
-use OpenSSL::Test qw/:DEFAULT top_dir top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_dir srctop_file/;
use OpenSSL::Test::Utils;
setup("test_cms");
-my $smdir = top_dir("test", "smime-certs");
-my $smcont = top_file("test", "smcont.txt");
+my $smdir = srctop_dir("test", "smime-certs");
+my $smcont = srctop_file("test", "smcont.txt");
my ($no_dh, $no_ec, $no_ec2m, $no_zlib) = disabled qw/dh ec ec2m zlib/;
plan tests => 4;
diff --git a/test/recipes/80-test_dane.t b/test/recipes/80-test_dane.t
index e0aa524250..6436735a9b 100644
--- a/test/recipes/80-test_dane.t
+++ b/test/recipes/80-test_dane.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use OpenSSL::Test qw/:DEFAULT top_dir top_file/;
+use OpenSSL::Test qw/:DEFAULT srctop_file/;
use OpenSSL::Test::Utils;
setup("test_dane");
@@ -13,5 +13,5 @@ plan skip_all => "test_dane uses ec which is not supported by this OpenSSL build
plan tests => 1; # The number of tests being performed
ok(run(test(["danetest", "example.com",
- top_file("test", "danetest.pem"),
- top_file("test", "danetest.in")])), "dane tests");
+ srctop_file("test", "danetest.pem"),
+ srctop_file("test", "danetest.in")])), "dane tests");
diff --git a/test/recipes/80-test_ocsp.t b/test/recipes/80-test_ocsp.t
index 6e256c7122..43087f9fd1 100644
--- a/test/recipes/80-test_ocsp.t
+++ b/test/recipes/80-test_ocsp.t
@@ -6,11 +6,11 @@ use warnings;
use POSIX;
use File::Spec::Functions qw/devnull catfile/;
use File::Copy;
-use OpenSSL::Test qw/:DEFAULT with pipe top_dir/;
+use OpenSSL::Test qw/:DEFAULT with pipe srctop_dir/;
setup("test_ocsp");
-my $ocspdir=top_dir("test", "ocsp-tests");
+my $ocspdir=srctop_dir("test", "ocsp-tests");
# 17 December 2012 so we don't get certificate expiry errors.
my @check_time=("-attime", "1355875200");
diff --git a/test/recipes/80-test_ssl.t b/test/recipes/80-test_ssl.t
index e84d3cce54..e0f2fc5513 100644
--- a/test/recipes/80-test_ssl.t
+++ b/test/recipes/80-test_ssl.t
@@ -6,7 +6,7 @@ use warnings;
use POSIX;
use File::Spec;
use File::Copy;
-use OpenSSL::Test qw/:DEFAULT with top_file cmdstr/;
+use OpenSSL::Test qw/:DEFAULT with bldtop_file srctop_file cmdstr/;
use OpenSSL::Test::Utils;
setup("test_ssl");
@@ -27,16 +27,16 @@ my $digest = "-sha1";
my @reqcmd = ("openssl", "req");
my @x509cmd = ("openssl", "x509", $digest);
my @verifycmd = ("openssl", "verify");
-my $dummycnf = top_file("apps", "openssl.cnf");
+my $dummycnf = srctop_file("apps", "openssl.cnf");
my $CAkey = "keyCA.ss";
my $CAcert="certCA.ss";
my $CAserial="certCA.srl";
my $CAreq="reqCA.ss";
-my $CAconf=top_file("test","CAss.cnf");
+my $CAconf=srctop_file("test","CAss.cnf");
my $CAreq2="req2CA.ss"; # temp
-my $Uconf=top_file("test","Uss.cnf");
+my $Uconf=srctop_file("test","Uss.cnf");
my $Ukey="keyU.ss";
my $Ureq="reqU.ss";
my $Ucert="certU.ss";
@@ -49,13 +49,13 @@ my $Ekey="keyE.ss";
my $Ereq="reqE.ss";
my $Ecert="certE.ss";
-my $P1conf=top_file("test","P1ss.cnf");
+my $P1conf=srctop_file("test","P1ss.cnf");
my $P1key="keyP1.ss";
my $P1req="reqP1.ss";
my $P1cert="certP1.ss";
my $P1intermediate="tmp_intP1.ss";
-my $P2conf=top_file("test","P2ss.cnf");
+my $P2conf=srctop_file("test","P2ss.cnf");
my $P2key="keyP2.ss";
my $P2req="reqP2.ss";
my $P2cert="certP2.ss";
@@ -105,7 +105,7 @@ sub testss {
close RND;
my @req_dsa = ("-newkey",
- "dsa:".File::Spec->catfile("..", "apps", "dsa1024.pem"));;
+ "dsa:".srctop_file("apps", "dsa1024.pem"));
my @req_new;
if ($no_rsa) {
@req_new = @req_dsa;
@@ -306,17 +306,17 @@ sub testss {
}
sub testssl {
- my $key = shift || top_file("apps","server.pem");
- my $cert = shift || top_file("apps","server.pem");
+ my $key = shift || bldtop_file("apps","server.pem");
+ my $cert = shift || bldtop_file("apps","server.pem");
my $CAtmp = shift;
- my @CA = $CAtmp ? ("-CAfile", $CAtmp) : ("-CApath", top_dir("certs"));
+ my @CA = $CAtmp ? ("-CAfile", $CAtmp) : ("-CApath", bldtop_dir("certs"));
my @extra = @_;
my @ssltest = ("ssltest",
"-s_key", $key, "-s_cert", $cert,
"-c_key", $key, "-c_cert", $cert);
- my $serverinfo = top_file("test","serverinfo.pem");
+ my $serverinfo = srctop_file("test","serverinfo.pem");
my $dsa_cert = 0;
if (grep /DSA Public Key/, run(app(["openssl", "x509", "-in", $cert,
@@ -528,13 +528,13 @@ sub testssl {
skip "skipping RSA tests", 2
if $no_rsa;
- ok(run(test(["ssltest", "-v", "-bio_pair", "-tls1", "-s_cert", top_file("apps","server2.pem"), "-no_dhe", "-no_ecdhe", "-num", "10", "-f", "-time", @extra])),
+ ok(run(test(["ssltest", "-v", "-bio_pair", "-tls1", "-s_cert", srctop_file("apps","server2.pem"), "-no_dhe", "-no_ecdhe", "-num", "10", "-f", "-time", @extra])),
'test tlsv1 with 1024bit RSA, no (EC)DHE, multiple handshakes');
skip "skipping RSA+DHE tests", 1
if $no_dh;
- ok(run(test(["ssltest", "-v", "-bio_pair", "-tls1", "-s_cert", top_file("apps","server2.pem"), "-dhe1024dsa", "-num", "10", "-f", "-time", @extra])),
+ ok(run(test(["ssltest", "-v", "-bio_pair", "-tls1", "-s_cert", srctop_file("apps","server2.pem"), "-dhe1024dsa", "-num", "10", "-f", "-time", @extra])),
'test tlsv1 with 1024bit RSA, 1024bit DHE, multiple handshakes');
}
@@ -760,10 +760,10 @@ sub testssl {
}
sub testsslproxy {
- my $key = shift || top_file("apps","server.pem");
- my $cert = shift || top_file("apps","server.pem");
+ my $key = shift || srctop_file("apps","server.pem");
+ my $cert = shift || srctop_file("apps","server.pem");
my $CAtmp = shift;
- my @CA = $CAtmp ? ("-CAfile", $CAtmp) : ("-CApath", top_dir("certs"));
+ my @CA = $CAtmp ? ("-CAfile", $CAtmp) : ("-CApath", bldtop_dir("certs"));
my @extra = @_;
my @ssltest = ("ssltest",
diff --git a/test/recipes/80-test_tsa.t b/test/recipes/80-test_tsa.t
index 8e02a6b038..229f17e95d 100644
--- a/test/recipes/80-test_tsa.t
+++ b/test/recipes/80-test_tsa.t
@@ -6,7 +6,7 @@ use warnings;
use POSIX;
use File::Spec::Functions qw/splitdir curdir catfile/;
use File::Compare;
-use OpenSSL::Test qw/:DEFAULT cmdstr top_file/;
+use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file/;
setup("test_tsa");
@@ -72,12 +72,12 @@ plan tests => 20;
note "setting up TSA test directory";
indir "tsa" => sub
{
- $ENV{OPENSSL_CONF} = top_file("test", "CAtsa.cnf");
+ $ENV{OPENSSL_CONF} = srctop_file("test", "CAtsa.cnf");
# Because that's what ../apps/CA.pl really looks at
$ENV{OPENSSL_CONFIG} = "-config ".$ENV{OPENSSL_CONF};
$ENV{OPENSSL} = cmdstr(app(["openssl"]));
- $testtsa = top_file("test", "recipes", "80-test_tsa.t");
- $CAtsa = top_file("test", "CAtsa.cnf");
+ $testtsa = srctop_file("test", "recipes", "80-test_tsa.t");
+ $CAtsa = srctop_file("test", "CAtsa.cnf");
SKIP: {
$ENV{TSDNSECT} = "ts_ca_dn";
diff --git a/test/recipes/90-test_networking.t b/test/recipes/90-test_networking.t
index f8377c93e0..fb146dd12a 100644
--- a/test/recipes/90-test_networking.t
+++ b/test/recipes/90-test_networking.t
@@ -53,7 +53,7 @@
# Hudson (tjh@cryptsoft.com).
use strict;
-use OpenSSL::Test qw/:DEFAULT cmdstr top_file top_dir/;
+use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_file bldtop_dir/;
use TLSProxy::Proxy;
my $test_name = "test_networking";
@@ -62,15 +62,15 @@ setup($test_name);
plan skip_all => "$test_name can only be performed with OpenSSL configured shared"
unless (map { s/\R//; s/^SHARED_LIBS=\s*//; $_ }
grep { /^SHARED_LIBS=/ }
- do { local @ARGV = ( top_file("Makefile") ); <> })[0] ne "";
+ do { local @ARGV = ( bldtop_file("Makefile") ); <> })[0] ne "";
-$ENV{OPENSSL_ENGINES} = top_dir("engines");
+$ENV{OPENSSL_ENGINES} = bldtop_dir("engines");
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
my $proxy = TLSProxy::Proxy->new(
undef,
cmdstr(app(["openssl"])),
- top_file("apps", "server.pem")
+ srctop_file("apps", "server.pem")
);
plan tests => 2;
diff --git a/test/recipes/tconversion.pl b/test/recipes/tconversion.pl
index 0f9b03b481..eeb25d0e72 100644
--- a/test/recipes/tconversion.pl
+++ b/test/recipes/tconversion.pl
@@ -6,7 +6,7 @@ use warnings;
use File::Compare qw/compare_text/;
use File::Copy;
use lib 'testlib';
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT/;
my %conversionforms = (
# Default conversion forms. Other series may be added with
diff --git a/test/run_tests.pl b/test/run_tests.pl
index c914783274..f7bd623856 100644
--- a/test/run_tests.pl
+++ b/test/run_tests.pl
@@ -7,10 +7,11 @@ use File::Spec::Functions qw/catdir catfile curdir abs2rel rel2abs/;
use File::Basename;
use Test::Harness qw/runtests $switches/;
-my $top = $ENV{TOP};
-my $recipesdir = catdir($top, "test", "recipes");
-my $testlib = catdir($top, "test", "testlib");
-my $utillib = catdir($top, "util");
+my $srctop = $ENV{SRCTOP} || $ENV{TOP};
+my $bldtop = $ENV{BLDTOP} || $ENV{TOP};
+my $recipesdir = catdir($srctop, "test", "recipes");
+my $testlib = catdir($srctop, "test", "testlib");
+my $utillib = catdir($srctop, "util");
# It seems that $switches is getting interpreted with 'eval' or something
# like that, and that we need to take care of backslashes or they will
diff --git a/test/testlib/OpenSSL/Test.pm b/test/testlib/OpenSSL/Test.pm
index 80b9a2fe75..47c1bdc65a 100644
--- a/test/testlib/OpenSSL/Test.pm
+++ b/test/testlib/OpenSSL/Test.pm
@@ -7,11 +7,12 @@ use Test::More 0.96;
use Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
-$VERSION = "0.7";
+$VERSION = "0.8";
@ISA = qw(Exporter);
@EXPORT = (@Test::More::EXPORT, qw(setup indir app perlapp test perltest run));
-@EXPORT_OK = (@Test::More::EXPORT_OK, qw(top_dir top_file pipe with cmdstr
- quotify));
+@EXPORT_OK = (@Test::More::EXPORT_OK, qw(bldtop_dir bldtop_file
+ srctop_dir srctop_file
+ pipe with cmdstr quotify));
=head1 NAME
@@ -37,8 +38,9 @@ In addition to the Test::More functions, it also provides functions that
easily find the diverse programs within a OpenSSL build tree, as well as
some other useful functions.
-This module I<depends> on the environment variable C<$TOP>. Without it,
-it refuses to work. See L</ENVIRONMENT> below.
+This module I<depends> on the environment variables C<$TOP> or C<$SRCTOP>
+and C<$BLDTOP>. Without one of the combinations it refuses to work.
+See L</ENVIRONMENT> below.
=cut
@@ -55,7 +57,7 @@ my $test_name = undef;
# Directories we want to keep track of TOP, APPS, TEST and RESULTS are the
# ones we're interested in, corresponding to the environment variables TOP
-# (mandatory), BIN_D, TEST_D and RESULT_D.
+# (mandatory), BIN_D, TEST_D, UTIL_D and RESULT_D.
my %directories = ();
# A bool saying if we shall stop all testing if the current recipe has failing
@@ -80,8 +82,10 @@ my %hooks = (
my $debug = 0;
# Declare some utility functions that are defined at the end
-sub top_file;
-sub top_dir;
+sub bldtop_file;
+sub bldtop_dir;
+sub srctop_file;
+sub srctop_dir;
sub quotify;
# Declare some private functions that are defined at the end
@@ -108,9 +112,10 @@ If it's not used in a OpenSSL test recipe, the rest of the recipe will
most likely refuse to run.
C<setup> checks for environment variables (see L</ENVIRONMENT> below),
-check that C<$TOP/Configure> exists, C<chdir> into the results directory
-(defined by the C<$RESULT_D> environment variable if defined, otherwise
-C<$TEST_D> if defined, otherwise C<$TOP/test>).
+checks that C<$TOP/Configure> or C<$SRCTOP/Configure> exists, C<chdir>
+into the results directory (defined by the C<$RESULT_D> environment
+variable if defined, otherwise C<$BLDTOP/test> or C<$TOP/test>, whichever
+is defined).
=back
@@ -120,12 +125,15 @@ sub setup {
$test_name = shift;
BAIL_OUT("setup() must receive a name") unless $test_name;
- BAIL_OUT("setup() needs \$TOP to be defined") unless $ENV{TOP};
+ BAIL_OUT("setup() needs \$TOP or \$SRCTOP and \$BLDTOP to be defined")
+ unless $ENV{TOP} || ($ENV{SRCTOP} && $ENV{BLDTOP});
+ BAIL_OUT("setup() found both \$TOP and \$SRCTOP or \$BLDTOP...")
+ if $ENV{TOP} && ($ENV{SRCTOP} || $ENV{BLDTOP});
__env();
BAIL_OUT("setup() expects the file Configure in the \$TOP directory")
- unless -f top_file("Configure");
+ unless -f srctop_file("Configure");
__cwd($directories{RESULTS});
@@ -203,10 +211,12 @@ Both of these functions take a reference to a list that is a command and
its arguments, and some additional options (described further on).
C<app> expects to find the given command (the first item in the given list
-reference) as an executable in C<$BIN_D> (if defined, otherwise C<$TOP/apps>).
+reference) as an executable in C<$BIN_D> (if defined, otherwise C<$TOP/apps>
+or C<$BLDTOP/apps>).
C<test> expects to find the given command (the first item in the given list
-reference) as an executable in C<$TEST_D> (if defined, otherwise C<$TOP/test>).
+reference) as an executable in C<$TEST_D> (if defined, otherwise C<$TOP/test>
+or C<$BLDTOP/test>).
Both return a CODEREF to be used by C<run>, C<pipe> or C<cmdstr>.
@@ -354,11 +364,11 @@ END {
The following functions are exported on request when using C<OpenSSL::Test>.
- # To only get the top_file function.
- use OpenSSL::Test qw/top_file/;
+ # To only get the bldtop_file and srctop_file functions.
+ use OpenSSL::Test qw/bldtop_file srctop_file/;
- # To only get the top_file function in addition to the default ones.
- use OpenSSL::Test qw/:DEFAULT top_file/;
+ # To only get the bldtop_file function in addition to the default ones.
+ use OpenSSL::Test qw/:DEFAULT bldtop_file/;
=cut
@@ -366,38 +376,76 @@ The following functions are exported on request when using C<OpenSSL::Test>.
=over 4
-=item B<top_dir LIST>
+=item B<bldtop_dir LIST>
LIST is a list of directories that make up a path from the top of the OpenSSL
-source directory (as indicated by the environment variable C<$TOP>).
-C<top_dir> returns the resulting directory as a string, adapted to the local
+build directory (as indicated by the environment variable C<$TOP> or
+C<$BLDTOP>).
+C<bldtop_dir> returns the resulting directory as a string, adapted to the local
operating system.
=back
=cut
-sub top_dir {
- return __top_dir(@_); # This caters for operating systems that have
+sub bldtop_dir {
+ return __bldtop_dir(@_); # This caters for operating systems that have
# a very distinct syntax for directories.
}
=over 4
-=item B<top_file LIST, FILENAME>
+=item B<bldtop_file LIST, FILENAME>
LIST is a list of directories that make up a path from the top of the OpenSSL
-source directory (as indicated by the environment variable C<$TOP>) and
-FILENAME is the name of a file located in that directory path.
-C<top_file> returns the resulting file path as a string, adapted to the local
+build directory (as indicated by the environment variable C<$TOP> or
+C<$BLDTOP>) and FILENAME is the name of a file located in that directory path.
+C<bldtop_file> returns the resulting file path as a string, adapted to the local
operating system.
=back
=cut
-sub top_file {
- return __top_file(@_);
+sub bldtop_file {
+ return __bldtop_file(@_);
+}
+
+=over 4
+
+=item B<srctop_dir LIST>
+
+LIST is a list of directories that make up a path from the top of the OpenSSL
+source directory (as indicated by the environment variable C<$TOP> or
+C<$SRCTOP>).
+C<srctop_dir> returns the resulting directory as a string, adapted to the local
+operating system.
+
+=back
+
+=cut
+
+sub srctop_dir {
+ return __srctop_dir(@_); # This caters for operating systems that have
+ # a very distinct syntax for directories.
+}
+
+=over 4
+
+=item B<srctop_file LIST, FILENAME>
+
+LIST is a list of directories that make up a path from the top of the OpenSSL
+source directory (as indicated by the environment variable C<$TOP> or
+C<$SRCTOP>) and FILENAME is the name of a file located in that directory path.
+C<srctop_file> returns the resulting file path as a string, adapted to the local
+operating system.
+
+=back
+
+=cut
+
+sub srctop_file {
+ return __srctop_file(@_);
}
=over 4
@@ -583,25 +631,39 @@ failures will result in a C<BAIL_OUT> at the end of its run.
=cut
sub __env {
- $directories{TOP} = $ENV{TOP},
- $directories{APPS} = $ENV{BIN_D} || catdir($directories{TOP},"apps");
- $directories{TEST} = $ENV{TEST_D} || catdir($directories{TOP},"test");
+ $directories{SRCTOP} = $ENV{SRCTOP} || $ENV{TOP};
+ $directories{BLDTOP} = $ENV{BLDTOP} || $ENV{TOP};
+ $directories{APPS} = $ENV{BIN_D} || __bldtop_dir("apps");
+ $directories{TEST} = $ENV{TEST_D} || __bldtop_dir("test");
$directories{RESULTS} = $ENV{RESULT_D} || $directories{TEST};
$end_with_bailout = $ENV{STOPTEST} ? 1 : 0;
};
-sub __top_file {
+sub __srctop_file {
+ BAIL_OUT("Must run setup() first") if (! $test_name);
+
+ my $f = pop;
+ return catfile($directories{SRCTOP},@_,$f);
+}
+
+sub __srctop_dir {
+ BAIL_OUT("Must run setup() first") if (! $test_name);
+
+ return catdir($directories{SRCTOP},@_);
+}
+
+sub __bldtop_file {
BAIL_OUT("Must run setup() first") if (! $test_name);
my $f = pop;
- return catfile($directories{TOP},@_,$f);
+ return catfile($directories{BLDTOP},@_,$f);
}
-sub __top_dir {
+sub __bldtop_dir {
BAIL_OUT("Must run setup() first") if (! $test_name);
- return catdir($directories{TOP},@_);
+ return catdir($directories{BLDTOP},@_);
}
sub __test_file {
@@ -680,7 +742,7 @@ sub __cwd {
# For each of these directory variables, figure out where they are relative
# to the directory we want to move to if they aren't absolute (if they are,
# they don't change!)
- my @dirtags = ("TOP", "TEST", "APPS", "RESULTS");
+ my @dirtags = sort keys %directories;
foreach (@dirtags) {
if (!file_name_is_absolute($directories{$_})) {
my $newpath = abs2rel(rel2abs($directories{$_}), rel2abs($dir));
@@ -693,7 +755,8 @@ sub __cwd {
print STDERR " \$directories{TEST} = \"$directories{TEST}\"\n";
print STDERR " \$directories{RESULTS} = \"$directories{RESULTS}\"\n";
print STDERR " \$directories{APPS} = \"$directories{APPS}\"\n";
- print STDERR " \$directories{TOP} = \"$directories{TOP}\"\n";
+ print STDERR " \$directories{SRCTOP} = \"$directories{SRCTOP}\"\n";
+ print STDERR " \$directories{BLDTOP} = \"$directories{BLDTOP}\"\n";
print STDERR " \$test_log = \"",__test_log(),"\"\n";
print STDERR "\n";
print STDERR " current directory is \"",curdir(),"\"\n";
@@ -707,7 +770,7 @@ sub __fixup_cmd {
my $prog = shift;
my $exe_shell = shift;
- my $prefix = __top_file("util", "shlib_wrap.sh")." ";
+ my $prefix = __bldtop_file("util", "shlib_wrap.sh")." ";
my $ext = $ENV{"EXE_EXT"} || "";
if (defined($exe_shell)) {
diff --git a/test/testlib/OpenSSL/Test/Utils.pm b/test/testlib/OpenSSL/Test/Utils.pm
index 4273292f5a..da35b14955 100644
--- a/test/testlib/OpenSSL/Test/Utils.pm
+++ b/test/testlib/OpenSSL/Test/Utils.pm
@@ -34,7 +34,7 @@ This module provides utility functions for the testing framework.
=cut
-use OpenSSL::Test qw/:DEFAULT top_file/;
+use OpenSSL::Test qw/:DEFAULT bldtop_file/;
=over 4
@@ -75,9 +75,9 @@ my $configdata_loaded = 0;
sub load_configdata {
# We eval it so it doesn't run at compile time of this file.
- # The latter would have top_dir() complain that setup() hasn't
+ # The latter would have bldtop_file() complain that setup() hasn't
# been run yet.
- my $configdata = top_file("configdata.pm");
+ my $configdata = bldtop_file("configdata.pm");
eval { require $configdata;
%available_protocols = %configdata::available_protocols;
%disabled = %configdata::disabled;