Skip to content

Instantly share code, notes, and snippets.

@vstm
Created December 5, 2013 16:30
Show Gist options
  • Save vstm/7808570 to your computer and use it in GitHub Desktop.
Save vstm/7808570 to your computer and use it in GitHub Desktop.
Crazy idea for pluggable SAPI tests for slash-lang.
diff --git a/Makefile b/Makefile
index 1e3c4b9..204f338 100644
--- a/Makefile
+++ b/Makefile
@@ -16,8 +16,9 @@ OBJS+=src/class.o src/error.o src/method.o src/object.o src/dispatch.o \
src/unicode.o src/lib/gc.o src/lib/buffer.o src/lib/slash.o src/data.o
SAPIS=$(shell ls -F sapi | grep "/" | sed -e 's/\///')
+SAPI_TESTS=$(patsubst sapi/%/Makefile,sapi[%]-test,$(shell grep -lE '^test:' $(patsubst sapi[%],sapi/%/Makefile,$(TARGETS))))
-.PHONY=clean default test install
+.PHONY=clean default test install sapi[%]-test
default: $(TARGETS)
@@ -29,6 +30,14 @@ test: sapi[cli]
@sapi/cli/slash-cli -I ./lib/slash test/test.sl test/*/*.sl
@echo "Running tests with --gc-after-test"
@sapi/cli/slash-cli -I ./lib/slash test/test.sl --gc-after-test test/*/*.sl
+ifneq (,$(SAPI_TESTS))
+ @echo "Running SAPI tests"
+ @make $(SAPI_TESTS)
+endif
+
+sapi[%]-test: libslash.a
+ @echo "Running tests for SAPI $*"
+ @CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" make -C sapi/$* test
sapi[%]: libslash.a
@echo "make sapi/$*"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment