Browse Source

Makefile for testers and fix test_handlers.c

1.0.0
Georg Hopp 10 years ago
parent
commit
a867831b3a
  1. 33
      testers/Makefile
  2. 22
      testers/test_handler.c

33
testers/Makefile

@ -0,0 +1,33 @@
TRLIBS = -ltrbase \
-ltrhashing \
-ltrio \
-ltrdata \
-ltrevent \
-ltrcomm
LIBS = $(TRLIBS) \
-lcrypto \
-lssl \
-lrt \
-luuid
PROHRAMS = testserver2 \
testtcp \
testudp
all: $(PROHRAMS)
testserver2: testserver2.o test_handler.o
$(CC) $(LDFLAGS) -std=c99 $(LIBS) -o $@ $< test_handler.o
testtcp: testclient.o
$(CC) $(LDFLAGS) -std=c99 $(LIBS) -o $@ $<
testudp: testudp.o
$(CC) $(LDFLAGS) -std=c99 $(LIBS) -o $@ $<
testudp.o: testclient.c
$(CC) $(CFLAGS) -DUDP=1 -std=c99 -c -o $@ $<
%.o: %.c
$(CC) $(CFLAGS) -std=c99 -c -o $@ $<

22
testers/test_handler.c

@ -9,8 +9,9 @@
static
TR_EventDone
testHandlerHeartbeat(TR_EventHandler this, TR_Event event)
{
testHandlerHeartbeat(void * _this, TR_Event event)
{
TR_EventHandler this = _this;
double size = (double)((TestHandler)this)->size;
double size_msg = ((TestHandler)this)->size
? size / ((TestHandler)this)->handled
@ -35,12 +36,13 @@ testHandlerHeartbeat(TR_EventHandler this, TR_Event event)
((TestHandler)this)->size = 0;
return TR_EVENT_DONE;
}
}
static
TR_EventDone
testHandlerNewMessage(TR_EventHandler this, TR_Event event)
{
testHandlerNewMessage(void * _this, TR_Event event)
{
TR_EventHandler this = _this;
TR_Event _event;
TR_ProtoMessageRaw message = event->data;
@ -55,16 +57,16 @@ testHandlerNewMessage(TR_EventHandler this, TR_Event event)
TR_eventHandlerIssueEvent((TR_EventHandler)this, _event);
return TR_EVENT_DONE;
}
}
static
TR_EventDone
testHandlerClose(TR_EventHandler this, TR_Event event)
{
testHandlerClose(void * _this, TR_Event event)
{
// puts("close");
return TR_EVENT_PENDING;
}
}
#if 0
static
@ -89,7 +91,7 @@ testHandlerCtor(void * _this, va_list * params)
static
void
testHandlerDtor(void * _this, va_list * params)
testHandlerDtor(void * _this)
{
TR_PARENTCALL(TestHandler, _this, TR_Class, dtor);
}

Loading…
Cancel
Save