gnu: icedtea-7: Run tests conditionally.

* gnu/packages/java.scm (icedtea-7)[arguments]: Respect TESTS? in 'check
phase.
This commit is contained in:
Ricardo Wurmus 2021-12-16 09:15:25 +01:00
parent 35bac40a67
commit 9e6baab2d8
No known key found for this signature in database
GPG key ID: 197A5888235FACAC

View file

@ -1618,30 +1618,29 @@ (define-public icedtea-7
(("/bin/sh") (which "sh")))) (("/bin/sh") (which "sh"))))
#t)) #t))
(replace 'check (replace 'check
(lambda _ (lambda* (#:key tests? #:allow-other-keys)
;; The "make check-*" targets always return zero, so we need to ;; The "make check-*" targets always return zero, so we need to
;; check for errors in the associated log files to determine ;; check for errors in the associated log files to determine
;; whether any tests have failed. ;; whether any tests have failed.
(use-modules (ice-9 rdelim)) (when tests?
(let* ((error-pattern (make-regexp "^(Error|FAILED):.*")) (use-modules (ice-9 rdelim))
(checker (lambda (port) (let* ((error-pattern (make-regexp "^(Error|FAILED):.*"))
(let loop () (checker (lambda (port)
(let ((line (read-line port))) (let loop ()
(cond (let ((line (read-line port)))
((eof-object? line) #t) (cond
((regexp-exec error-pattern line) ((eof-object? line) #t)
(error "test failed")) ((regexp-exec error-pattern line)
(else (loop))))))) (error "test failed"))
(run-test (lambda (test) (else (loop)))))))
(invoke "make" test) (run-test (lambda (test)
(call-with-input-file (invoke "make" test)
(string-append "test/" test ".log") (call-with-input-file
checker)))) (string-append "test/" test ".log")
(when #f ; skip tests checker))))
(run-test "check-hotspot") (run-test "check-hotspot")
(run-test "check-langtools") (run-test "check-langtools")
(run-test "check-jdk")) (run-test "check-jdk")))))
#t)))
(replace 'install (replace 'install
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
(let ((doc (string-append (assoc-ref outputs "doc") (let ((doc (string-append (assoc-ref outputs "doc")