Modify test/afalgtest to fail if the afalg engine couldn't be loaded
authorRichard Levitte <levitte@openssl.org>
Wed, 7 Feb 2018 13:01:13 +0000 (14:01 +0100)
committerRichard Levitte <levitte@openssl.org>
Wed, 7 Feb 2018 15:15:47 +0000 (16:15 +0100)
If you know that there's no afalg engine, don't run this test.
test/recipes/30-test_afalg.t checks this correctly.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5270)

test/afalgtest.c

index adb2977f3028e63e44f239efb6e96d118a95411f..bf9054554ae8fc627ca8d67fb82b92feabc83982 100644 (file)
@@ -128,14 +128,14 @@ int global_init(void)
 int setup_tests(void)
 {
 #ifndef OPENSSL_NO_ENGINE
-    if ((e = ENGINE_by_id("afalg")) == NULL) {
+    if (!TEST_ptr(e = ENGINE_by_id("afalg"))) {
         /* Probably a platform env issue, not a test failure. */
-        TEST_info("Can't load AFALG engine");
-    } else {
+        TEST_info("Can't load AFALG engine, you might want to check $OPENSSL_ENGINES");
+        return 0;
+    }
 # ifndef OPENSSL_NO_AFALGENG
-        ADD_ALL_TESTS(test_afalg_aes_cbc, 3);
+    ADD_ALL_TESTS(test_afalg_aes_cbc, 3);
 # endif
-    }
 #endif
 
     return 1;