From bd60ac48a684bf1dae052a209e6624491abe8d27 Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Wed, 23 Sep 2020 18:58:17 +0200 Subject: [PATCH] Test.pm: Add result_dir and export both result_dir and result_file Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/12934) --- util/perl/OpenSSL/Test.pm | 49 ++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/util/perl/OpenSSL/Test.pm b/util/perl/OpenSSL/Test.pm index c44eca301c..4dc1bad188 100644 --- a/util/perl/OpenSSL/Test.pm +++ b/util/perl/OpenSSL/Test.pm @@ -21,6 +21,7 @@ $VERSION = "1.0"; @EXPORT_OK = (@Test::More::EXPORT_OK, qw(bldtop_dir bldtop_file srctop_dir srctop_file data_file data_dir + result_file result_dir pipe with cmdstr quotify openssl_versions ok_nofips is_nofips isnt_nofips)); @@ -124,8 +125,8 @@ most likely refuse to run. C checks for environment variables (see L below), checks that C<$TOP/Configure> or C<$SRCTOP/Configure> exists, C 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). +variable if defined, otherwise C<$BLDTOP/test-runs> or C<$TOP/test-runs>, +whichever is defined). =back @@ -651,6 +652,43 @@ sub data_file { =over 4 +=item B + +C returns the directory where test output files should be placed +as a string, adapted to the local operating system. + +=back + +=cut + +sub result_dir { + BAIL_OUT("Must run setup() first") if (! $test_name); + + return catfile($directories{RESULTS}); +} + +=over 4 + +=item B + +FILENAME is the name of a test output file. +C returns the path of the given file as a string, +prepending to the file name the path to the directory where test output files +should be placed, adapted to the local operating system. + +=back + +=cut + +sub result_file { + BAIL_OUT("Must run setup() first") if (! $test_name); + + my $f = pop; + return catfile(result_dir(),@_,$f); +} + +=over 4 + =item B LIST is a list of CODEREFs returned by C or C, from which C @@ -1067,13 +1105,6 @@ sub __data_dir { return catdir($directories{SRCDATA},@_); } -sub __results_file { - BAIL_OUT("Must run setup() first") if (! $test_name); - - my $f = pop; - return catfile($directories{RESULTS},@_,$f); -} - # __cwd DIR # __cwd DIR, OPTS # -- 2.34.1