ref: 2f3e23bd374f9a6504de6000989ebf2adf67c80c
parent: d356142c8d2e4518614ea28acce1f9a5d7b8044c
author: Philip McGrath <philip@philipmcgrath.com>
date: Mon Apr 11 21:14:16 CDT 2022
zuo: support `make check`
--- a/Makefile.in
+++ b/Makefile.in
@@ -26,6 +26,10 @@
zuo: $(srcdir)/zuo.c
$(CC) $(CPPFLAGS) $(CFLAGS) -DZUO_LIB_PATH='"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS) $(LIBS)
+.PHONY: check
+check: zuo
+ ./zuo . check
+
.PHONY: install
install: zuo
./zuo . install
--- a/build.zuo
+++ b/build.zuo
@@ -80,6 +80,19 @@
(phony-rule (list zuo-to-run zuo-to-install)
void))))
+ ;; A phony target to run the test suite
+ (define check
+ (target 'check
+ (lambda (token)
+ (phony-rule (list zuo-to-run)
+ (lambda ()
+ (unless (= 0 (process-status
+ (thread-process-wait
+ (hash-ref (process "to-run/zuo"
+ (at-source "tests/main.zuo"))
+ 'process))))
+ (error "check failed")))))))
+
;; A phony target to install
(define install
(target 'install
@@ -106,4 +119,5 @@
image_zuo.c
zuo-to-run
zuo-to-install
+ check
install))