fix execution of tests to actually fail if there's an error

This commit is contained in:
Arnaud Bailly 2019-07-25 19:49:15 +02:00
parent 055a5f2449
commit 87b754de45
No known key found for this signature in database
GPG Key ID: 389CC2BC5448321E
2 changed files with 13 additions and 4 deletions

View File

@ -35,7 +35,7 @@ ifneq ($(OS), windows)
CFLAGS += -fPIC
endif
DYLIBTARGET = $(LIBNAME)$(SHLIB_SUFFIX)
DYLIBTARGET = lib$(LIBNAME)$(SHLIB_SUFFIX)
LIBTARGET = $(LIBNAME).a
TARGET=${HOME}/.idris2
@ -48,7 +48,7 @@ $(DYLIBTARGET) : $(OBJS)
$(CC) -o $(DYLIBTARGET) $(LIBFLAGS) -shared $(OBJS)
install:
install $(DYLIBTARGET) $(HDRS) $(TARGET)
install $(DYLIBTARGET) $(HDRS) $(TARGET)/idris2/network
${IDRIS2} --install network.ipkg
clean :
@ -57,8 +57,7 @@ clean :
test: build test.c
$(CC) -o network-tests -L. -I. -l$(LIBNAME) test.c
./network-tests
${IDRIS2} --exec main Echo.idr > build/output
@if ! [ -z "$(diff build/output expected)" ]; then echo "TEST FAILURE: unexpected build/output"; exit 2; else echo "TEST SUCCESS"; fi
./lib-tests
$(OBJS): $(HDRS)

10
libs/network/lib-tests Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
${IDRIS2} --exec main Echo.idr > build/output
if ! [ -z "$(diff build/output expected)" ]; then
echo "TEST FAILURE: unexpected build/output"
exit 2
else
echo "TEST SUCCESS"
fi