Fix typo in CONTRIBUTING.md
[openssl.git] / test / recipes / 05-test_rand.t
index 4a080cb910b602a1f18bd163d0a0bfb5f6e7fc8a..dac37b8fd131e7b0b4a83f939652953ccd7386f6 100644 (file)
@@ -11,7 +11,34 @@ use warnings;
 use OpenSSL::Test;
 use OpenSSL::Test::Utils;
 
-plan tests => 1;
+plan tests => 5;
 setup("test_rand");
 
+ok(run(test(["rand_test"])));
 ok(run(test(["drbgtest"])));
+ok(run(test(["rand_status_test"])));
+
+SKIP: {
+    skip "engine is not supported by this OpenSSL build", 2
+        if disabled("engine") || disabled("dynamic-engine");
+
+    my $success;
+    my @randdata;
+    my $expected = '0102030405060708090a0b0c0d0e0f10';
+
+    @randdata = run(app(['openssl', 'rand', '-engine', 'ossltest', '-hex', '16' ]),
+                    capture => 1, statusvar => \$success);
+    chomp(@randdata);
+    ok($success && $randdata[0] eq $expected,
+       "rand with ossltest: Check rand output is as expected");
+
+    @randdata = run(app(['openssl', 'rand', '-hex', '2K' ]),
+                    capture => 1, statusvar => \$success);
+    chomp(@randdata);
+
+    @randdata = run(app(['openssl', 'rand', '-engine', 'dasync', '-hex', '16' ]),
+                    capture => 1, statusvar => \$success);
+    chomp(@randdata);
+    ok($success && length($randdata[0]) == 32,
+       "rand with dasync: Check rand output is of expected length");
+}