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
|
LIBFLAGS :=-shared
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OBJS = idris_net.o
|
LIBNAME=idris_net
|
||||||
HDRS = idris_net.h
|
OBJS = $(LIBNAME).o
|
||||||
|
HDRS = $(LIBNAME).h
|
||||||
CFLAGS := $(CFLAGS)
|
CFLAGS := $(CFLAGS)
|
||||||
|
|
||||||
ifneq ($(OS), windows)
|
ifneq ($(OS), windows)
|
||||||
CFLAGS += -fPIC
|
CFLAGS += -fPIC
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DYLIBTARGET = idrnet$(SHLIB_SUFFIX)
|
DYLIBTARGET = lib$(LIBNAME)$(SHLIB_SUFFIX)
|
||||||
LIBTARGET = idrnet.a
|
LIBTARGET = $(LIBNAME).a
|
||||||
TARGET=${HOME}/.idris2
|
TARGET=${HOME}/.idris2
|
||||||
|
|
||||||
build: $(LIBTARGET) $(DYLIBTARGET)
|
build: $(DYLIBTARGET)
|
||||||
|
@if ! [ -d build ]; then echo "creating 'build' directory"; mkdir build ; else echo "directory 'build' exists"; fi
|
||||||
$(LIBTARGET) : $(OBJS)
|
@if [ -z "${IDRIS2}" ]; then echo 'variable $$IDRIS2 is not set, aborting'; exit 1; fi
|
||||||
$(AR) rc $(LIBTARGET) $(OBJS)
|
${IDRIS2} --build network.ipkg
|
||||||
$(RANLIB) $(LIBTARGET)
|
|
||||||
|
|
||||||
$(DYLIBTARGET) : $(OBJS)
|
$(DYLIBTARGET) : $(OBJS)
|
||||||
$(CC) -o $(DYLIBTARGET) $(LIBFLAGS) -shared $(OBJS)
|
$(CC) -o $(DYLIBTARGET) $(LIBFLAGS) -shared $(OBJS)
|
||||||
|
|
||||||
install: build
|
install:
|
||||||
install $(LIBTARGET) $(HDRS) $(TARGET)
|
install $(DYLIBTARGET) $(HDRS) $(TARGET)
|
||||||
${IDRIS2} --install network.ipkg
|
${IDRIS2} --install network.ipkg
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
rm -rf $(OBJS) $(LIBTARGET) $(DYLIBTARGET) build
|
rm -rf $(OBJS) $(LIBTARGET) $(DYLIBTARGET) build
|
||||||
|
|
||||||
|
test: $(DYLIBTARGET)
|
||||||
|
$(CC) -o network-tests -L. -I. -l$(LIBNAME) test.c
|
||||||
|
./network-tests
|
||||||
|
|
||||||
$(OBJS): $(HDRS)
|
$(OBJS): $(HDRS)
|
||||||
|
|
||||||
all: $(DYLIBTARGET) $(LIBTARGET)
|
all: $(DYLIBTARGET) $(LIBTARGET)
|
||||||
${IDRIS2} --build network1.ipkg
|
${IDRIS2} --build network.ipkg
|
||||||
|
|
||||||
.PHONY: build install clean
|
.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