Fix error handling of parallel-compile-files.

Related to PR 14809.
This commit is contained in:
Eric Dobson 2014-11-05 22:23:09 -08:00 committed by Matthew Flatt
parent b1c700dffc
commit 37232a90fe
3 changed files with 16 additions and 2 deletions

View File

@ -469,8 +469,8 @@ result will not call @racket[proc] with @racket['unlock].)
The @racketmodname[setup/parallel-build] library provides the parallel-compilation
functionality of @exec{raco setup} and @exec{raco make}.}
@defproc[(parallel-compile-files [list-of-files (listof path?)]
[#:worker-count worker-count non-negative-integer? (processor-count)]
@defproc[(parallel-compile-files [list-of-files (listof path-string?)]
[#:worker-count worker-count exact-positive-integer? (processor-count)]
[#:handler handler (->i ([handler-type symbol?]
[path path-string?]
[msg string?]

View File

@ -0,0 +1,8 @@
#lang racket/base
(require
rackunit
setup/parallel-build)
(check-exn exn:fail:contract? (λ () (parallel-compile ".")))
(check-exn exn:fail:contract? (λ () (parallel-compile-files (list) #:worker-count 2.5)))
(check-exn exn:fail:contract? (λ () (parallel-compile-files (list) #:handler 5)))

View File

@ -341,6 +341,12 @@
#:worker-count [worker-count (processor-count)]
#:handler [handler void]
#:options [options '()])
(unless (exact-positive-integer? worker-count)
(raise-argument-error 'parallel-compile-files "exact-positive-integer?" worker-count))
(unless (and (list? list-of-files) (andmap path-string? list-of-files))
(raise-argument-error 'parallel-compile-files "(listof path-string?)" list-of-files))
(unless (and (procedure? handler) (procedure-arity-includes? handler 5))
(raise-argument-error 'parallel-compile-files "(procedure-arity-includes/c 5)" handler))
(parallel-build (make-object file-list-queue% list-of-files handler options) worker-count))
(define (parallel-compile worker-count setup-fprintf append-error collects-tree)