Skip to content

Commit

Permalink
Reorganize the TR testing files, and add progress output.
Browse files Browse the repository at this point in the history
`typed-racket-test/main` is now the file to run for almost everything.
`typed-racket-test/run` continues to exist so that DrDr preserves the
timing history.

Integration tests now print a progress meter, which should fix the
Travis timeouts.
  • Loading branch information
samth committed Dec 29, 2015
1 parent 10dc533 commit 43a8cce
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 56 deletions.
67 changes: 63 additions & 4 deletions typed-racket-test/main.rkt
@@ -1,7 +1,7 @@
#lang racket/base

(require rackunit rackunit/text-ui racket/file
racket/port
racket/port rackunit/log
compiler/compiler setup/setup racket/promise
racket/match syntax/modcode
racket/promise racket/runtime-path
Expand Down Expand Up @@ -49,21 +49,26 @@
(lambda ()
(define path (build-path src-dir dir))
(define prms
(for/list ([p (directory-list path)]
(for/list ([i (in-naturals)]
[p (directory-list path)]
#:when (scheme-file? p)
;; skip backup files
#:when (not (regexp-match #rx".*~" (path->string p))))
(define p* (build-path path p))
(define prm (list path p
(if (places)
(delay/thread
(run-in-other-place p* error?))
(begin0 (run-in-other-place p* error?)
(when (zero? (modulo i 10))
(eprintf "."))))
(delay
(parameterize ([read-accept-reader #t]
[current-load-relative-directory path]
[current-directory path]
[current-output-port (open-output-nowhere)])
(dr p))))))
(begin0 (dr p)
(when (zero? (modulo i 10))
(eprintf "."))))))))
prm))
(define tests
(for/list ([e prms])
Expand Down Expand Up @@ -166,3 +171,57 @@
verbose?
int-tests unit-tests compile-benchmarks compile-math
optimization-tests missed-optimization-tests)

(module+ main
(require racket/vector racket/gui/dynamic rackunit racket/cmdline)

(define exec (make-parameter go/text))
(define nightly? (make-parameter #f))
(define unit? (make-parameter #f))
(define int? (make-parameter #f))
(define opt? (make-parameter #f))
(define missed-opt? (make-parameter #f))
(define bench? (make-parameter #f))
(define math? (make-parameter #f))
(define single (make-parameter #f))
(current-namespace (make-base-namespace))
(command-line
#:once-each
["-v" "verbose" (verbose? #t)]
["--unit" "run the unit tests" (unit? #t)]
["--int" "run the integration tests" (int? #t)]
["--opt" "run the optimization tests" (opt? #t)]
["--missed-opt" "run the missed optimization tests" (missed-opt? #t)]
["--benchmarks" "compile the typed benchmarks" (bench? #t)]
["--math" "compile the math library" (math? #t)]
["--just" path "run only this test" (single (just-one path))]
["--nightly" "for the nightly builds" (begin (nightly? #t) (unit? #t) (opt? #t) (missed-opt? #t) (places 1))]
["--all" "run all tests" (begin (unit? #t) (int? #t) (opt? #t) (missed-opt? #t) (bench? #t) (math? #t))]
["-j" num "number of places to use"
(let ([n (string->number num)])
(places (and (integer? n) (> n 1) n)))]
["--gui" "run using the gui"
(if (gui-available?)
(exec go)
(error "GUI not available"))])

(start-workers)

(if (and (nightly?) (eq? 'cgc (system-type 'gc)))
(printf "Skipping Typed Racket tests.\n")
(let ([to-run (cond [(single) (single)]
[else
(make-test-suite
"Typed Racket Tests"
(append (if (unit?) (list unit-tests) '())
(if (int?) (list (int-tests)) '())
(if (opt?) (list (optimization-tests)) '())
(if (missed-opt?) (list (missed-optimization-tests)) '())
(if (bench?) (list (compile-benchmarks)) '())
(if (math?) (list (compile-math)) '())))])])
(unless (= 0 ((exec) to-run))
(eprintf "Typed Racket Tests did not pass.\n")
(exit 1)))))

;; nightly tests in `run.rkt` for drdr chart continuity
(module test racket/base)
53 changes: 1 addition & 52 deletions typed-racket-test/run.rkt
@@ -1,60 +1,9 @@
#lang racket
(require racket/vector racket/gui/dynamic rackunit)

(require "main.rkt")

(define exec (make-parameter go/text))
(define nightly? (make-parameter #f))
(define unit? (make-parameter #f))
(define int? (make-parameter #f))
(define opt? (make-parameter #f))
(define missed-opt? (make-parameter #f))
(define bench? (make-parameter #f))
(define math? (make-parameter #f))
(define single (make-parameter #f))
(current-namespace (make-base-namespace))
(command-line
#:once-each
["-v" "verbose" (verbose? #t)]
["--unit" "run the unit tests" (unit? #t)]
["--int" "run the integration tests" (int? #t)]
["--opt" "run the optimization tests" (opt? #t)]
["--missed-opt" "run the missed optimization tests" (missed-opt? #t)]
["--benchmarks" "compile the typed benchmarks" (bench? #t)]
["--math" "compile the math library" (math? #t)]
["--just" path "run only this test" (single (just-one path))]
["--nightly" "for the nightly builds" (begin (nightly? #t) (unit? #t) (opt? #t) (missed-opt? #t) (places 1))]
["--all" "run all tests" (begin (unit? #t) (int? #t) (opt? #t) (missed-opt? #t) (bench? #t) (math? #t))]
["-j" num "number of places to use"
(let ([n (string->number num)])
(places (and (integer? n) (> n 1) n)))]
["--gui" "run using the gui"
(if (gui-available?)
(exec go)
(error "GUI not available"))])

(start-workers)

(if (and (nightly?) (eq? 'cgc (system-type 'gc)))
(printf "Skipping Typed Racket tests.\n")
(let ([to-run (cond [(single) (single)]
[else
(make-test-suite
"Typed Racket Tests"
(append (if (unit?) (list unit-tests) '())
(if (int?) (list (int-tests)) '())
(if (opt?) (list (optimization-tests)) '())
(if (missed-opt?) (list (missed-optimization-tests)) '())
(if (bench?) (list (compile-benchmarks)) '())
(if (math?) (list (compile-math)) '())))])])
(unless (= 0 ((exec) to-run))
(eprintf "Typed Racket Tests did not pass.\n")
(exit 1))))

;; Test mode:
(module test racket/base
(require syntax/location)
(parameterize ([current-command-line-arguments (vector "--nightly")])
(dynamic-require (quote-module-path "..") 0))
(dynamic-require '(submod typed-racket-test/main main) 0))
(module config info
(define timeout 1800)))

0 comments on commit 43a8cce

Please sign in to comment.