940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
|
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
|
-
-
-
+
+
+
+
+
|
;; organise the steps for better readability
(let ((res (make-hash-table)))
(for-each
(lambda (step)
(debug:print 6 *default-log-port* "step=" step)
(let ((record (hash-table-ref/default
res
(tdb:step-get-stepname step)
;; stepname start end status Duration Logfile Comment
(vector (tdb:step-get-stepname step) "" "" "" "" "" ""))))
(tdb:step-get-stepname step)
;; 0 1 2 3 4 5 6 7
;; stepname start end status Duration Logfile Comment first-id
(vector (tdb:step-get-stepname step) "" "" "" "" "" "" #f))))
(debug:print 6 *default-log-port* "record(before) = " record
"\nid: " (tdb:step-get-id step)
"\nstepname: " (tdb:step-get-stepname step)
"\nstate: " (tdb:step-get-state step)
"\nstatus: " (tdb:step-get-status step)
"\ntime: " (tdb:step-get-event_time step))
(if (not (vector-ref record 7))(vector-set! record 7 (tdb:step-get-id step))) ;; do not clobber the id if previously set
(case (string->symbol (tdb:step-get-state step))
((start)(vector-set! record 1 (tdb:step-get-event_time step))
(vector-set! record 3 (if (equal? (vector-ref record 3) "")
(tdb:step-get-status step)))
(if (> (string-length (tdb:step-get-logfile step))
0)
(vector-set! record 5 (tdb:step-get-logfile step))))
|
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
|
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
|
-
-
+
+
-
-
+
+
-
+
-
-
-
-
-
+
+
+
+
+
+
-
+
+
+
+
-
-
+
+
|
(< (tdb:step-get-id a) (tdb:step-get-id b)))
(else #f)))))
res))
;;
;;
(define (tests:get-compressed-steps run-id test-id)
(let* ((steps-data (rmt:get-steps-for-test run-id test-id))
(comprsteps (tests:process-steps-table steps-data))) ;; (open-run-close db:get-steps-table #f test-id work-area: work-area)))
(let* ((steps-data (rmt:get-steps-for-test run-id test-id)) ;; 0 1 2 3 4 5 6 7
(comprsteps (tests:process-steps-table steps-data))) ;; #<stepname start end status Duration Logfile Comment id>
(map (lambda (x)
;; take advantage of the \n on time->string
(vector
(vector-ref x 0)
(vector ;; we are constructing basically the original vector but collapsing start end records
(vector-ref x 0) ;; id 0
(let ((s (vector-ref x 1)))
(if (number? s)(seconds->time-string s) s))
(if (number? s)(seconds->time-string s) s)) ;; starttime 1
(let ((s (vector-ref x 2)))
(if (number? s)(seconds->time-string s) s))
(vector-ref x 3) ;; status
(vector-ref x 4)
(vector-ref x 5) ;; time delta
(vector-ref x 6)))
(if (number? s)(seconds->time-string s) s)) ;; endtime 2
(vector-ref x 3) ;; status 3
(vector-ref x 4) ;; duration 4
(vector-ref x 5) ;; logfile 5
(vector-ref x 6) ;; comment 6
(vector-ref x 7))) ;; id 7
(sort (hash-table-values comprsteps)
(lambda (a b)
(let ((time-a (vector-ref a 1))
(time-b (vector-ref b 1)))
(time-b (vector-ref b 1))
(id-a (vector-ref a 7))
(id-b (vector-ref b 7)))
(if (and (number? time-a)(number? time-b))
(if (< time-a time-b)
#t
(if (eq? time-a time-b)
(< id-a id-b)
(string<? (conc (vector-ref a 2))
(conc (vector-ref b 2)))
;; (string<? (conc (vector-ref a 2))
;; (conc (vector-ref b 2)))
#f))
(string<? (conc time-a)(conc time-b)))))))))
;; summarize test in to a file test-summary.html in the test directory
;;
(define (tests:summarize-test run-id test-id)
|