Raymond Toy pushed to branch issue-255-add-sacla-tests at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • .gitignore
    ... ... @@ -12,7 +12,7 @@
    12 12
     *.x86f
    
    13 13
     *~
    
    14 14
     /test-tmp
    
    15
    -build-*
    
    15
    +/build-*
    
    16 16
     darwin-8bit-[234]
    
    17 17
     darwin-[234]
    
    18 18
     linux-8bit-[234]
    

  • sacla/build-sacla-tests.lisp
    1
    +(defun get-sacla-test-files ()
    
    2
    +  (let ((test-files
    
    3
    +         ;; We only want files named "must-*.lisp", using a cmucl
    
    4
    +         ;; pathname extension.
    
    5
    +         (directory "lisp/tests/must-*.lisp")))
    
    6
    +    test-files))
    
    7
    +
    
    8
    +(defun process-one-file (file)
    
    9
    +  (let* ((base-name (pathname-name file))
    
    10
    +         (output-file (make-pathname :name (pathname-name file)
    
    11
    +                                     :type (pathname-type file)))
    
    12
    +         (test-base-name (symbolicate "SACLA-" (string-upcase base-name)))
    
    13
    +         (*print-case* :downcase))
    
    14
    +  (with-open-file (output output-file
    
    15
    +                          :direction :output
    
    16
    +                          :if-exists :supersede)
    
    17
    +    (format *trace-output* "load-truename ~S~%" *load-truename*)
    
    18
    +    (format *trace-output* "Reading ~S~%" file)
    
    19
    +    (format *trace-output* "Writing ~S~%" output-file)
    
    20
    +    (format output "(in-package #:sacla-lisp-unit)~%")
    
    21
    +    (with-open-file (input file)
    
    22
    +      (loop for count from 1
    
    23
    +            for sexp = (read input nil)
    
    24
    +            while sexp
    
    25
    +            do (progn
    
    26
    +                 (write `(define-test ,(symbolicate test-base-name (format nil ".~d" count))
    
    27
    +                           (:tag ,(intern (string test-base-name) :keyword))
    
    28
    +                           (assert-true ,sexp))
    
    29
    +                        :stream output
    
    30
    +                        :circle t
    
    31
    +                        :level nil
    
    32
    +                        :length nil)
    
    33
    +                 (terpri output))))
    
    34
    +      (terpri output))))
    
    35
    +
    
    36
    +(defun create-lisp-unit-sacla-tests ()
    
    37
    +  (let ((test-files (get-sacla-test-files)))
    
    38
    +    ;; For each test file, convert the file to a lisp-unit test file
    
    39
    +    ;; by wrapping each sexp in a define-test form.
    
    40
    +    (dolist (file test-files)
    
    41
    +      (process-one-file file))))