Fix crypt-on-glibc test error
authorAndy Wingo <wingo@pobox.com>
Fri, 1 Feb 2019 16:18:50 +0000 (17:18 +0100)
committerAndy Wingo <wingo@igalia.com>
Thu, 21 Feb 2019 10:13:28 +0000 (11:13 +0100)
* test-suite/tests/posix.test ("crypt"): Allow for the given salt being
  valid.  Thanks to Jonathan Brielmaier for the report and debugging!

test-suite/tests/posix.test

index d3170c7430d339ec8b4b4ded7af17a3d1f64bd9e..87a0c704a491c3e7268e457d500d8f5f48415c60 100644 (file)
   (pass-if "basic usage"
     (string? (crypt "pass" "abcdefg")))
 
-  (pass-if-exception "glibc EINVAL" exception:system-error
-    ;; This used to deadlock while trying to throw to 'system-error'.
-    ;; This test uses the special interpretation of the salt that glibc
-    ;; does; specifically, we pass a syntactically invalid salt here.
-    (if (string-contains %host-type "-gnu")
-        (crypt "pass" "$X$abc")                   ;EINVAL
-        (throw 'unresolved))))
+  (pass-if "crypt invalid salt on glibc"
+    (begin
+      (unless (string-contains %host-type "-gnu")
+        (throw 'unresolved))
+      (catch 'system-error
+             (lambda ()
+               ;; This used to deadlock on glibc while trying to throw to
+               ;; 'system-error'.  This test uses the special
+               ;; interpretation of the salt that glibc does;
+               ;; specifically, we pass a salt that's probably
+               ;; syntactically invalid here.  Note, whether it's invalid
+               ;; or not is system-defined, so it's possible it just works.
+               (string? (crypt "pass" "$X$abc")))
+             (lambda _ #t)))))