Minor changes to future-visualizer/trace tests

(cherry picked from commit e4f50997ad)
This commit is contained in:
James Swaine 2012-07-18 15:36:36 -05:00 committed by Ryan Culpepper
parent 10628ef0b9
commit 57a4f9f2f3

View File

@ -27,26 +27,17 @@ Invariants:
#'(let ([time-sorted (sort log #'(let ([time-sorted (sort log
#:key (λ (e) (future-event-time (indexed-future-event-fevent e))) #:key (λ (e) (future-event-time (indexed-future-event-fevent e)))
<)]) <)])
(let loop ([sorted time-sorted]) (for ([e (in-list time-sorted)]
(define cur (car sorted)) [i (in-naturals)])
(define rest (cdr sorted)) (check-equal? (indexed-future-event-index e)
(unless (null? rest) i
(define next (car rest))
(define curtime (future-event-time (indexed-future-event-fevent cur)))
(define curind (indexed-future-event-index cur))
(define nextind (indexed-future-event-index next))
(define nexttime (future-event-time (indexed-future-event-fevent cur)))
(check-true (< curind
nextind)
(format (format
"Incorrect event ordering at line ~a: event with (index=~a, time=~a) "Incorrect event ordering at line ~a: event with (index=~a, time=~a)
occurs before event with (index=~a, time=~a)\n" occurs at actual index ~a\n"
line line
curind (indexed-future-event-index e)
curtime (future-event-time (indexed-future-event-fevent e))
nextind i)))))]))
nexttime))
(loop rest)))))]))
(define log1 (parameterize ([current-output-port (open-output-string)]) (define log1 (parameterize ([current-output-port (open-output-string)])
@ -67,16 +58,18 @@ Invariants:
(check-true (<= syncs-len 2000)) (check-true (<= syncs-len 2000))
(check-ordering log1) (check-ordering log1)
(define tr1 (build-trace log1)) (define tr1 (build-trace log1))
;Keys should include all unique future id's, and one entry for #f ;Keys should include all unique future id's, and one entry for #f (no future context, on rt thread)
;(events logged on runtime thread outside scope of any future) ;(events logged on runtime thread outside scope of any future)
(check-equal? (length (hash-keys (trace-future-timelines tr1))) 1001) (check-equal? (length (hash-keys (trace-future-timelines tr1))) 1001)
(define log3 (trace-futures (define log3 (trace-futures
(parameterize ([current-command-line-arguments #("2000")] (parameterize ([current-command-line-arguments #("2000")]
[current-output-port (open-output-string)]) [current-output-port (open-output-string)])
(void (dynamic-require 'tests/racket/benchmarks/shootout/mandelbrot-futures #f))))) (void (dynamic-require 'tests/racket/benchmarks/shootout/mandelbrot-futures #f)))))
(check-true (> (length log3) 0)) (check-true (> (length log3) 0))
(check-true (list? (memf jitcompile-event? log3)) "No JIT compilation events found in mandelbrot")
(define tr3 (build-trace log3)) (define tr3 (build-trace log3))
(check-equal? (length (hash-keys (trace-future-timelines tr3))) 2001) (check-equal? (length (hash-keys (trace-future-timelines tr3))) 2001)