Skip to content

Commit

Permalink
Unifiy building tests for JS and PHP targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenMichaelKlose committed Jan 20, 2025
1 parent f7fd36d commit 29510bb
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 64 deletions.
25 changes: 12 additions & 13 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@ clean ()

install_it ()
{
echo "Installing 'tre' to '$BINDIR'…"
sudo cp tre $BINDIR
sudo mkdir -p /usr/local/lib/tre
echo "Installing SBCL image to '/usr/local/lib/tre/image'…"
sudo cp -v image /usr/local/lib/tre
sudo cp -v image /usr/local/lib/tre/
echo "Installing environment to '/usr/local/lib/tre/environment/'…"
sudo cp -rv environment modules /usr/local/lib/tre
echo "Done."
sudo cp -rv environment modules /usr/local/lib/tre/
echo "Installing 'tre' to '$BINDIR'…"
sudo cp tre $BINDIR
}

case $1 in
Expand Down Expand Up @@ -78,28 +77,28 @@ boot)

phptests)
echo "PHP target tests…"
$TRE tests/php.lisp
echo "(compile-tests *php-transpiler*)" | $TRE tests/toplevel.lisp
php compiled/test.php | tee log-phptests.lisp
cmp tests/php.correct-output log-phptests.lisp || (diff tests/php.correct-output log-phptests.lisp; exit 1)
for i in compiled/unit*.php; do php $i; done
;;

jstests)
echo "JavaScript target tests…"
$TRE tests/js.lisp
echo "JS target tests…"
echo "(compile-tests *js-transpiler*)" | $TRE tests/toplevel.lisp
node compiled/test.js | tee log-jstests.lisp
#chromium-browser compiled/test.html &
#$BROWSER compiled/test.html
cmp tests/js.correct-output log-jstests.lisp || (diff tests/js.correct-output log-jstests.lisp; exit 1)
for i in compiled/unit*.js; do node $i; done
echo "JavaScript target tests passed in node.js."
echo "JS target tests passed in node.js."
;;

updatetests)
$TRE tests/php.lisp
$TRE tests/js.lisp
echo "(compile-tests *php-transpiler*)" | $TRE tests/toplevel.lisp
echo "(compile-tests *js-transpiler*)" | $TRE tests/toplevel.lisp
echo "Updating PHP target test data…"
php compiled/test.php >tests/php.correct-output
echo "Updating JavaScript target test data (node.js only)…"
echo "Updating JS target test data (node.js only)…"
node compiled/test.js >tests/js.correct-output || node compiled/test.js >tests/js.correct-output
;;

Expand Down
26 changes: 0 additions & 26 deletions tests/js.lisp

This file was deleted.

25 changes: 0 additions & 25 deletions tests/php.lisp

This file was deleted.

27 changes: 27 additions & 0 deletions tests/toplevel.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
(fn compile-env-tests (tr)
(make-project (format nil "~A environment test" (transpiler-name tr))
(list "environment/stage3/type.lisp"
(. 'tests (make-environment-tests))
(. 'toplevel '((environment-tests))))
:transpiler (copy-transpiler tr)
:emitter [put-file (format nil "compiled/test.~A" (transpiler-file-postfix tr)) _]))

(fn compile-unit-tests (tr lst)
(do ((n 1 (++ n))
(i lst .i))
((not i))
(!= i.
(make-project (format nil "Unit ~A: ~A" n .!.)
(format nil "tests/unit-~A-~A.lisp" n !.)
:transpiler (copy-transpiler tr)
:emitter [put-file (format nil "compiled/unit-~A-~A.~A" n !. (transpiler-file-postfix tr)) _]))))

(fn compile-tests (tr)
(unix-sh-mkdir "compiled" :parents t)
(compile-env-tests tr)
(compile-unit-tests tr
'(("smoke-test" "Smoke test")
("getter" "Something with getters")
("base64" "BASE64-ENCODE, BASE64-DECODE")
)))
; ("slot-value" "SLOT-VALUE as function"))))
File renamed without changes.

0 comments on commit 29510bb

Please sign in to comment.