show timing for suites in rackunit gui
original commit: 01fd205c9ab269a5d1cde81634eca93d0098bb43
This commit is contained in:
parent
305ea7dc4f
commit
8966ebd203
|
@ -33,6 +33,7 @@
|
||||||
error?
|
error?
|
||||||
has-output?
|
has-output?
|
||||||
has-trash?
|
has-trash?
|
||||||
|
get-timing
|
||||||
|
|
||||||
get-total-cases
|
get-total-cases
|
||||||
get-total-successes
|
get-total-successes
|
||||||
|
@ -41,7 +42,6 @@
|
||||||
(define-interface case<%> (result<%>)
|
(define-interface case<%> (result<%>)
|
||||||
(update
|
(update
|
||||||
get-result
|
get-result
|
||||||
get-timing
|
|
||||||
get-output
|
get-output
|
||||||
get-trash
|
get-trash
|
||||||
get-property
|
get-property
|
||||||
|
|
|
@ -80,6 +80,9 @@
|
||||||
(define/public (get-output) (reverse output))
|
(define/public (get-output) (reverse output))
|
||||||
(define/public (has-output?) (pair? output))))
|
(define/public (has-output?) (pair? output))))
|
||||||
|
|
||||||
|
;; An aggr contains aggregate information about a suite's children.
|
||||||
|
(struct aggr (cases successes failures has-output? has-trash? tcpu treal tgc)
|
||||||
|
#:transparent)
|
||||||
|
|
||||||
;; suite-result%
|
;; suite-result%
|
||||||
(define suite-result%
|
(define suite-result%
|
||||||
|
@ -104,31 +107,37 @@
|
||||||
(send/i (get-controller) controller<%> on-model-status-change this))
|
(send/i (get-controller) controller<%> on-model-status-change this))
|
||||||
|
|
||||||
(define children-cache
|
(define children-cache
|
||||||
(cache (for/fold ([cs 0] [ss 0] [fs 0] [out? #f] [trash? #f])
|
(cache (call-with-values
|
||||||
|
(lambda ()
|
||||||
|
(for/fold ([cs 0] [ss 0] [fs 0] [out? #f] [trash? #f]
|
||||||
|
[tcpu 0] [treal 0] [tgc 0])
|
||||||
([c (in-gvector children)])
|
([c (in-gvector children)])
|
||||||
|
(let ([timing (or (send/i c result<%> get-timing) '(0 0 0))])
|
||||||
(values (+ cs (send/i c result<%> get-total-cases))
|
(values (+ cs (send/i c result<%> get-total-cases))
|
||||||
(+ ss (send/i c result<%> get-total-successes))
|
(+ ss (send/i c result<%> get-total-successes))
|
||||||
(+ fs (send/i c result<%> get-total-failures))
|
(+ fs (send/i c result<%> get-total-failures))
|
||||||
(or out? (send/i c result<%> has-output?))
|
(or out? (send/i c result<%> has-output?))
|
||||||
(or trash? (send/i c result<%> has-trash?))))))
|
(or trash? (send/i c result<%> has-trash?))
|
||||||
|
(+ tcpu (car timing))
|
||||||
|
(+ treal (cadr timing))
|
||||||
|
(+ tgc (caddr timing))))))
|
||||||
|
aggr)))
|
||||||
|
|
||||||
(define/public (finished?)
|
(define/public (finished?)
|
||||||
done?)
|
done?)
|
||||||
(define/public (get-total-cases)
|
(define/public (get-total-cases)
|
||||||
(define-values (c _s _f _o _t) (cache-ref children-cache))
|
(aggr-cases (cache-ref children-cache)))
|
||||||
c)
|
|
||||||
(define/public (get-total-successes)
|
(define/public (get-total-successes)
|
||||||
(define-values (_c s _f _o _t) (cache-ref children-cache))
|
(aggr-successes (cache-ref children-cache)))
|
||||||
s)
|
|
||||||
(define/public (get-total-failures)
|
(define/public (get-total-failures)
|
||||||
(define-values (_c _s f _o _t) (cache-ref children-cache))
|
(aggr-failures (cache-ref children-cache)))
|
||||||
f)
|
|
||||||
(define/public (has-output?)
|
(define/public (has-output?)
|
||||||
(define-values (_c _s _f o _t) (cache-ref children-cache))
|
(aggr-has-output? (cache-ref children-cache)))
|
||||||
o)
|
|
||||||
(define/public (has-trash?)
|
(define/public (has-trash?)
|
||||||
(define-values (_c _s _f _o t) (cache-ref children-cache))
|
(aggr-has-trash? (cache-ref children-cache)))
|
||||||
t)
|
(define/public (get-timing)
|
||||||
|
(let ([a (cache-ref children-cache)])
|
||||||
|
(list (aggr-tcpu a) (aggr-treal a) (aggr-tgc a))))
|
||||||
|
|
||||||
(define/public (success?)
|
(define/public (success?)
|
||||||
(and (finished?) (zero? (get-total-failures))))
|
(and (finished?) (zero? (get-total-failures))))
|
||||||
|
@ -138,10 +147,8 @@
|
||||||
|
|
||||||
;; on-child-status-change : model<%> -> void
|
;; on-child-status-change : model<%> -> void
|
||||||
(define/public (on-child-status-change child)
|
(define/public (on-child-status-change child)
|
||||||
(let ([result
|
(let ([result (cache-ref children-cache)])
|
||||||
(call-with-values (lambda () (cache-ref children-cache)) list)])
|
|
||||||
(cache-invalidate! children-cache)
|
(cache-invalidate! children-cache)
|
||||||
(let ([new-result
|
(let ([new-result (cache-ref children-cache)])
|
||||||
(call-with-values (lambda () (cache-ref children-cache)) list)])
|
|
||||||
(unless (equal? new-result result)
|
(unless (equal? new-result result)
|
||||||
(send/i (get-controller) controller<%> on-model-status-change this)))))))
|
(send/i (get-controller) controller<%> on-model-status-change this)))))))
|
||||||
|
|
|
@ -122,7 +122,8 @@
|
||||||
count-successes
|
count-successes
|
||||||
num-tests))
|
num-tests))
|
||||||
(for-each (lambda (m) (render-model/short m)) successes)
|
(for-each (lambda (m) (render-model/short m)) successes)
|
||||||
(blank)))
|
(blank))
|
||||||
|
(render-timing model))
|
||||||
(if finished?
|
(if finished?
|
||||||
(put '()
|
(put '()
|
||||||
"This test suite is empty.")
|
"This test suite is empty.")
|
||||||
|
@ -158,7 +159,7 @@
|
||||||
(put `(,style)
|
(put `(,style)
|
||||||
(format " (~a)"
|
(format " (~a)"
|
||||||
(n-things total-failures "failure" "failures"))))
|
(n-things total-failures "failure" "failures"))))
|
||||||
(put '(test-unexecuted) " not yet executed"))
|
(put '(test-unexecuted) " not yet finished"))
|
||||||
(blank)))))
|
(blank)))))
|
||||||
|
|
||||||
(define/private (render-case-short-form model)
|
(define/private (render-case-short-form model)
|
||||||
|
@ -428,7 +429,7 @@
|
||||||
(blank))))
|
(blank))))
|
||||||
|
|
||||||
(define/private (render-timing model)
|
(define/private (render-timing model)
|
||||||
(let [(timing (send/i model case<%> get-timing))]
|
(let [(timing (send/i model result<%> get-timing))]
|
||||||
(when timing
|
(when timing
|
||||||
(let ([cpu (car timing)]
|
(let ([cpu (car timing)]
|
||||||
[real (cadr timing)]
|
[real (cadr timing)]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user