diff --git a/test/Makefile b/test/Makefile index 4419313..66c2445 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,8 +1,6 @@ OPT = -O2 DEBUG = 2 -CFLAGS_COMMON = -Wall -std=c99 ${OPT} -CFLAGS = -I../include -I../src ${CFLAGS_COMMON} -CFLAGS_TEST = -Wall ${OPT} +CFLAGS = -I../include -I../src -Wall -std=c99 ${OPT} LDFLAGS = -L../lib LOADLIBES = -lpsyc -lm TARGETS = testPsyc testPsycSpeed testParser testMatch testRender testText isRoutingVar getVarType @@ -22,15 +20,13 @@ endif all: ${TARGETS} it: all -testPsyc: CFLAGS := ${CFLAGS_TEST} testPsyc: LOADLIBES := ${LOADLIBES} ${LOADLIBES_NET} -testPsycSpeed: CFLAGS := ${CFLAGS_TEST} testPsycSpeed: LOADLIBES := ${LOADLIBES} ${LOADLIBES_NET} #testPsycSpeed: LOADLIBES := ${LOADLIBES_NET} testJson: LOADLIBES := ${LOADLIBES_NET} -ljson -testJsonGlib: CFLAGS = ${CFLAGS_COMMON} -I/usr/include/json-glib-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include +testJsonGlib: CFLAGS := ${CFLAGS} -I/usr/include/json-glib-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include testJsonGlib: LOADLIBES := ${LOADLIBES_NET} -ljson-glib-1.0 testStrlen: LOADLIBES := ${LOADLIBES_NET} diff --git a/test/test.c b/test/test.c index 412f7c9..6c30028 100644 --- a/test/test.c +++ b/test/test.c @@ -52,7 +52,7 @@ void *get_in_addr (struct sockaddr *sa) { void test_file(const char* filename, size_t count, size_t recv_buf_size) { char *buf, *recvbuf; // cont buf + recv buf: [ ccrrrr] - size_t i, nbytes; + size_t i, nbytes, size = 0; struct timeval start, end; struct stat st; @@ -82,13 +82,14 @@ void test_file(const char* filename, size_t count, size_t recv_buf_size) { test_input(0, recvbuf, nbytes); } else { - nbytes = read(fd, (void*)recvbuf, RECV_BUF_SIZE); + while ((nbytes = read(fd, (void*)recvbuf + size, RECV_BUF_SIZE))) + size += nbytes; if (stats) gettimeofday(&start, NULL); for (i = 0; i < count; i++) - test_input(0, recvbuf, nbytes); + test_input(0, recvbuf, size); } if (stats) { diff --git a/test/testPsyc.c b/test/testPsyc.c index 7fe6943..087beaf 100644 --- a/test/testPsyc.c +++ b/test/testPsyc.c @@ -302,7 +302,8 @@ int test_input (int i, char *recvbuf, size_t nbytes) { return ret; } -inline void resetString (psycString *s, uint8_t freeptr) +static inline +void resetString (psycString *s, uint8_t freeptr) { if (freeptr && s->length) free((void*)s->ptr);