mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-11-24 12:54:28 +03:00
add test target and basic test 'harness'
test harness is a grand word for just a basic C main file that uses plain <assert.h> macro to run tests
This commit is contained in:
parent
7f53d0d54d
commit
2b11b7cc32
@ -25,37 +25,41 @@ else
|
||||
LIBFLAGS :=-shared
|
||||
endif
|
||||
|
||||
OBJS = idris_net.o
|
||||
HDRS = idris_net.h
|
||||
LIBNAME=idris_net
|
||||
OBJS = $(LIBNAME).o
|
||||
HDRS = $(LIBNAME).h
|
||||
CFLAGS := $(CFLAGS)
|
||||
|
||||
ifneq ($(OS), windows)
|
||||
CFLAGS += -fPIC
|
||||
endif
|
||||
|
||||
DYLIBTARGET = idrnet$(SHLIB_SUFFIX)
|
||||
LIBTARGET = idrnet.a
|
||||
DYLIBTARGET = lib$(LIBNAME)$(SHLIB_SUFFIX)
|
||||
LIBTARGET = $(LIBNAME).a
|
||||
TARGET=${HOME}/.idris2
|
||||
|
||||
build: $(LIBTARGET) $(DYLIBTARGET)
|
||||
|
||||
$(LIBTARGET) : $(OBJS)
|
||||
$(AR) rc $(LIBTARGET) $(OBJS)
|
||||
$(RANLIB) $(LIBTARGET)
|
||||
build: $(DYLIBTARGET)
|
||||
@if ! [ -d build ]; then echo "creating 'build' directory"; mkdir build ; else echo "directory 'build' exists"; fi
|
||||
@if [ -z "${IDRIS2}" ]; then echo 'variable $$IDRIS2 is not set, aborting'; exit 1; fi
|
||||
${IDRIS2} --build network.ipkg
|
||||
|
||||
$(DYLIBTARGET) : $(OBJS)
|
||||
$(CC) -o $(DYLIBTARGET) $(LIBFLAGS) -shared $(OBJS)
|
||||
|
||||
install: build
|
||||
install $(LIBTARGET) $(HDRS) $(TARGET)
|
||||
install:
|
||||
install $(DYLIBTARGET) $(HDRS) $(TARGET)
|
||||
${IDRIS2} --install network.ipkg
|
||||
|
||||
clean :
|
||||
rm -rf $(OBJS) $(LIBTARGET) $(DYLIBTARGET) build
|
||||
|
||||
test: $(DYLIBTARGET)
|
||||
$(CC) -o network-tests -L. -I. -l$(LIBNAME) test.c
|
||||
./network-tests
|
||||
|
||||
$(OBJS): $(HDRS)
|
||||
|
||||
all: $(DYLIBTARGET) $(LIBTARGET)
|
||||
${IDRIS2} --build network1.ipkg
|
||||
${IDRIS2} --build network.ipkg
|
||||
|
||||
.PHONY: build install clean
|
||||
|
12
libs/network/test.c
Normal file
12
libs/network/test.c
Normal file
@ -0,0 +1,12 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include "idris_net.h"
|
||||
|
||||
|
||||
int main(int argc, char**argv) {
|
||||
int eagain = idrnet_geteagain();
|
||||
assert(eagain == 35);
|
||||
|
||||
printf("network library tests SUCCESS\n");
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user