SCI conformance gate (pure Chez)
Re-port the SCI compatibility stress test to joltc: host/chez/run-sci.ss loads borkdude/sci's own source (vendor/sci, re-vendored) through the spine and requires its forms to compile+eval. Floor-gated at 160/218 forms (the tail is genuine host gaps — set! on vars, some macro/def shapes); raise as they close. Wired into 'make test' (skips if the submodule isn't checked out). jolt-cf1q.6
This commit is contained in:
parent
48e2ef5910
commit
017a1bc8c4
5 changed files with 92 additions and 2 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -1,3 +1,6 @@
|
|||
[submodule "vendor/irregex"]
|
||||
path = vendor/irregex
|
||||
url = https://github.com/ashinn/irregex.git
|
||||
[submodule "vendor/sci"]
|
||||
path = vendor/sci
|
||||
url = https://github.com/borkdude/sci.git
|
||||
|
|
|
|||
8
Makefile
8
Makefile
|
|
@ -4,10 +4,10 @@
|
|||
# build step. `make test` is the full gate. `make remint` rebuilds the seed after a
|
||||
# source change.
|
||||
|
||||
.PHONY: test values corpus unit smoke selfhost certify remint
|
||||
.PHONY: test values corpus unit smoke selfhost sci certify remint
|
||||
|
||||
# Full gate. Each step exits non-zero on failure, failing the target.
|
||||
test: selfhost values corpus unit smoke certify
|
||||
test: selfhost values corpus unit smoke sci certify
|
||||
@echo "OK: all gates passed"
|
||||
|
||||
# Self-host fixpoint: bootstrap.ss rebuild == checked-in seed.
|
||||
|
|
@ -30,6 +30,10 @@ unit:
|
|||
smoke:
|
||||
@sh host/chez/smoke.sh
|
||||
|
||||
# SCI conformance: load borkdude/sci's source through joltc (floor-gated).
|
||||
sci:
|
||||
@chez --script host/chez/run-sci.ss
|
||||
|
||||
# JVM oracle: certify the corpus against reference Clojure. Skips if clojure absent.
|
||||
certify:
|
||||
@if command -v clojure >/dev/null 2>&1; then \
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ make corpus # conformance corpus vs the JVM-sourced spec
|
|||
make unit # host-specific unit cases
|
||||
make selfhost # bootstrap fixpoint (rebuild == checked-in seed)
|
||||
make smoke # bin/joltc CLI smoke
|
||||
make sci # load borkdude/sci's source through joltc (compat stress)
|
||||
make certify # JVM oracle (skips if clojure is absent)
|
||||
```
|
||||
|
||||
|
|
|
|||
81
host/chez/run-sci.ss
Normal file
81
host/chez/run-sci.ss
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
;; run-sci.ss — SCI conformance: load borkdude/sci's own source (vendor/sci) through
|
||||
;; joltc and require its forms to compile+eval. A real-world Clojure-compatibility
|
||||
;; stress test. Pure Chez, no Janet. Floor-gated like the corpus: a regression below
|
||||
;; the floor (or the count today, 160/218) fails. Raise the floor as host gaps close
|
||||
;; (the tail is genuine gaps — set! on vars, some macro/def shapes).
|
||||
;;
|
||||
;; chez --script host/chez/run-sci.ss
|
||||
;; JOLT_SCI_FLOOR=N override the floor (default 160)
|
||||
;; SCI_VERBOSE=1 print each failing form's error
|
||||
(import (chezscheme))
|
||||
|
||||
;; Skip cleanly when the submodule isn't checked out.
|
||||
(unless (file-exists? "vendor/sci/src/sci/core.cljc")
|
||||
(display "skip: vendor/sci not checked out (git submodule update --init vendor/sci)\n")
|
||||
(exit 0))
|
||||
|
||||
(load "host/chez/rt.ss")
|
||||
(set-chez-ns! "clojure.core")
|
||||
(load "host/chez/seed/prelude.ss")
|
||||
(load "host/chez/post-prelude.ss")
|
||||
(set-chez-ns! "user")
|
||||
(load "host/chez/host-contract.ss")
|
||||
(load "host/chez/seed/image.ss")
|
||||
(load "host/chez/compile-eval.ss")
|
||||
|
||||
;; SCI's .cljc selects host code via #?(:clj ...) with no :jolt branch — read clj.
|
||||
(set! rdr-features (list "clj" "jolt" "default"))
|
||||
|
||||
(define (slurp path)
|
||||
(call-with-input-file path
|
||||
(lambda (p) (let loop ((cs '()) (c (read-char p)))
|
||||
(if (eof-object? c) (list->string (reverse cs)) (loop (cons c cs) (read-char p)))))))
|
||||
|
||||
;; Load every form in a file, evaluating each in the current ns (an (ns ...) form
|
||||
;; switches it). Returns (ok . fail); failures are tolerated (lenient — SCI requires
|
||||
;; host libs that don't exist here).
|
||||
(define (load-forms path verbose)
|
||||
(let ((src (slurp path)) (ok 0) (fail 0))
|
||||
(let ((end (string-length src)))
|
||||
(let loop ((i 0))
|
||||
(call-with-values (lambda () (rdr-read-form src i end))
|
||||
(lambda (form j)
|
||||
(unless (rdr-eof? form)
|
||||
(guard (e (#t (set! fail (+ fail 1))
|
||||
(when verbose
|
||||
(printf " FAIL: ~a\n" (call-with-string-output-port
|
||||
(lambda (p) (display-condition (if (condition? e) e
|
||||
(make-message-condition (jolt-final-str e))) p)))))))
|
||||
(jolt-compile-eval-form form (chez-current-ns))
|
||||
(set! ok (+ ok 1)))
|
||||
(loop j))))))
|
||||
(cons ok fail)))
|
||||
|
||||
(define verbose (and (getenv "SCI_VERBOSE") #t))
|
||||
|
||||
;; stubs first (host shims SCI's source expects)
|
||||
(for-each (lambda (f) (load-forms (string-append "src/jolt/clojure/sci/" f) verbose))
|
||||
'("lang_stubs.clj" "io_stubs.clj" "host_stubs.clj"))
|
||||
|
||||
(define sci-base "vendor/sci/src/sci/")
|
||||
(define load-order
|
||||
'("impl/macros.cljc" "impl/protocols.cljc" "impl/types.cljc" "impl/unrestrict.cljc"
|
||||
"impl/vars.cljc" "lang.cljc" "impl/utils.cljc" "ctx_store.cljc" "impl/deftype.cljc"
|
||||
"impl/records.cljc" "impl/core_protocols.cljc" "impl/hierarchies.cljc"
|
||||
"impl/destructure.cljc" "impl/doseq_macro.cljc" "impl/for_macro.cljc" "impl/fns.cljc"
|
||||
"impl/multimethods.cljc" "impl/namespaces.cljc" "core.cljc"))
|
||||
|
||||
(define total-ok 0) (define total-fail 0)
|
||||
(for-each
|
||||
(lambda (f)
|
||||
(let* ((r (load-forms (string-append sci-base f) verbose)) (ok (car r)) (fail (cdr r)))
|
||||
(set! total-ok (+ total-ok ok)) (set! total-fail (+ total-fail fail))
|
||||
(printf " ~a: ~a ok, ~a fail\n" f ok fail)))
|
||||
load-order)
|
||||
|
||||
(printf "\nSCI load: ~a/~a forms ok (~a fail)\n" total-ok (+ total-ok total-fail) total-fail)
|
||||
(define floor (let ((s (getenv "JOLT_SCI_FLOOR"))) (if s (string->number s) 160)))
|
||||
(when (< total-ok floor)
|
||||
(printf "REGRESSION: ~a forms loaded < floor ~a\n" total-ok floor))
|
||||
(flush-output-port)
|
||||
(exit (if (< total-ok floor) 1 0))
|
||||
1
vendor/sci
vendored
Submodule
1
vendor/sci
vendored
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 32d62a5136ad3dc148588752f5bcc4cc30b14752
|
||||
Loading…
Add table
Add a link
Reference in a new issue