Added a Dummy interface (passes the AppServer tests)
This commit is contained in:
parent
eeb79355cd
commit
c9dd376cb6
2
Makefile
2
Makefile
|
@ -22,6 +22,8 @@ dist:
|
|||
$(LN) -s -- . $(PACKAGE)-$(VERSION)
|
||||
@$(TAR) $(PACKAGE)-$(VERSION).tar.gz -- \
|
||||
$(PACKAGE)-$(VERSION)/data/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/data/Dummy.interface \
|
||||
$(PACKAGE)-$(VERSION)/data/appbroker.sh \
|
||||
$(PACKAGE)-$(VERSION)/data/libApp.pc.in \
|
||||
$(PACKAGE)-$(VERSION)/data/pkgconfig.sh \
|
||||
$(PACKAGE)-$(VERSION)/data/project.conf \
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
MKDIR = mkdir -m 0755 -p
|
||||
INSTALL = install
|
||||
RM = rm -f
|
||||
TARGETS = libApp.pc
|
||||
PREFIX = /usr/local
|
||||
DESTDIR =
|
||||
|
@ -21,8 +24,11 @@ distclean: clean
|
|||
|
||||
install: $(TARGETS)
|
||||
./pkgconfig.sh -P "$(DESTDIR)$(PREFIX)" -i -- "libApp.pc"
|
||||
$(MKDIR) $(DESTDIR)$(PREFIX)/etc/AppInterface
|
||||
$(INSTALL) -m 0644 Dummy.interface $(DESTDIR)$(PREFIX)/etc/AppInterface/Dummy.interface
|
||||
|
||||
uninstall:
|
||||
./pkgconfig.sh -P "$(DESTDIR)$(PREFIX)" -u -- "libApp.pc"
|
||||
$(RM) -- $(DESTDIR)$(PREFIX)/etc/AppInterface/Dummy.interface
|
||||
|
||||
.PHONY: all clean distclean install uninstall
|
||||
|
|
68
data/appbroker.sh
Executable file
68
data/appbroker.sh
Executable file
|
@ -0,0 +1,68 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2011-2014 Pierre Pronchery <khorben@defora.org>
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
#AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
#IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
#DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
#FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
#DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
#SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
#CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
#OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
#OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
|
||||
#variables
|
||||
#executables
|
||||
APPBROKER="AppBroker"
|
||||
|
||||
|
||||
#functions
|
||||
#usage
|
||||
_usage()
|
||||
{
|
||||
echo "Usage: appbroker.sh target" 1>&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
#main
|
||||
clean=0
|
||||
while getopts "cP:" name; do
|
||||
case "$name" in
|
||||
c)
|
||||
clean=1
|
||||
;;
|
||||
P)
|
||||
#we can ignore it
|
||||
;;
|
||||
?)
|
||||
_usage
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
if [ $# -ne 1 ]; then
|
||||
_usage
|
||||
exit $?
|
||||
fi
|
||||
|
||||
[ "$clean" -ne 0 ] && exit 0
|
||||
|
||||
APPINTERFACE="$1"
|
||||
APPINTERFACE="${APPINTERFACE##*/}"
|
||||
APPINTERFACE="../data/${APPINTERFACE%%.h}.interface"
|
||||
$APPBROKER -o "$1" "$APPINTERFACE"
|
|
@ -1,5 +1,8 @@
|
|||
targets=libApp.pc
|
||||
dist=Makefile,libApp.pc.in,pkgconfig.sh
|
||||
dist=Makefile,Dummy.interface,appbroker.sh,libApp.pc.in,pkgconfig.sh
|
||||
|
||||
[Dummy.interface]
|
||||
install=$(PREFIX)/etc/AppInterface
|
||||
|
||||
[libApp.pc]
|
||||
type=script
|
||||
|
|
|
@ -68,7 +68,7 @@ AppClient * appclient_new_event(char const * app, char const * name,
|
|||
#endif
|
||||
if((appclient = object_new(sizeof(*appclient))) == NULL)
|
||||
return NULL;
|
||||
appclient->interface = appinterface_new_server(app);
|
||||
appclient->interface = appinterface_new(app);
|
||||
appclient->helper.data = appclient;
|
||||
appclient->helper.message = _appclient_helper_message;
|
||||
appclient->event = (event != NULL) ? event : event_new();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
TARGETS = appclient appmessage appserver lookup tests.log transport
|
||||
TARGETS = Dummy.h appclient appmessage appserver lookup tests.log transport
|
||||
PREFIX = /usr/local
|
||||
DESTDIR =
|
||||
BINDIR = $(PREFIX)/bin
|
||||
|
@ -18,6 +18,9 @@ INSTALL = install
|
|||
|
||||
all: $(TARGETS)
|
||||
|
||||
Dummy.h: ../data/Dummy.interface
|
||||
../data/appbroker.sh -P "$(PREFIX)" -- "Dummy.h"
|
||||
|
||||
appclient_OBJS = appclient.o
|
||||
appclient_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
|
||||
appclient_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) ../src/libApp.a
|
||||
|
@ -72,7 +75,7 @@ transport.o: transport.c ../src/libApp.a
|
|||
$(CC) $(transport_CFLAGS) -c transport.c
|
||||
|
||||
clean:
|
||||
$(RM) -- $(appclient_OBJS) $(appmessage_OBJS) $(appserver_OBJS) $(lookup_OBJS) $(tests.log_OBJS) $(transport_OBJS)
|
||||
$(RM) -- $(Dummy.h_OBJS) $(appclient_OBJS) $(appmessage_OBJS) $(appserver_OBJS) $(lookup_OBJS) $(tests.log_OBJS) $(transport_OBJS)
|
||||
|
||||
distclean: clean
|
||||
$(RM) -- $(TARGETS)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <stdio.h>
|
||||
#include <System/error.h>
|
||||
#include "App/appserver.h"
|
||||
#include "Dummy.h"
|
||||
|
||||
|
||||
/* private */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
targets=appclient,appmessage,appserver,lookup,tests.log,transport
|
||||
targets=Dummy.h,appclient,appmessage,appserver,lookup,tests.log,transport
|
||||
cppflags_force=-I ../include
|
||||
cflags_force=-W `pkg-config --cflags libSystem`
|
||||
cflags=-Wall -g -O2
|
||||
|
@ -6,6 +6,11 @@ ldflags_force=`pkg-config --libs libSystem` -lApp
|
|||
ldflags=-L../src -Wl,-rpath,../src
|
||||
dist=Makefile,tests.sh
|
||||
|
||||
[Dummy.h]
|
||||
type=script
|
||||
script=../data/appbroker.sh
|
||||
depends=../data/Dummy.interface
|
||||
|
||||
[appclient]
|
||||
type=binary
|
||||
sources=appclient.c
|
||||
|
|
|
@ -113,6 +113,10 @@ echo "Performing tests:" 1>&2
|
|||
$DATE > "$target"
|
||||
_test "appclient" "appclient" -a "VFS" -n tcp:localhost:4242
|
||||
_test "appmessage" "appmessage"
|
||||
_test "appserver" "appserver" -a "Dummy" -n tcp:localhost:4242
|
||||
export APPSERVER_Dummy="tcp:localhost:4242"
|
||||
_test "appserver" "appserver" -a "Dummy"
|
||||
unset APPSERVER_Dummy
|
||||
_test "lookup" "lookup VFS tcp" -a "VFS" -n "tcp:localhost:4242"
|
||||
_test "lookup" "lookup VFS tcp4" -a "VFS" -n "tcp4:localhost:4242"
|
||||
#XXX avoid the export/unset dance
|
||||
|
@ -134,11 +138,6 @@ _test "transport" "udp 127.0.0.1:4242" -p udp 127.0.0.1:4242
|
|||
_test "transport" "udp ::1.4242" -p udp ::1.4242
|
||||
_test "transport" "udp localhost:4242" -p udp localhost:4242
|
||||
echo "Expected failures:" 1>&2
|
||||
#XXX should really succeed but appserver doesn't define the VFS symbols
|
||||
_fail "appserver" "appserver" -a "VFS" -n tcp:localhost:4242
|
||||
export APPSERVER_VFS="tcp:localhost:4242"
|
||||
_fail "appserver" "appserver" -a "VFS"
|
||||
unset APPSERVER_VFS
|
||||
_fail "lookup" "lookup" -a "VFS" -n "localhost"
|
||||
_fail "transport" "tcp6 ::1:4242" -p tcp6 ::1:4242
|
||||
_fail "transport" "tcp ::1:4242" -p tcp ::1:4242
|
||||
|
|
Loading…
Reference in New Issue
Block a user