Commit c9fb84c8 authored by Raymond Toy's avatar Raymond Toy
Browse files

Set the random-state when running the test, not when loading the file

This way we can run `(asdf:test-system :oct)` as many times as we want
and get consistent results.

This needs work for other lisps.
parent 080258d9
Pipeline #2322 passed with stage
in 1 minute and 49 seconds
......@@ -86,9 +86,21 @@
(:file "rt-tests")))))
(defmethod perform ((op test-op) (c (eql (asdf:find-system :oct/tests))))
(let* ((rt-package (find-package "RT"))
(pass (funcall (intern "DO-TESTS" rt-package)))
(unexpected-failures (symbol-value (find-symbol "*UNEXPECTED-FAILURES*" rt-package)))
(unexpected-successes (symbol-value (find-symbol "*UNEXPECTED-SUCCESSES*" rt-package))))
(or (and (null unexpected-failures) (null unexpected-successes))
(error "TEST-OP failed for OCT-TESTS"))))
;; Set the initial random state when running tests so that we get
;; consistent test results between runs. Currently only works with
;; cmucl.
;;
;; TODO: Figure out how to initialize the random state to a known
;; value for other lisps.
(let* ((*random-state*
#+cmucl
(kernel::make-random-object :state (kernel:init-random-state))
#-cmucl
(make-random-state nil)))
(format t "Test random-state ~A~%" *random-state*)
(let* ((rt-package (find-package "RT"))
(pass (funcall (intern "DO-TESTS" rt-package)))
(unexpected-failures (symbol-value (find-symbol "*UNEXPECTED-FAILURES*" rt-package)))
(unexpected-successes (symbol-value (find-symbol "*UNEXPECTED-SUCCESSES*" rt-package))))
(or (and (null unexpected-failures) (null unexpected-successes))
(error "TEST-OP failed for OCT-TESTS")))))
......@@ -90,17 +90,6 @@
bessel-j-1/2-complex.d.1
bessel-j-1/2-complex.q.1))
;; For cmucl, initialize *random-state* to a fixed starting point for
;; testing. If you want to change the starting state, just supply an
;; arg to init-random-state.
;;
;; TODO: Add support for other lisps.
#+cmucl
(setf *random-state* (kernel::make-random-object :state (kernel:init-random-state)))
(format t "random-state = ~S~%" *random-state*)
;;; Some simple tests from the Yozo Hida's qd package.
(rt:deftest float.1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment