The branch master has been updated via bedda72ff771a41c317daa7bdb7cbe14608fbc03 (commit) from 586820831afdd01954d82cb068e252cb1772081c (commit)
- Log ----------------------------------------------------------------- commit bedda72ff771a41c317daa7bdb7cbe14608fbc03 Author: Richard Levitte <levi...@openssl.org> Date: Thu Jun 10 13:00:54 2021 +0200 OpenSSL::Test: Treat SRCDATA directory specially, as it might not exist Not all tests come with a SRCDATA directory. if it doesn't exist, we simply drop it from the internal table of directories. OpenSSL::Test::srcdata_dir() and OpenSSL::Test::srcdata_file() may return undef in that case. However, recipes shouldn't try to refer to a non-existing data directory, so if that happens, it's a programming error and must be corrected. Fixes #15679 Reviewed-by: Paul Dale <pa...@openssl.org> Reviewed-by: Tomas Mraz <to...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15700) ----------------------------------------------------------------------- Summary of changes: util/perl/OpenSSL/Test.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/util/perl/OpenSSL/Test.pm b/util/perl/OpenSSL/Test.pm index ee6962931b..00db3d41c8 100644 --- a/util/perl/OpenSSL/Test.pm +++ b/util/perl/OpenSSL/Test.pm @@ -995,6 +995,10 @@ sub __env { rmtree($directories{RESULTS}, { safe => 0, keep_root => 1 }); mkpath($directories{RESULTS}); + # All directories are assumed to exist, except for SRCDATA. If that one + # doesn't exist, just drop it. + delete $directories{SRCDATA} unless -d $directories{SRCDATA}; + push @direnv, "TOP" if $ENV{TOP}; push @direnv, "SRCTOP" if $ENV{SRCTOP}; push @direnv, "BLDTOP" if $ENV{BLDTOP}; @@ -1094,6 +1098,8 @@ sub __fuzz_file { sub __data_file { BAIL_OUT("Must run setup() first") if (! $test_name); + return undef unless exists $directories{SRCDATA}; + my $f = pop; return catfile($directories{SRCDATA},@_,$f); } @@ -1101,6 +1107,8 @@ sub __data_file { sub __data_dir { BAIL_OUT("Must run setup() first") if (! $test_name); + return undef unless exists $directories{SRCDATA}; + return catdir($directories{SRCDATA},@_); } @@ -1200,7 +1208,8 @@ sub __cwd { print STDERR "\n"; print STDERR " \$directories{BLDTEST} = \"$directories{BLDTEST}\"\n"; print STDERR " \$directories{SRCTEST} = \"$directories{SRCTEST}\"\n"; - print STDERR " \$directories{SRCDATA} = \"$directories{SRCDATA}\"\n"; + print STDERR " \$directories{SRCDATA} = \"$directories{SRCDATA}\"\n" + if exists $directories{SRCDATA}; print STDERR " \$directories{RESULTS} = \"$directories{RESULTS}\"\n"; print STDERR " \$directories{BLDAPPS} = \"$directories{BLDAPPS}\"\n"; print STDERR " \$directories{SRCAPPS} = \"$directories{SRCAPPS}\"\n";