From e4f50997ad9a0bbf2ee3c17c967ae76c09667cbc Mon Sep 17 00:00:00 2001 From: James Swaine Date: Wed, 18 Jul 2012 15:36:36 -0500 Subject: [PATCH] Minor changes to future-visualizer/trace tests --- collects/tests/future/trace.rkt | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/collects/tests/future/trace.rkt b/collects/tests/future/trace.rkt index b1f809560e..166ef8ab6c 100644 --- a/collects/tests/future/trace.rkt +++ b/collects/tests/future/trace.rkt @@ -27,26 +27,17 @@ Invariants: #'(let ([time-sorted (sort log #:key (λ (e) (future-event-time (indexed-future-event-fevent e))) <)]) - (let loop ([sorted time-sorted]) - (define cur (car sorted)) - (define rest (cdr sorted)) - (unless (null? rest) - (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) + (for ([e (in-list time-sorted)] + [i (in-naturals)]) + (check-equal? (indexed-future-event-index e) + i (format "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 - curind - curtime - nextind - nexttime)) - (loop rest)))))])) + (indexed-future-event-index e) + (future-event-time (indexed-future-event-fevent e)) + i)))))])) (define log1 (parameterize ([current-output-port (open-output-string)]) @@ -67,16 +58,18 @@ Invariants: (check-true (<= syncs-len 2000)) (check-ordering 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) (check-equal? (length (hash-keys (trace-future-timelines tr1))) 1001) + (define log3 (trace-futures (parameterize ([current-command-line-arguments #("2000")] [current-output-port (open-output-string)]) (void (dynamic-require 'tests/racket/benchmarks/shootout/mandelbrot-futures #f))))) (check-true (> (length log3) 0)) +(check-true (list? (memf jitcompile-event? log3)) "No JIT compilation events found in mandelbrot") (define tr3 (build-trace log3)) (check-equal? (length (hash-keys (trace-future-timelines tr3))) 2001)