1 | ;;;; $Id$ |
---|
2 | ;;;; |
---|
3 | ;;;; Parse ANSI test results from a s-expr database, allowing queries |
---|
4 | ;;;; to show differences. |
---|
5 | ;;;; |
---|
6 | ;;;; 'cuz I get lost after comparing about five items in a list |
---|
7 | ;;;; |
---|
8 | |
---|
9 | #| |
---|
10 | |
---|
11 | To use |
---|
12 | |
---|
13 | 1. Create a "database" of test results consisting of s-exps. A |
---|
14 | default database is in 'failures'. |
---|
15 | |
---|
16 | The s-exprs have the form: |
---|
17 | |
---|
18 | (compileit|doit <version> :id <id> [:<key> <value>] |
---|
19 | (<failing test results>)) |
---|
20 | |
---|
21 | where |
---|
22 | |
---|
23 | compileit|doit The symbol 'compileit' or 'doit' depending on |
---|
24 | whether the compiled or interpreted tests were run. |
---|
25 | |
---|
26 | version A symbol identifying the version of source of the |
---|
27 | tests (i.e. r12506 or 0.18.0) |
---|
28 | |
---|
29 | :id <id> <id> is a symbol identifying the environment for |
---|
30 | the tests |
---|
31 | |
---|
32 | :key <value> Additional key-value pairs |
---|
33 | |
---|
34 | <failing test results> |
---|
35 | The list of symbols failing the tests. |
---|
36 | |
---|
37 | An example on an entry: |
---|
38 | |
---|
39 | (doit r12506 :id jupiter |
---|
40 | :uname "i386-pc-solaris2.11" :jvm "jdk-1.6.0_13" |
---|
41 | (REINITIALIZE-INSTANCE.ERROR.1 DEFGENERIC.ERROR.20 |
---|
42 | DEFGENERIC.ERROR.21 DEFGENERIC.30 CALL-NEXT-METHOD.ERROR.1 |
---|
43 | CALL-NEXT-METHOD.ERROR.2 DEFMETHOD.ERROR.14 DEFMETHOD.ERROR.15 |
---|
44 | INVOKE-DEBUGGER.1 MAKE-CONDITION.3 MAKE-CONDITION.4 |
---|
45 | DELETE-PACKAGE.5 DELETE-PACKAGE.6 MAP.48 TYPE-OF.1 TYPE-OF.4 |
---|
46 | CHAR-UPCASE.2 CHAR-DOWNCASE.2 FRESH-LINE.5 PRINT.RANDOM-STATE.1 |
---|
47 | PPRINT-FILL.14 PPRINT-FILL.15 PPRINT-LINEAR.14 PPRINT-TABULAR.13 |
---|
48 | PPRINT-LOGICAL-BLOCK.17 PPRINT-POP.7 PPRINT-POP.8 |
---|
49 | FORMAT.LOGICAL-BLOCK.CIRCLE.1 FORMAT.LOGICAL-BLOCK.CIRCLE.2 |
---|
50 | FORMAT.LOGICAL-BLOCK.CIRCLE.3 FORMAT.JUSTIFY.30 FORMAT.JUSTIFY.32 |
---|
51 | WITH-STANDARD-IO-SYNTAX.23)) |
---|
52 | |
---|
53 | 2. Run (PARSE [<filename>]) on the file of your database. Without an |
---|
54 | argument, the default database is read. |
---|
55 | |
---|
56 | 3. Then differences between versions can be queried via REPORT |
---|
57 | |
---|
58 | CL-USER> (REPORT 'compileit '0.18.0 'r13590) |
---|
59 | |
---|
60 | |# |
---|
61 | |
---|
62 | (in-package :abcl.test.ansi) |
---|
63 | |
---|
64 | (defvar *doit* (make-hash-table)) |
---|
65 | (defvar *compileit* (make-hash-table)) |
---|
66 | (defvar *id* (make-hash-table)) |
---|
67 | |
---|
68 | (defun reset () |
---|
69 | (clrhash *doit*) |
---|
70 | (clrhash *compileit*) |
---|
71 | (clrhash *id*)) |
---|
72 | |
---|
73 | (defun get-hash-table (test) |
---|
74 | (getf `(doit ,*doit* compileit ,*compileit*) test)) |
---|
75 | |
---|
76 | (defvar *default-database-file* |
---|
77 | (if (find :asdf2 *features*) |
---|
78 | (asdf:system-relative-pathname :ansi-compiled "test/lisp/ansi/ansi-test-failures") |
---|
79 | (merge-pathnames "ansi-test-failures" (directory-namestring *load-truename*)))) |
---|
80 | |
---|
81 | (defun parse (&optional (file *default-database-file*)) |
---|
82 | (format t "Parsing test report database from ~A~%" *default-database-file*) |
---|
83 | (with-open-file (s file :direction :input) |
---|
84 | (do ((form (read s) (read s nil nil))) |
---|
85 | ((null form)) |
---|
86 | (destructuring-bind (test version &rest rest) form |
---|
87 | (let ((args) (failures) (id)) |
---|
88 | (dolist (arg rest) |
---|
89 | (if (typep arg 'cons) |
---|
90 | (setf failures arg) |
---|
91 | (push arg args))) |
---|
92 | (setf args (nreverse args)) |
---|
93 | (unless (getf args :id) |
---|
94 | (push 'noid args) |
---|
95 | (push :id args)) |
---|
96 | (setf id (getf args :id)) |
---|
97 | (if (> (length args) 2) |
---|
98 | (setf (gethash id *id*) args) |
---|
99 | (if (null (gethash id *id*)) |
---|
100 | (setf (gethash id *id*) args))) |
---|
101 | (when (null (gethash version (get-hash-table test))) |
---|
102 | (setf (gethash version (get-hash-table test)) |
---|
103 | (make-hash-table))) |
---|
104 | (setf (gethash id |
---|
105 | (gethash version (get-hash-table test))) |
---|
106 | failures)))))) |
---|
107 | |
---|
108 | (defun versions (test) |
---|
109 | (loop :for key :being :the :hash-keys :of (get-hash-table test) |
---|
110 | :collecting key)) |
---|
111 | |
---|
112 | (defun report-versions (&optional (test 'compileit)) |
---|
113 | (format t "~A has the following versions:~%~A~%" |
---|
114 | test (versions test)) |
---|
115 | (values)) |
---|
116 | |
---|
117 | (defun get-failures (test version) |
---|
118 | (gethash version (get-hash-table test))) |
---|
119 | |
---|
120 | (defun difference (failures-1 failures-2) |
---|
121 | (list |
---|
122 | (list (length failures-1) |
---|
123 | (set-difference failures-1 failures-2)) |
---|
124 | (list (length failures-2) |
---|
125 | (set-difference failures-2 failures-1)))) |
---|
126 | |
---|
127 | (defun generate-report (test version-1 version-2) |
---|
128 | (flet ((list-results (hash-table) |
---|
129 | (loop |
---|
130 | :for key :being :the :hash-key :of hash-table |
---|
131 | :using (:hash-value value) |
---|
132 | :collecting (list key value)))) |
---|
133 | (let ((entries-1 (list-results (get-failures test version-1))) |
---|
134 | (entries-2 (list-results (get-failures test version-2)))) |
---|
135 | (loop :for (id-1 failure-1) :in entries-1 |
---|
136 | :appending (loop :for (id-2 failure-2) :in entries-2 |
---|
137 | :collecting (list (cons id-1 id-2) |
---|
138 | (difference failure-1 |
---|
139 | failure-2))))))) |
---|
140 | |
---|
141 | (defun report (test version-1 version-2) |
---|
142 | (let ((reports (generate-report test version-1 version-2))) |
---|
143 | (dolist (report reports) |
---|
144 | (destructuring-bind ((id1 . id2) ((total-failures1 diff-1->2) |
---|
145 | (total-failures2 diff-2->1))) |
---|
146 | report |
---|
147 | (when diff-1->2 |
---|
148 | (format t "~A[~A] --> ~A[~A] additional failures:~%~A~%" |
---|
149 | version-1 id1 version-2 id2 diff-1->2)) |
---|
150 | (when diff-2->1 |
---|
151 | (format t "~A[~A] --> ~A[~A] additional failures:~%~A~%" |
---|
152 | version-2 id2 version-1 id1 diff-2->1)))))) |
---|
153 | |
---|
154 | |
---|