Commit a867831b3a394b805eefad19c3867f5ff15e68f4
1 parent
2f089b67
Makefile for testers and fix test_handlers.c
Showing
2 changed files
with
45 additions
and
10 deletions
testers/Makefile
0 → 100755
| 1 | +TRLIBS = -ltrbase \ | |
| 2 | + -ltrhashing \ | |
| 3 | + -ltrio \ | |
| 4 | + -ltrdata \ | |
| 5 | + -ltrevent \ | |
| 6 | + -ltrcomm | |
| 7 | + | |
| 8 | +LIBS = $(TRLIBS) \ | |
| 9 | + -lcrypto \ | |
| 10 | + -lssl \ | |
| 11 | + -lrt \ | |
| 12 | + -luuid | |
| 13 | + | |
| 14 | +PROHRAMS = testserver2 \ | |
| 15 | + testtcp \ | |
| 16 | + testudp | |
| 17 | + | |
| 18 | +all: $(PROHRAMS) | |
| 19 | + | |
| 20 | +testserver2: testserver2.o test_handler.o | |
| 21 | + $(CC) $(LDFLAGS) -std=c99 $(LIBS) -o $@ $< test_handler.o | |
| 22 | + | |
| 23 | +testtcp: testclient.o | |
| 24 | + $(CC) $(LDFLAGS) -std=c99 $(LIBS) -o $@ $< | |
| 25 | + | |
| 26 | +testudp: testudp.o | |
| 27 | + $(CC) $(LDFLAGS) -std=c99 $(LIBS) -o $@ $< | |
| 28 | + | |
| 29 | +testudp.o: testclient.c | |
| 30 | + $(CC) $(CFLAGS) -DUDP=1 -std=c99 -c -o $@ $< | |
| 31 | + | |
| 32 | +%.o: %.c | |
| 33 | + $(CC) $(CFLAGS) -std=c99 -c -o $@ $< | ... | ... |
| ... | ... | @@ -9,8 +9,9 @@ |
| 9 | 9 | |
| 10 | 10 | static |
| 11 | 11 | TR_EventDone |
| 12 | -testHandlerHeartbeat(TR_EventHandler this, TR_Event event) | |
| 13 | -{ | |
| 12 | +testHandlerHeartbeat(void * _this, TR_Event event) | |
| 13 | +{ | |
| 14 | + TR_EventHandler this = _this; | |
| 14 | 15 | double size = (double)((TestHandler)this)->size; |
| 15 | 16 | double size_msg = ((TestHandler)this)->size |
| 16 | 17 | ? size / ((TestHandler)this)->handled |
| ... | ... | @@ -35,12 +36,13 @@ testHandlerHeartbeat(TR_EventHandler this, TR_Event event) |
| 35 | 36 | ((TestHandler)this)->size = 0; |
| 36 | 37 | |
| 37 | 38 | return TR_EVENT_DONE; |
| 38 | -} | |
| 39 | +} | |
| 39 | 40 | |
| 40 | 41 | static |
| 41 | 42 | TR_EventDone |
| 42 | -testHandlerNewMessage(TR_EventHandler this, TR_Event event) | |
| 43 | -{ | |
| 43 | +testHandlerNewMessage(void * _this, TR_Event event) | |
| 44 | +{ | |
| 45 | + TR_EventHandler this = _this; | |
| 44 | 46 | TR_Event _event; |
| 45 | 47 | TR_ProtoMessageRaw message = event->data; |
| 46 | 48 | |
| ... | ... | @@ -55,16 +57,16 @@ testHandlerNewMessage(TR_EventHandler this, TR_Event event) |
| 55 | 57 | TR_eventHandlerIssueEvent((TR_EventHandler)this, _event); |
| 56 | 58 | |
| 57 | 59 | return TR_EVENT_DONE; |
| 58 | -} | |
| 60 | +} | |
| 59 | 61 | |
| 60 | 62 | static |
| 61 | 63 | TR_EventDone |
| 62 | -testHandlerClose(TR_EventHandler this, TR_Event event) | |
| 63 | -{ | |
| 64 | +testHandlerClose(void * _this, TR_Event event) | |
| 65 | +{ | |
| 64 | 66 | // puts("close"); |
| 65 | 67 | |
| 66 | 68 | return TR_EVENT_PENDING; |
| 67 | -} | |
| 69 | +} | |
| 68 | 70 | |
| 69 | 71 | #if 0 |
| 70 | 72 | static |
| ... | ... | @@ -89,7 +91,7 @@ testHandlerCtor(void * _this, va_list * params) |
| 89 | 91 | |
| 90 | 92 | static |
| 91 | 93 | void |
| 92 | -testHandlerDtor(void * _this, va_list * params) | |
| 94 | +testHandlerDtor(void * _this) | |
| 93 | 95 | { |
| 94 | 96 | TR_PARENTCALL(TestHandler, _this, TR_Class, dtor); |
| 95 | 97 | } | ... | ... |
Please
register
or
login
to post a comment