I am trying to understand following Perl script. I am C programmer but could not understand this script:
use OpenSSL::Test::Utils;
use OpenSSL::Test qw/:DEFAULT srctop_file/;
my $test_name = "test_sysdefault";
setup($test_name);
plan skip_all => "$test_name is not supported in this build"
if disabled("tls1_2") || disabled("rsa");
plan tests => 1;
$ENV{OPENSSL_CONF} = srctop_file("test", "sysdefault.cnf");
ok(run(test(["sysdefaulttest"])), "sysdefaulttest");
The problem is that the following definition in .c file 'test_data_int_test.h' is not taking effect as expected:
/* sysdefault.cnf */
char _sysdefault_cnf[] =
"# Configuration file to test system default SSL configuration\n"
"\n"
"openssl_conf = default_conf\n"
"\n"
"[ default_conf ]\n"
"\n"
"ssl_conf = ssl_sect\n"
"\n"
"[ssl_sect]\n"
"\n"
"system_default = ssl_default_sect\n"
"\n"
"[ssl_default_sect]\n"
"MaxProtocol = TLSv1.2\n"
"MinProtocol = TLSv1.2\n";
Specially its last 2 lines in which min and max values are set to TLSv1.2.
Do I need to modify the above perl script in any way?
CodePudding user response:
OpenSSL::Test isn't on CPAN, so this is all (educated) guesswork. You should probably confirm this with whoever supplied you with the module.
It looks like OpenSSL::Test inherits from a standard Perl testing module like Test::More or Test::Class so reading their documentation will be helpful to you.
Perl test suites always include a plan. This is just the number of tests that are expected to be run. The test suite will be run in some kind of test harness (commonly prove
) and the test harness will compare the expected number of tests to the number that are actually run and can therefore tell if something weird has happened when those two numbers don't match. For example, if the number of tests run is fewer than the number expected, that might mean that your test program crashed before completing.
In your code, there's one test (the line of code that calls ok()
) so we set the test plan to 1.