Megatest

Check-in [6b05707512]
Login
Overview
Comment:Couple tweaks to html output of the items rollup
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6b0570751298cdcc5f3ba3cc4baa60fd7cf60f54
User & Date: mrwellan on 2011-08-03 11:23:30
Other Links: manifest | tags
Context
2011-08-03
13:28
Couple more tweaks to html output of the items rollup check-in: b2ba4571a3 user: mrwellan tags: trunk
11:23
Couple tweaks to html output of the items rollup check-in: 6b05707512 user: mrwellan tags: trunk
2011-08-02
23:27
Added auto-rolling up of item status into an html file check-in: 40fcb78bd6 user: matt tags: trunk, v1.19
Changes

Modified runs.scm from [2ce4434f2f] to [d8685b31e4].

153
154
155
156
157
158
159
160




161
162
163
164

165
166


167
168
169
170
171
172
173


174
175
176
177
178





















179
180
181
182
183
184
185
186
    (if (or (equal? logf "logs/final.log")
	    (equal? logf outputfilename)
	    force)
	(begin
	  (if (obtain-dot-lock outputfilename 1 20 30) ;; retry every second for 20 seconds, call it dead after 30 seconds and steal the lock
	      (print "Obtained lock for " outputfilename)
	      (print "Failed to obtain lock for " outputfilename))
	  (let ((oup   (open-output-file outputfilename)))




	    (with-output-to-port
		oup
	      (lambda ()
		(print "<html><title>Summary: " test-name "</title><body><h1>Summary for " test-name "<table>")

		(sqlite3:for-each-row 
		 (lambda (id itempath state status run_duration logf comment)


		   (print "<tr>"
			  "<td><a href=\"" itempath "/" logf "\"</a>" itempath "</td>" 
			  "<td>" state    "</td>" 
			  "<td><font color=" (cond
					      ((equal? status "PASS") "green")
					      ((equal? status "FAIL") "red")
					      (else "blue")) ">"   status   "</font></td>"


					      "<td>" comment  "</td>"
					      "</tr>"))
		 db
		 "SELECT id,item_path,state,status,run_duration,final_logf,comment FROM tests WHERE run_id=? AND testname=? AND item_path != '';"
		 run-id test-name)





















		(print "</body></html>")
		(release-dot-lock outputfilename)))
	    (close-output-port oup)
	    (change-directory orig-dir)
	    (test-set-toplog! db run-id test-name outputfilename)
	    )))))

;; ;; TODO: Converge this with db:get-test-info







|
>
>
>
>



|
>


>
>
|
|
|
|
|
|
|
>
>
|
|



>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
    (if (or (equal? logf "logs/final.log")
	    (equal? logf outputfilename)
	    force)
	(begin
	  (if (obtain-dot-lock outputfilename 1 20 30) ;; retry every second for 20 seconds, call it dead after 30 seconds and steal the lock
	      (print "Obtained lock for " outputfilename)
	      (print "Failed to obtain lock for " outputfilename))
	  (let ((oup    (open-output-file outputfilename))
		(counts (make-hash-table))
		(statecounts (make-hash-table))
		(outtxt "")
		(tot    0))
	    (with-output-to-port
		oup
	      (lambda ()
		(set! outtxt (conc outtxt "<html><title>Summary: " test-name 
				   "</title><body><h2>Summary for " test-name "</h2>"))
		(sqlite3:for-each-row 
		 (lambda (id itempath state status run_duration logf comment)
		   (hash-table-set! counts status (+ 1 (hash-table-ref/default counts status 0)))
		   (hash-table-set! statecounts state (+ 1 (hash-table-ref/default statecounts state 0)))
		   (set! outtxt (conc outtxt "<tr>"
				      "<td><a href=\"" itempath "/" logf "\"> " itempath "</a></td>" 
				      "<td>" state    "</td>" 
				      "<td><font color=" (cond
							  ((equal? status "PASS") "green")
							  ((equal? status "FAIL") "red")
							  (else "blue")) ">"   status   "</font></td>"
							  "<td>" (if (equal? comment "")
								     "&nbsp;"
								     comment) "</td>"
							  "</tr>")))
		 db
		 "SELECT id,item_path,state,status,run_duration,final_logf,comment FROM tests WHERE run_id=? AND testname=? AND item_path != '';"
		 run-id test-name)

		;; Print out stats for status
		(set! tot 0)
		(print "<h2>State stats</h2><table cellspacing=\"0\" border=\"1\">")
		(for-each (lambda (state)
			    (set! tot (+ tot (hash-table-ref statecounts state)))
			    (print "<tr><td>" state "</td><td>" (hash-table-ref statecounts state) "</td></tr>"))
			  (hash-table-keys statecounts))
		(print "<tr><td>Total</td><td>" tot "</td></tr></table>")

		;; Print out stats for state
		(set! tot 0)
		(print "<h2>Status stats</h2><table cellspacing=\"0\" border=\"1\">")
		(for-each (lambda (status)
			    (set! tot (+ tot (hash-table-ref counts status)))
			    (print "<tr><td>" status "</td><td>" (hash-table-ref counts status) "</td></tr>"))
			  (hash-table-keys counts))
		(print "<tr><td>Total</td><td>" tot "</td></tr></table>")

		(print "<table cellspacing=\"0\" border=\"1\">" 
		       "<tr><td>Item</td><td>State</td><td>Status</td><td>Comment</td>"
		       outtxt "</table></body></html>")
		(release-dot-lock outputfilename)))
	    (close-output-port oup)
	    (change-directory orig-dir)
	    (test-set-toplog! db run-id test-name outputfilename)
	    )))))

;; ;; TODO: Converge this with db:get-test-info