]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Improve openssl_version tests with better messages
authorNick Mathewson <nickm@torproject.org>
Mon, 21 May 2018 19:06:45 +0000 (15:06 -0400)
committerNick Mathewson <nickm@torproject.org>
Mon, 21 May 2018 19:16:07 +0000 (15:16 -0400)
These tests would report errors, but wouldn't report the offending
strings.

changes/bug26152 [new file with mode: 0644]
src/test/test_crypto.c

diff --git a/changes/bug26152 b/changes/bug26152
new file mode 100644 (file)
index 0000000..34fda09
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes (testing):
+    - When logging a version mismatch in our openssl_version tests,
+      report the actual offending version strings. Fixes bug 26152; bugfix on
+      0.2.9.1-alpha.
index 24eef156b00e7d151a9767a00e3c89892591883b..e3a41412f745e7e7306cc3945813d6cdbcb6dfce 100644 (file)
@@ -152,8 +152,13 @@ test_crypto_openssl_version(void *arg)
   const char *h_version = crypto_openssl_get_header_version_str();
   tt_assert(version);
   tt_assert(h_version);
-  tt_assert(!strcmpstart(version, h_version)); /* "-fips" suffix, etc */
-  tt_assert(!strstr(version, "OpenSSL"));
+  if (strcmpstart(version, h_version)) { /* "-fips" suffix, etc */
+    TT_DIE(("OpenSSL library version %s did not begin with header version %s.",
+            version, h_version));
+  }
+  if (strstr(version, "OpenSSL")) {
+    TT_DIE(("assertion failed: !strstr(\"%s\", \"OpenSSL\")", version));
+  }
   int a=-1,b=-1,c=-1;
   if (!strcmpstart(version, "LibreSSL") || !strcmpstart(version, "BoringSSL"))
     return;