From 1ca949b31a474341e1be946fba5cd649d4417b30 Mon Sep 17 00:00:00 2001 From: Spencer Florence Date: Wed, 21 Jan 2015 14:56:03 -0500 Subject: [PATCH] attempt to fix write/mashal errors --- cover.rkt | 24 +++++++++++++++++++++++- strace.rkt | 8 ++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/cover.rkt b/cover.rkt index 946a057..9c032cd 100644 --- a/cover.rkt +++ b/cover.rkt @@ -123,6 +123,7 @@ in "coverage.rkt". This raw coverage information is converted to a usable form b (compile to-compile immediate-eval?))) (define-runtime-path cov "coverage.rkt") +(define abs-cover (->absolute cov)) (define-runtime-path strace "strace.rkt") ;; -> Void @@ -187,7 +188,7 @@ in "coverage.rkt". This raw coverage information is converted to a usable form b [span (syntax-span stx)]) (and pos span - (list covered? + (list (mcar covered?) (make-srcloc src #f #f pos span)))))))) ;; actions-ht : (list src number number) -> (list boolean syntax) @@ -224,3 +225,24 @@ in "coverage.rkt". This raw coverage information is converted to a usable form b ;; A little hack to setup coverage namespace for the first time (clear-coverage!) + + +;; here live tests for actually saving compiled files +(module+ test + (require rackunit racket/runtime-path compiler/cm compiler/compiler) + (define-runtime-path prog.rkt "tests/prog.rkt") + (define-runtime-path-list compiled + (list + "tests/compiled/prog_rkt.zo" + "tests/compiled/prog_rkt.dep")) + (test-begin + (for-each (lambda (f) (when (file-exists? f) (delete-file f))) + compiled) + (check-false (ormap file-exists? compiled)) + (check-not-exn + (lambda () + (parameterize ([current-compile (make-cover-compile)] + [current-namespace ns]) + (managed-compile-zo prog.rkt)))) + (check-true (andmap file-exists? compiled))) + ) diff --git a/strace.rkt b/strace.rkt index 52aabbc..2491474 100644 --- a/strace.rkt +++ b/strace.rkt @@ -9,9 +9,13 @@ (define test-coverage-enabled (make-parameter #t)) (define (initialize-test-coverage-point stx) - (hash-set! coverage stx #f)) + (hash-set! coverage stx (mcons #f #f))) + (define (test-covered stx) - (thunk (hash-set! coverage stx #t))) + (define v (hash-ref coverage stx #f)) + (and v + (with-syntax ([v v]) + #'(#%plain-app set-mcar! v #t)))) (define profile-key (gensym))