aboutsummaryrefslogtreecommitdiffstats
path: root/test/shlibloadtest.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2018-03-14 17:31:20 +0100
committerRichard Levitte <levitte@openssl.org>2018-03-19 07:08:51 +0100
commit00c8f1b05cd5e815d21e51737505e901d572e09c (patch)
tree9792512b5dcda71659cb6da1e78c1ea23f349a2b /test/shlibloadtest.c
parentb4d46ad27078fa71bbc7270b667a7764d87d6f0f (diff)
downloadopenssl-00c8f1b05cd5e815d21e51737505e901d572e09c.tar.gz
Stop test/shlibloadtest.c from failing in a regression test
When doing a regression test, it's obvious that the version test/shlibloadtest is built for will not be the same as the library version. So we change the test to check for assumed compatibility. Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5619)
Diffstat (limited to 'test/shlibloadtest.c')
-rw-r--r--test/shlibloadtest.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/shlibloadtest.c b/test/shlibloadtest.c
index 5f8ec55af2..0bf24eee07 100644
--- a/test/shlibloadtest.c
+++ b/test/shlibloadtest.c
@@ -141,8 +141,20 @@ static int test_lib(void)
myERR_get_error = (ERR_get_error_t)symbols[0].func;
if (!TEST_int_eq(myERR_get_error(), 0))
goto end;
+
+ /*
+ * The bits that COMPATIBILITY_MASK lets through MUST be the same in
+ * the library and in the application.
+ * The bits that are masked away MUST be a larger or equal number in
+ * the library compared to the application.
+ */
+# define COMPATIBILITY_MASK 0xfff00000L
myOpenSSL_version_num = (OpenSSL_version_num_t)symbols[1].func;
- if (!TEST_int_eq(myOpenSSL_version_num(), OPENSSL_VERSION_NUMBER))
+ if (!TEST_int_eq(myOpenSSL_version_num() & COMPATIBILITY_MASK,
+ OPENSSL_VERSION_NUMBER & COMPATIBILITY_MASK)
+ goto end;
+ if (!TEST_int_ge(myOpenSSL_version_num() & ~COMPATIBILITY_MASK,
+ OPENSSL_VERSION_NUMBER & ~COMPATIBILITY_MASK)
goto end;
switch (test_type) {