Renamed the lookup code and added tests
This commit is contained in:
parent
4e3129d521
commit
4db916ebe8
5
Makefile
5
Makefile
|
@ -50,8 +50,8 @@ dist:
|
|||
$(PACKAGE)-$(VERSION)/src/appinterface.h \
|
||||
$(PACKAGE)-$(VERSION)/src/appmessage.h \
|
||||
$(PACKAGE)-$(VERSION)/src/apptransport.h \
|
||||
$(PACKAGE)-$(VERSION)/src/common.c \
|
||||
$(PACKAGE)-$(VERSION)/src/common.h \
|
||||
$(PACKAGE)-$(VERSION)/src/lookup.c \
|
||||
$(PACKAGE)-$(VERSION)/src/lookup.h \
|
||||
$(PACKAGE)-$(VERSION)/src/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/src/transport/tcp.c \
|
||||
$(PACKAGE)-$(VERSION)/src/transport/tcp4.c \
|
||||
|
@ -66,6 +66,7 @@ dist:
|
|||
$(PACKAGE)-$(VERSION)/tests/appclient.c \
|
||||
$(PACKAGE)-$(VERSION)/tests/appmessage.c \
|
||||
$(PACKAGE)-$(VERSION)/tests/appserver.c \
|
||||
$(PACKAGE)-$(VERSION)/tests/lookup.c \
|
||||
$(PACKAGE)-$(VERSION)/tests/transport.c \
|
||||
$(PACKAGE)-$(VERSION)/tests/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/tests/tests.sh \
|
||||
|
|
|
@ -33,7 +33,7 @@ libApp.so.0.0 libApp.so.0 libApp.so: $(libApp_OBJS)
|
|||
$(LN) -s -- libApp.so.0.0 libApp.so.0
|
||||
$(LN) -s -- libApp.so.0.0 libApp.so
|
||||
|
||||
appclient.o: appclient.c appinterface.h ../include/App/appclient.h common.h common.c
|
||||
appclient.o: appclient.c appinterface.h ../include/App/appclient.h lookup.h lookup.c
|
||||
$(CC) $(libApp_CFLAGS) -c appclient.c
|
||||
|
||||
appinterface.o: appinterface.c ../include/App/appserver.h ../config.h
|
||||
|
@ -42,7 +42,7 @@ appinterface.o: appinterface.c ../include/App/appserver.h ../config.h
|
|||
appmessage.o: appmessage.c ../include/App/appmessage.h appmessage.h
|
||||
$(CC) $(libApp_CFLAGS) -c appmessage.c
|
||||
|
||||
appserver.o: appserver.c appinterface.h ../include/App/appserver.h common.h common.c ../config.h
|
||||
appserver.o: appserver.c appinterface.h ../include/App/appserver.h lookup.h lookup.c ../config.h
|
||||
$(CC) $(libApp_CFLAGS) -c appserver.c
|
||||
|
||||
apptransport.o: apptransport.c apptransport.h ../include/App/apptransport.h ../config.h
|
||||
|
|
|
@ -68,7 +68,7 @@ AppClient * appclient_new(char const * app, char const * name)
|
|||
|
||||
|
||||
/* appclient_new_event */
|
||||
#include "common.h"
|
||||
#include "lookup.h"
|
||||
|
||||
AppClient * appclient_new_event(char const * app, char const * name,
|
||||
Event * event)
|
||||
|
@ -104,7 +104,7 @@ AppClient * appclient_new_event(char const * app, char const * name,
|
|||
return appclient;
|
||||
}
|
||||
|
||||
#include "common.c"
|
||||
#include "lookup.c"
|
||||
|
||||
|
||||
/* appclient_delete */
|
||||
|
|
|
@ -71,7 +71,7 @@ AppServer * appserver_new(const char * app, char const * name)
|
|||
|
||||
|
||||
/* appserver_new_event */
|
||||
#include "common.h"
|
||||
#include "lookup.h"
|
||||
|
||||
AppServer * appserver_new_event(char const * app, char const * name,
|
||||
Event * event)
|
||||
|
@ -96,7 +96,7 @@ AppServer * appserver_new_event(char const * app, char const * name,
|
|||
return appserver;
|
||||
}
|
||||
|
||||
#include "common.c"
|
||||
#include "lookup.c"
|
||||
|
||||
|
||||
/* appserver_delete */
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#ifndef LIBAPP_APPTRANSPORT_H
|
||||
# define LIBAPP_APPTRANSPORT_H
|
||||
|
||||
# include <System/event.h>
|
||||
# include "App/apptransport.h"
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "lookup.h"
|
||||
|
||||
|
||||
/* new_event_transport */
|
||||
static AppTransport * _new_event_transport(AppTransportHelper * helper,
|
||||
Event * event, char const * app, char const * name)
|
|
@ -15,8 +15,12 @@
|
|||
|
||||
|
||||
|
||||
#ifndef LIBAPP_COMMON_H
|
||||
# define LIBAPP_COMMON_H
|
||||
#ifndef LIBAPP_LOOKUP_H
|
||||
# define LIBAPP_LOOKUP_H
|
||||
|
||||
# include <System/event.h>
|
||||
# include <System/string.h>
|
||||
# include "apptransport.h"
|
||||
|
||||
|
||||
/* functions */
|
||||
|
@ -25,4 +29,4 @@ static AppTransport * _new_event_transport(AppTransportHelper * helper,
|
|||
static String * _new_server_name(char const * app, char const * name);
|
||||
static String * _new_server_transport(String ** name);
|
||||
|
||||
#endif /* !LIBAPP_COMMON_H */
|
||||
#endif /* !LIBAPP_LOOKUP_H */
|
|
@ -5,7 +5,7 @@ cflags_force=-W -fPIC `pkg-config --cflags libSystem`
|
|||
cflags=-Wall -g -O2 -pedantic
|
||||
ldflags_force=`pkg-config --libs libSystem`
|
||||
ldflags=
|
||||
dist=Makefile,appinterface.h,appmessage.h,apptransport.h,common.c,common.h
|
||||
dist=Makefile,appinterface.h,appmessage.h,apptransport.h,lookup.c,lookup.h
|
||||
|
||||
[libApp]
|
||||
type=library
|
||||
|
@ -14,7 +14,7 @@ ldflags=-lsocket -lws2_32
|
|||
install=$(LIBDIR)
|
||||
|
||||
[appclient.c]
|
||||
depends=appinterface.h,../include/App/appclient.h,common.h,common.c
|
||||
depends=appinterface.h,../include/App/appclient.h,lookup.h,lookup.c
|
||||
|
||||
[appinterface.c]
|
||||
depends=../include/App/appserver.h,../config.h
|
||||
|
@ -26,7 +26,7 @@ depends=../include/App/appmessage.h,appmessage.h
|
|||
depends=../include/App/appmessage.h,../config.h
|
||||
|
||||
[appserver.c]
|
||||
depends=appinterface.h,../include/App/appserver.h,common.h,common.c,../config.h
|
||||
depends=appinterface.h,../include/App/appserver.h,lookup.h,lookup.c,../config.h
|
||||
|
||||
[apptransport.c]
|
||||
depends=apptransport.h,../include/App/apptransport.h,../config.h
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
TARGETS = appclient appmessage appserver tests.log transport
|
||||
TARGETS = appclient appmessage appserver lookup tests.log transport
|
||||
PREFIX = /usr/local
|
||||
DESTDIR =
|
||||
BINDIR = $(PREFIX)/bin
|
||||
|
@ -39,7 +39,14 @@ appserver_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) ../src/libApp.a
|
|||
appserver: $(appserver_OBJS)
|
||||
$(CC) -o appserver $(appserver_OBJS) $(appserver_LDFLAGS)
|
||||
|
||||
tests.log: appclient appmessage appserver tests.sh transport ../src/transport/tcp.c ../src/transport/udp.c
|
||||
lookup_OBJS = lookup.o
|
||||
lookup_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
|
||||
lookup_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
|
||||
|
||||
lookup: $(lookup_OBJS)
|
||||
$(CC) -o lookup $(lookup_OBJS) $(lookup_LDFLAGS)
|
||||
|
||||
tests.log: appclient appmessage appserver lookup tests.sh transport ../src/transport/tcp.c ../src/transport/udp.c
|
||||
./tests.sh -P "$(PREFIX)" -- "tests.log"
|
||||
|
||||
transport_OBJS = transport.o
|
||||
|
@ -58,11 +65,14 @@ appmessage.o: appmessage.c ../src/libApp.a
|
|||
appserver.o: appserver.c ../src/libApp.a
|
||||
$(CC) $(appserver_CFLAGS) -c appserver.c
|
||||
|
||||
lookup.o: lookup.c ../src/lookup.h ../src/lookup.c
|
||||
$(CC) $(lookup_CFLAGS) -c lookup.c
|
||||
|
||||
transport.o: transport.c ../src/libApp.a
|
||||
$(CC) $(transport_CFLAGS) -c transport.c
|
||||
|
||||
clean:
|
||||
$(RM) -- $(appclient_OBJS) $(appmessage_OBJS) $(appserver_OBJS) $(tests.log_OBJS) $(transport_OBJS)
|
||||
$(RM) -- $(appclient_OBJS) $(appmessage_OBJS) $(appserver_OBJS) $(lookup_OBJS) $(tests.log_OBJS) $(transport_OBJS)
|
||||
|
||||
distclean: clean
|
||||
$(RM) -- $(TARGETS)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
targets=appclient,appmessage,appserver,tests.log,transport
|
||||
targets=appclient,appmessage,appserver,lookup,tests.log,transport
|
||||
cppflags_force=-I ../include
|
||||
cflags_force=-W `pkg-config --cflags libSystem`
|
||||
cflags=-Wall -g -O2
|
||||
|
@ -30,10 +30,17 @@ ldflags=../src/libApp.a
|
|||
[appserver.c]
|
||||
depends=../src/libApp.a
|
||||
|
||||
[lookup]
|
||||
type=binary
|
||||
sources=lookup.c
|
||||
|
||||
[lookup.c]
|
||||
depends=../src/lookup.h,../src/lookup.c
|
||||
|
||||
[tests.log]
|
||||
type=script
|
||||
script=./tests.sh
|
||||
depends=appclient,appmessage,appserver,tests.sh,transport,../src/transport/tcp.c,../src/transport/udp.c
|
||||
depends=appclient,appmessage,appserver,lookup,tests.sh,transport,../src/transport/tcp.c,../src/transport/udp.c
|
||||
|
||||
[transport]
|
||||
type=binary
|
||||
|
|
|
@ -112,6 +112,9 @@ FAILED=
|
|||
echo "Performing tests:" 1>&2
|
||||
$DATE > "$target"
|
||||
_test "appmessage" "appmessage"
|
||||
_test "lookup" "lookup" -a "VFS" -n "localhost"
|
||||
_test "lookup" "lookup" -a "VFS" -n "tcp:localhost"
|
||||
_test "lookup" "lookup" -a "VFS" -n "tcp4:localhost"
|
||||
_test "transport" "tcp4 127.0.0.1:4242" -p tcp4 127.0.0.1:4242
|
||||
_test "transport" "tcp4 localhost:4242" -p tcp4 localhost:4242
|
||||
_test "transport" "tcp6 ::1.4242" -p tcp6 ::1.4242
|
||||
|
|
Loading…
Reference in New Issue
Block a user