diff --git a/tests/Test.expected b/tests/Test.expected new file mode 100644 index 0000000..812984b --- /dev/null +++ b/tests/Test.expected @@ -0,0 +1,52 @@ +/* $Id$ */ + + + +#ifndef Test_Test_H +# define Test_Test_H + +# include + +# include +# include + + +/* types */ +typedef bool BOOL; +typedef Buffer * BUFFER; +typedef double * DOUBLE; +typedef float * FLOAT; +typedef int16_t INT16; +typedef int32_t INT32; +typedef uint16_t UINT16; +typedef uint32_t UINT32; +typedef String const * STRING; +typedef void VOID; +typedef bool BOOL_IN; + +typedef BUFFER BUFFER_IN; + +typedef DOUBLE DOUBLE_IN; + +typedef FLOAT FLOAT_IN; +typedef INT32 INT32_IN; +typedef UINT32 UINT32_IN; +typedef STRING STRING_IN; +typedef bool * BOOL_OUT; + +typedef Buffer * BUFFER_OUT; +typedef int32_t * INT32_OUT; +typedef uint32_t * UINT32_OUT; +typedef String ** STRING_OUT; +typedef bool * BOOL_INOUT; + +typedef Buffer * BUFFER_INOUT; +typedef int32_t * INT32_INOUT; +typedef uint32_t * UINT32_INOUT; +typedef String ** STRING_INOUT; + + +/* calls */ +void Test_Test(App * app, AppServerClient * client, int32 i32); + +#endif /* !Test_Test_H */ diff --git a/tests/Test.interface b/tests/Test.interface index e69de29..2295e61 100644 --- a/tests/Test.interface +++ b/tests/Test.interface @@ -0,0 +1,6 @@ +#$Id$ +service=Test + +[call::Test] +#ret=void +arg1=int32,i32 diff --git a/tests/appbroker.sh b/tests/appbroker.sh new file mode 100755 index 0000000..3b114af --- /dev/null +++ b/tests/appbroker.sh @@ -0,0 +1,42 @@ +#!/bin/sh +#$Id$ +#Copyright (c) 2016 Pierre Pronchery +#This file is part of DeforaOS System libApp +#This program is free software: you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation, version 3 of the License. +# +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +#along with this program. If not, see . + + + +#variables +DEVNULL="/dev/null" +PROGNAME="appbroker.sh" +#executables +CMP="cmp" +DEBUG="_debug" +MKTEMP="mktemp" +RM="rm -f" + + +#functions +#main +tmpfile=$($MKTEMP) +[ $? -eq 0 ] || exit 2 +interface="$1" +expected="${interface%.interface}.expected" +$OBJDIR../tools/AppBroker$EXEEXT -o "$tmpfile" "$interface" +ret=$? +if [ $ret -eq 0 ]; then + $CMP -- "$tmpfile" "$expected" #> "$DEVNULL" + ret=$? +fi +$RM -- "$tmpfile" +exit $ret diff --git a/tests/project.conf b/tests/project.conf index 37130af..9924dd0 100644 --- a/tests/project.conf +++ b/tests/project.conf @@ -4,7 +4,7 @@ cflags_force=`pkg-config --cflags libSystem` cflags=-W -Wall -g -O2 -pedantic -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector-all ldflags_force=`pkg-config --libs libSystem` -lApp ldflags=-L$(OBJDIR)../src -Wl,-rpath,$(OBJDIR)../src -pie -Wl,-z,relro -Wl,-z,now -rdynamic -dist=System/App.h,Makefile,Test.interface,pkgconfig.sh,tests.sh +dist=System/App.h,appbroker.sh,Makefile,Test.expected,Test.interface,pkgconfig.sh,tests.sh [Dummy.h] type=script @@ -49,7 +49,7 @@ depends=../src/apptransport.h [tests.log] type=script script=./tests.sh -depends=$(OBJDIR)appclient$(EXEEXT),$(OBJDIR)appmessage$(EXEEXT),$(OBJDIR)appserver$(EXEEXT),$(OBJDIR)includes$(EXEEXT),$(OBJDIR)lookup$(EXEEXT),pkgconfig.sh,tests.sh,$(OBJDIR)transport$(EXEEXT),../src/transport/tcp.c,../src/transport/udp.c +depends=Test.expected,Test.interface,appbroker.sh,$(OBJDIR)appclient$(EXEEXT),$(OBJDIR)appmessage$(EXEEXT),$(OBJDIR)appserver$(EXEEXT),$(OBJDIR)includes$(EXEEXT),$(OBJDIR)lookup$(EXEEXT),pkgconfig.sh,tests.sh,$(OBJDIR)transport$(EXEEXT),../src/transport/tcp.c,../src/transport/udp.c [transport] type=binary diff --git a/tests/tests.sh b/tests/tests.sh index 33be31f..9828101 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -117,6 +117,7 @@ while [ $# -ne 0 ]; do FAILED= echo "Performing tests:" 1>&2 $DATE > "$target" + _test "appbroker.sh" "Test" "Test.interface" APPINTERFACE_Test=Test.interface \ _test "appclient" "appclient" -a "Test" -n tcp:localhost:4242 _test "appmessage" "appmessage"