refactor(3p/lisp/mime4cl/test): create one test case per sample file
Since rt.lisp seems to start tests in parallel, the informational output about which sample file is being tested gets mangled in all sorts of ways. The solution is to just loop over the sample files outside a test and schedule a single test case per sample file from there. Change-Id: I4494e4a526ce6d92a298cf7daf06c8013c7ca605 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8569 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
This commit is contained in:
parent
e815b680c0
commit
a4d740af2e
2 changed files with 24 additions and 22 deletions
26
third_party/lisp/mime4cl/test/mime.lisp
vendored
26
third_party/lisp/mime4cl/test/mime.lisp
vendored
|
@ -27,17 +27,15 @@
|
|||
*load-pathname*
|
||||
#P"")))
|
||||
|
||||
(deftest mime.1
|
||||
(loop
|
||||
for f in (directory (make-pathname :defaults *samples-directory*
|
||||
:name :wild
|
||||
:type "msg"))
|
||||
do
|
||||
(format t "~A:~%" f)
|
||||
(finish-output)
|
||||
(let* ((orig (mime-message f))
|
||||
(dup (mime-message (with-output-to-string (out) (encode-mime-part orig out)))))
|
||||
(unless (mime= orig dup)
|
||||
(return nil)))
|
||||
finally (return t))
|
||||
t)
|
||||
(loop
|
||||
for f in (directory (make-pathname :defaults *samples-directory*
|
||||
:name :wild
|
||||
:type "msg"))
|
||||
for i from 1
|
||||
do
|
||||
(add-test (intern (format nil "MIME.~A" i))
|
||||
`(let* ((orig (mime-message ,f))
|
||||
(dup (mime-message
|
||||
(with-output-to-string (out) (encode-mime-part orig out)))))
|
||||
(mime= orig dup))
|
||||
t))
|
||||
|
|
20
third_party/lisp/mime4cl/test/rt.lisp
vendored
20
third_party/lisp/mime4cl/test/rt.lisp
vendored
|
@ -1,5 +1,6 @@
|
|||
#|----------------------------------------------------------------------------|
|
||||
| Copyright 1990 by the Massachusetts Institute of Technology, Cambridge MA. |
|
||||
| Copyright 2023 by the TVL Authors |
|
||||
| |
|
||||
| Permission to use, copy, modify, and distribute this software and its |
|
||||
| documentation for any purpose and without fee is hereby granted, provided |
|
||||
|
@ -20,10 +21,10 @@
|
|||
|----------------------------------------------------------------------------|#
|
||||
|
||||
(defpackage #:regression-test
|
||||
(:nicknames #:rtest #-lispworks #:rt)
|
||||
(:nicknames #:rtest #-lispworks #:rt)
|
||||
(:use #:cl)
|
||||
(:export #:*do-tests-when-defined* #:*test* #:continue-testing
|
||||
#:deftest #:do-test #:do-tests #:get-test #:pending-tests
|
||||
#:deftest #:add-test #:do-test #:do-tests #:get-test #:pending-tests
|
||||
#:rem-all-tests #:rem-test)
|
||||
(:documentation "The MIT regression tester with pfdietz's modifications"))
|
||||
|
||||
|
@ -86,25 +87,28 @@
|
|||
(defmacro deftest (name form &rest values)
|
||||
`(add-entry '(t ,name ,form .,values)))
|
||||
|
||||
(defun add-test (name form &rest values)
|
||||
(funcall #'add-entry (append (list 't name form) values)))
|
||||
|
||||
(defun add-entry (entry)
|
||||
(setq entry (copy-list entry))
|
||||
(do ((l *entries* (cdr l))) (nil)
|
||||
(when (null (cdr l))
|
||||
(setf (cdr l) (list entry))
|
||||
(return nil))
|
||||
(when (equal (name (cadr l))
|
||||
(when (equal (name (cadr l))
|
||||
(name entry))
|
||||
(setf (cadr l) entry)
|
||||
(report-error nil
|
||||
"Redefining test ~:@(~S~)"
|
||||
(name entry))
|
||||
"Redefining test ~:@(~S~)"
|
||||
(name entry))
|
||||
(return nil)))
|
||||
(when *do-tests-when-defined*
|
||||
(do-entry entry))
|
||||
(setq *test* (name entry)))
|
||||
|
||||
(defun report-error (error? &rest args)
|
||||
(cond (*debug*
|
||||
(cond (*debug*
|
||||
(apply #'format t args)
|
||||
(if error? (throw '*debug* nil)))
|
||||
(error? (apply #'error args))
|
||||
|
@ -184,7 +188,7 @@
|
|||
(setf (pend entry)
|
||||
(or aborted
|
||||
(not (equalp-with-case r (vals entry)))))
|
||||
|
||||
|
||||
(when (pend entry)
|
||||
(let ((*print-circle* *print-circle-on-failure*))
|
||||
(format s "~&Test ~:@(~S~) failed~
|
||||
|
@ -210,7 +214,7 @@
|
|||
(setf (pend entry) t))
|
||||
(if (streamp out)
|
||||
(do-entries out)
|
||||
(with-open-file
|
||||
(with-open-file
|
||||
(stream out :direction :output)
|
||||
(do-entries stream))))
|
||||
|
||||
|
|
Loading…
Reference in a new issue