Subject: bug#27708: [PROPOSED] Simplify configuration of HAVE_GNUTLS3 etc.

From: Ted Zlatanov <[email-masked]>
Date: Thu, 03 Aug 2017 16:20:12 -0400

On Thu, 03 Aug 2017 12:06:30 -0400 Glenn Morris <[email-masked]> wrote: 

GM> This causes a test failure in test-gnutls-000-availability.
GM> https://hydra.nixos.org/build/57926906

GM> (Reproduced on rhel7 with gnutls-3.3.24.)

I think that this means that one of MD5, SHA1, SHA224, SHA256, SHA384,
or SHA512 (the `secure-hash-algorithms' members currently) are not in
that version of GnuTLS.

That is not really necessary. I was overzealous writing the tests; we
can just test the `secure-hash-algorithms' that are in GnuTLS. Can we
check the patch below against Hydra without pushing it to master yet?

(I'm having a strange problem building Emacs as of this morning, so I
haven't been able to test the patch fully. Sorry.)

Thanks
Ted

diff --git a/test/lisp/net/gnutls-tests.el b/test/lisp/net/gnutls-tests.el
index 9dbb6c05b9..94dcb6c4ce 100644
--- a/test/lisp/net/gnutls-tests.el
+++ b/test/lisp/net/gnutls-tests.el
@@ -41,8 +41,10 @@ gnutls-tests-hexstring-equal
   (and (stringp a) (stringp b) (string-equal (encode-hex-string a) (encode-hex-string b))))

 (defvar gnutls-tests-internal-macs-upcased
-  (mapcar (lambda (sym) (cons sym (intern (upcase (symbol-name sym)))))
-          (secure-hash-algorithms)))
+  (cl-intersection
+   (mapcar (lambda (sym) (cons sym (intern (upcase (symbol-name sym)))))
+           (secure-hash-algorithms))
+   (mapcar 'car (gnutls-macs))))

 (defvar gnutls-tests-tested-macs
   (when (gnutls-available-p)