diff options
author | Richard Levitte <levitte@openssl.org> | 2018-03-14 17:31:20 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2018-03-19 07:03:23 +0100 |
commit | f778cd2d89b3dfb2438df44f42e5a9082b213a71 (patch) | |
tree | a0ba1043e550a642c3e431fc03db8c17a6caa71a /test | |
parent | c8ee36792d69bc327d770453681acc7203ec6494 (diff) |
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/5620)
Diffstat (limited to 'test')
-rw-r--r-- | test/shlibloadtest.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/shlibloadtest.c b/test/shlibloadtest.c index 6f220ba530..6dae1118ae 100644 --- a/test/shlibloadtest.c +++ b/test/shlibloadtest.c @@ -196,7 +196,21 @@ int main(int argc, char **argv) return 1; } - if (OpenSSL_version_num() != OPENSSL_VERSION_NUMBER) { + /* + * 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 + if ((OpenSSL_version_num() & COMPATIBILITY_MASK) + != (OPENSSL_VERSION_NUMBER & COMPATIBILITY_MASK)) { + printf("Unexpected library version loaded\n"); + return 1; + } + + if ((OpenSSL_version_num() & ~COMPATIBILITY_MASK) + < (OPENSSL_VERSION_NUMBER & ~COMPATIBILITY_MASK)) { printf("Unexpected library version loaded\n"); return 1; } |