test cases print their file name just to help me trace when the tests fail

This commit is contained in:
Danny Yoo 2011-05-23 14:54:38 -04:00
parent 749253d8c4
commit 801b636765
15 changed files with 101 additions and 54 deletions

View File

@ -361,6 +361,10 @@
;; FIXME: assumes the module has already been linked. We should error out ;; FIXME: assumes the module has already been linked. We should error out
;; if the module hasn't been linked yet. ;; if the module hasn't been linked yet.
(define (compile-module-invoke a-module-name) (define (compile-module-invoke a-module-name)
(cond
[(kernel-module-name? a-module-name)
empty-instruction-sequence]
[else
(let* ([linked (make-label 'linked)] (let* ([linked (make-label 'linked)]
[already-loaded (make-label 'alreadyLoaded)] [already-loaded (make-label 'alreadyLoaded)]
[on-return-multiple (make-label 'onReturnMultiple)] [on-return-multiple (make-label 'onReturnMultiple)]
@ -387,9 +391,16 @@
(make-Const 1)) (make-Const 1))
(make-Const 0)) (make-Const 0))
,on-return ,on-return
,already-loaded)))) ,already-loaded)))]))
(: kernel-module-name? (ModuleName -> Boolean))
;; Produces true if the module is hardcoded.
(define (kernel-module-name? name)
(or (and (eq? (ModuleName-name name) '#%kernel)
(eq? (ModuleName-real-path name) '#%kernel))
(eq? (ModuleName-name name) 'whalesong/lang/kernel)))

View File

@ -12,7 +12,8 @@
racket/string racket/string
racket/list) racket/list)
(provide assemble/write-invoke (provide assemble/write-invoke-module-as-main
assemble/write-invoke
fracture fracture
assemble-basic-block assemble-basic-block
assemble-statement) assemble-statement)
@ -23,6 +24,14 @@
(: assemble/write-invoke-module-as-main (Symbol Output-Port -> Void))
(define (assemble/write-invoke-module-as-main module-name op)
;; FIXME
(void))
(: assemble/write-invoke ((Listof Statement) Output-Port -> Void)) (: assemble/write-invoke ((Listof Statement) Output-Port -> Void))
;; Writes out the JavaScript code that represents the anonymous invocation expression. ;; Writes out the JavaScript code that represents the anonymous invocation expression.
;; What's emitted is a function expression that, when invoked, runs the ;; What's emitted is a function expression that, when invoked, runs the

View File

@ -1108,6 +1108,7 @@
}; };
var HaltError = function() {}
var trampoline = function(MACHINE, initialJump) { var trampoline = function(MACHINE, initialJump) {
@ -1138,6 +1139,9 @@
0); 0);
return; return;
} }
} else if (e instanceof HaltError) {
// FIXME: work out what it really means to Halt.
return;
} else { } else {
MACHINE.running = false; MACHINE.running = false;
return MACHINE.params.currentErrorHandler(MACHINE, e); return MACHINE.params.currentErrorHandler(MACHINE, e);
@ -1248,6 +1252,6 @@
exports['heir'] = heir; exports['heir'] = heir;
exports['makeClassPredicate'] = makeClassPredicate; exports['makeClassPredicate'] = makeClassPredicate;
exports['HaltError'] = HaltError;
}).call(this); }).call(this);

View File

@ -1,17 +1,17 @@
#lang racket/base #lang racket/base
(require "compiler.rkt" (require "assemble.rkt"
"compiler-structs.rkt" "get-runtime.rkt"
"parse-bytecode.rkt" "../compiler.rkt"
"language-namespace.rkt" "../compiler-structs.rkt"
"il-structs.rkt" "../parse-bytecode.rkt"
"bootstrapped-primitives.rkt" "../language-namespace.rkt"
"get-module-bytecode.rkt" "../il-structs.rkt"
"get-dependencies.rkt" "../bootstrapped-primitives.rkt"
"js-assembler/assemble.rkt" "../get-module-bytecode.rkt"
"js-assembler/get-runtime.rkt" "../get-dependencies.rkt"
"lexical-structs.rkt" "../lexical-structs.rkt"
"quote-cdata.rkt" "../quote-cdata.rkt"
racket/runtime-path racket/runtime-path
racket/port racket/port
racket/list racket/list

View File

@ -9,6 +9,8 @@
racket/promise racket/promise
racket/runtime-path) racket/runtime-path)
(printf "test-assemble.rkt\n")
(define runtime (get-runtime)) (define runtime (get-runtime))

View File

@ -1,8 +1,9 @@
#lang racket #lang racket
(require "../js-assembler/get-runtime.rkt" (require "../js-assembler/get-runtime.rkt"
"../browser-evaluate.rkt" "../browser-evaluate.rkt"
"../package.rkt") "../js-assembler/package.rkt")
(printf "test-browser-evaluate.rkt\n")
(define should-follow? (lambda (p) #t)) (define should-follow? (lambda (p) #t))

View File

@ -5,7 +5,7 @@
"../simulator/simulator-helpers.rkt" "../simulator/simulator-helpers.rkt"
"test-helpers.rkt") "test-helpers.rkt")
(printf "test-compiler-2.rkt\n")
;; run: machine -> (machine number) ;; run: machine -> (machine number)
;; Run the machine to completion. ;; Run the machine to completion.

View File

@ -5,7 +5,10 @@
"../simulator/simulator-helpers.rkt" "../simulator/simulator-helpers.rkt"
"../parameters.rkt" "../parameters.rkt"
"test-helpers.rkt" "test-helpers.rkt"
racket/runtime-path) racket/runtime-path
rackunit)
(printf "test-compiler.rkt\n")
(define-runtime-path this-test-path ".") (define-runtime-path this-test-path ".")
@ -1339,12 +1342,16 @@
#:with-bootstrapping? #t) #:with-bootstrapping? #t)
(parameterize ([current-module-path (build-path this-test-path "foo.rkt")]) (parameterize ([current-module-path (build-path this-test-path "foo.rkt")]
(test '(module foo racket/base [current-simulated-output-port (open-output-bytes)])
(printf "hello world")) (test '(module foo '#%kernel
(make-undefined) (display "hello world")
(newline))
(void)
#:as-main-module 'whalesong/tests/foo.rkt #:as-main-module 'whalesong/tests/foo.rkt
#:with-bootstrapping? #t)) #:with-bootstrapping? #t)
(check-equal? (get-output-bytes (current-simulated-output-port))
#"hello world\n"))

View File

@ -1,10 +1,12 @@
#lang racket #lang racket
(require "../browser-evaluate.rkt" (require "../browser-evaluate.rkt"
"../package.rkt" "../js-assembler/package.rkt"
"../js-assembler/get-runtime.rkt" "../js-assembler/get-runtime.rkt"
racket/port racket/port
racket/runtime-path) racket/runtime-path)
(printf "test-conform-browser.rkt\n")
(define-runtime-path conform-path (build-path "conform")) (define-runtime-path conform-path (build-path "conform"))

View File

@ -1,12 +1,14 @@
#lang racket #lang racket
(require "../browser-evaluate.rkt" (require "../browser-evaluate.rkt"
"../package.rkt" "../js-assembler/package.rkt"
"../js-assembler/get-runtime.rkt" "../js-assembler/get-runtime.rkt"
racket/port racket/port
racket/runtime-path racket/runtime-path
racket/runtime-path racket/runtime-path
(for-syntax racket/base)) (for-syntax racket/base))
(printf "test-earley-browser.rkt\n")
(define-runtime-path earley-file-path (build-path "earley")) (define-runtime-path earley-file-path (build-path "earley"))

View File

@ -7,6 +7,8 @@
racket/runtime-path racket/runtime-path
rackunit) rackunit)
(printf "test-get-dependencies.rkt\n")
(define-runtime-path compiler-path "..") (define-runtime-path compiler-path "..")

View File

@ -1,7 +1,8 @@
#lang racket/base #lang racket/base
(require "../package.rkt") (require "../js-assembler/package.rkt")
(printf "test-package.rkt\n")
(define (follow? p) (define (follow? p)

View File

@ -11,6 +11,8 @@
racket/runtime-path racket/runtime-path
(for-syntax racket/base)) (for-syntax racket/base))
(printf "test-parse-bytecode.rkt\n")
(define-runtime-path this-test-path ".") (define-runtime-path this-test-path ".")
(define (run-zo-parse stx) (define (run-zo-parse stx)

View File

@ -6,6 +6,8 @@
"../lam-entry-gensym.rkt" "../lam-entry-gensym.rkt"
(for-syntax racket/base)) (for-syntax racket/base))
(printf "test-parse.rkt\n");
; Test out the compiler, using the simulator. ; Test out the compiler, using the simulator.
(define-syntax (test stx) (define-syntax (test stx)
(syntax-case stx () (syntax-case stx ()

View File

@ -6,6 +6,8 @@
"../simulator/simulator-primitives.rkt" "../simulator/simulator-primitives.rkt"
"../simulator/simulator.rkt") "../simulator/simulator.rkt")
(printf "test-simulator.rkt\n")
(define-syntax (test stx) (define-syntax (test stx)
(syntax-case stx () (syntax-case stx ()