Megatest

Check-in [7f93bdaf46]
Login
Overview
Comment:Commented out tweak for better sort logic, look in bubble-up
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.55
Files: files | file ages | folders
SHA1: 7f93bdaf467a80227fd7ec0393e26341afde8ec9
User & Date: matt on 2013-08-20 00:20:33
Other Links: branch diff | manifest | tags
Context
2013-08-20
11:30
Fixed sorting check-in: f26494345d user: mrwellan tags: v1.55
00:20
Commented out tweak for better sort logic, look in bubble-up check-in: 7f93bdaf46 user: matt tags: v1.55
2013-08-19
23:52
Fixed minor issue with ods check-in: c90f28e6b2 user: matt tags: v1.55
Changes

Modified dashboard.scm from [64bb5aea71] to [821e96c24e].

140
141
142
143
144
145
146
147




148
149
150
151
152
153
154
155
156
(define *state-ignore-hash*  (make-hash-table))

(define *db-file-path* (conc *toppath* "/megatest.db"))

(define *tests-sort-options* (vector (vector "Sort +a" 'testname   "ASC")
				     (vector "Sort -a" 'testname   "DESC")
				     (vector "Sort +t" 'event_time "ASC")
				     (vector "Sort -t" 'event_time "DESC")))




(define (next-sort-option)
  (if (>= *tests-sort-reverse* 3)
      (set! *tests-sort-reverse* 0)
      (set! *tests-sort-reverse* (+ *tests-sort-reverse* 1)))
  *tests-sort-reverse*)

(define *tests-sort-reverse* 0)
(define *hide-empty-runs* #f)








|
>
>
>
>

|







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
(define *state-ignore-hash*  (make-hash-table))

(define *db-file-path* (conc *toppath* "/megatest.db"))

(define *tests-sort-options* (vector (vector "Sort +a" 'testname   "ASC")
				     (vector "Sort -a" 'testname   "DESC")
				     (vector "Sort +t" 'event_time "ASC")
				     (vector "Sort -t" 'event_time "DESC")
				     (vector "Sort +s" 'statestatus "ASC")
				     (vector "Sort -s" 'statestatus "DESC")))

;; Don't forget to adjust the >= below if you add to the sort-options above
(define (next-sort-option)
  (if (>= *tests-sort-reverse* 5)
      (set! *tests-sort-reverse* 0)
      (set! *tests-sort-reverse* (+ *tests-sort-reverse* 1)))
  *tests-sort-reverse*)

(define *tests-sort-reverse* 0)
(define *hide-empty-runs* #f)

310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327

328





329
330
331
332
333
334
335
	(iup:attribute-set! lbl "FGCOLOR" (if (hash-table-ref/default *collapsed* newval #f) "0 112 112" "0 0 0"))
	(if (< i maxn)
	    (loop (+ i 1)))))))

;; Bubble up the top tests to above the items, collect the items underneath
;; all while preserving the sort order from the SQL query as best as possible.
;;
(define (bubble-up test-dats)
  (if (null? test-dats)
      test-dats
      (begin
	(let* ((tnames '())                ;; list of names used to reserve order
	       (tests  (make-hash-table))) ;; hash of lists, used to build as we go
	  (for-each 
	   (lambda (testdat)
	     (let* ((tname (db:test-get-testname testdat))
		    (ipath (db:test-get-item-path testdat))
		    (seen  (hash-table-ref/default tests tname #f)))

	       (if (not seen)(set! tnames (append tnames (list tname))))





	       (if (equal? ipath "")
		   ;; This a top level, prepend it
		   (hash-table-set! tests tname (cons testdat (hash-table-ref/default tests tname '())))
		   ;; This is item, append it
		   (hash-table-set! tests tname (append (hash-table-ref/default tests tname '())(list testdat))))))
	   test-dats)
	;; Set all tests with items 







|










>
|
>
>
>
>
>







314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
	(iup:attribute-set! lbl "FGCOLOR" (if (hash-table-ref/default *collapsed* newval #f) "0 112 112" "0 0 0"))
	(if (< i maxn)
	    (loop (+ i 1)))))))

;; Bubble up the top tests to above the items, collect the items underneath
;; all while preserving the sort order from the SQL query as best as possible.
;;
(define (bubble-up test-dats #!key (priority 'itempath))
  (if (null? test-dats)
      test-dats
      (begin
	(let* ((tnames '())                ;; list of names used to reserve order
	       (tests  (make-hash-table))) ;; hash of lists, used to build as we go
	  (for-each 
	   (lambda (testdat)
	     (let* ((tname (db:test-get-testname testdat))
		    (ipath (db:test-get-item-path testdat))
		    (seen  (hash-table-ref/default tests tname #f)))
	       (if (not seen)
		   (set! tnames (append tnames (list tname))))
;;		   (if (or (and (eq? priority 'itempath)
;;				(not (equal? ipath "")))
;;			   (and (eq? priority 'testname)
;;				(equal? ipath "")))
;;		       (set! tnames (append tnames (list tname)))))
	       (if (equal? ipath "")
		   ;; This a top level, prepend it
		   (hash-table-set! tests tname (cons testdat (hash-table-ref/default tests tname '())))
		   ;; This is item, append it
		   (hash-table-set! tests tname (append (hash-table-ref/default tests tname '())(list testdat))))))
	   test-dats)
	;; Set all tests with items 

Modified db.scm from [5e357ac578] to [acd9ed7d63].

941
942
943
944
945
946
947
948
949

950
951
952
953
954
955
956
957
958
959
960
	   (else "")))
	 (tests-match-qry (tests:match->sqlqry testpatt))
	 (qry             (conc "SELECT " qryvals
				" FROM tests WHERE run_id=? AND state != 'DELETED' "
				states-statuses-qry
				(if tests-match-qry (conc " AND (" tests-match-qry ") ") "")
				(case sort-by
				  ((rundir)     " ORDER BY length(rundir) ")
				  ((testname)   " ORDER BY testname,item_path ")

				  ((event_time) " ORDER BY event_time ")
				  (else         (if (string? sort-by)
						    (conc " ORDER BY " sort-by)
						    "")))
				(if sort-order sort-order "")
				(if limit  (conc " LIMIT " limit)   "")
				(if offset (conc " OFFSET " offset) "")
				";"
				)))
    (debug:print-info 8 "db:get-tests-for-run qry=" qry)
    (sqlite3:for-each-row 







|
|
>
|
|
|
|







941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
	   (else "")))
	 (tests-match-qry (tests:match->sqlqry testpatt))
	 (qry             (conc "SELECT " qryvals
				" FROM tests WHERE run_id=? AND state != 'DELETED' "
				states-statuses-qry
				(if tests-match-qry (conc " AND (" tests-match-qry ") ") "")
				(case sort-by
				  ((rundir)      " ORDER BY length(rundir) ")
				  ((testname)    " ORDER BY testname,item_path ")
				  ((statestatus) " ORDER BY state,status ")
				  ((event_time)  " ORDER BY event_time ")
				  (else          (if (string? sort-by)
						     (conc " ORDER BY " sort-by)
						     "")))
				(if sort-order sort-order "")
				(if limit  (conc " LIMIT " limit)   "")
				(if offset (conc " OFFSET " offset) "")
				";"
				)))
    (debug:print-info 8 "db:get-tests-for-run qry=" qry)
    (sqlite3:for-each-row