OpenSSL::Test: add data_dir()
[openssl.git] / util / perl / OpenSSL / Test.pm
index f4b1b50d8b8a14a5d44ca7cfe51072cfd3e03b1b..19141e91acfa44daeaf479eb53ccb71edab68dba 100644 (file)
@@ -607,6 +607,23 @@ sub srctop_file {
 
 =over 4
 
 
 =over 4
 
+=item B<data_dir LIST>
+
+LIST is a list of directories that make up a path from the data directory
+associated with the test (see L</DESCRIPTION> above).
+C<data_dir> returns the resulting directory as a string, adapted to the local
+operating system.
+
+=back
+
+=cut
+
+sub data_dir {
+    return __data_dir(@_);
+}
+
+=over 4
+
 =item B<data_file LIST, FILENAME>
 
 LIST is a list of directories that make up a path from the data directory
 =item B<data_file LIST, FILENAME>
 
 LIST is a list of directories that make up a path from the data directory
@@ -967,6 +984,12 @@ sub __data_file {
     return catfile($directories{SRCDATA},@_,$f);
 }
 
     return catfile($directories{SRCDATA},@_,$f);
 }
 
+sub __data_dir {
+    BAIL_OUT("Must run setup() first") if (! $test_name);
+
+    return catdir($directories{SRCDATA},@_);
+}
+
 sub __results_file {
     BAIL_OUT("Must run setup() first") if (! $test_name);
 
 sub __results_file {
     BAIL_OUT("Must run setup() first") if (! $test_name);