mirror of
git://git.psyc.eu/libpsyc
synced 2024-08-15 03:19:02 +00:00
test tool fixes
This commit is contained in:
parent
9396a0dba8
commit
52c9159b2e
3 changed files with 8 additions and 10 deletions
|
@ -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}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue