diff --git a/tests/appinterface.c b/tests/appinterface.c new file mode 100644 index 0000000..6def033 --- /dev/null +++ b/tests/appinterface.c @@ -0,0 +1,69 @@ +/* $Id$ */ +/* Copyright (c) 2017 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 . */ + + + +#include +#include +#include +#include "../src/appinterface.h" + + +/* private */ +/* functions */ +/* usage */ +static int _usage(void) +{ + fputs("Usage: appinterface -a app\n", stderr); + return 1; +} + + +/* public */ +/* main */ +int main(int argc, char * argv[]) +{ + int o; + String const * app = NULL; + String * path; + AppInterface * appinterface; + + while((o = getopt(argc, argv, "a:")) != -1) + switch(o) + { + case 'a': + app = optarg; + break; + default: + return _usage(); + } + if(optind != argc || app == NULL) + return _usage(); + if((path = string_new_append("../data/", app, ".interface", NULL)) + == NULL) + { + error_print("appinterface"); + return 2; + } + appinterface = appinterface_new_interface(ATM_SERVER, app, path); + string_delete(path); + if(appinterface == NULL) + { + error_print("appinterface"); + return 3; + } + appinterface_delete(appinterface); + return 0; +} diff --git a/tests/project.conf b/tests/project.conf index 6c30ae9..7066bc2 100644 --- a/tests/project.conf +++ b/tests/project.conf @@ -1,4 +1,4 @@ -targets=Dummy.h,appclient,appmessage,appserver,includes,lookup,tests.log,transport +targets=Dummy.h,appclient,appinterface,appmessage,appserver,includes,lookup,tests.log,transport cppflags_force=-I ../include -isystem . cflags_force=`pkg-config --cflags libSystem` cflags=-W -Wall -g -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector-all @@ -19,6 +19,14 @@ ldflags=$(OBJDIR)../src/libApp.a [appclient.c] depends=$(OBJDIR)../src/libApp.a +[appinterface] +type=binary +sources=appinterface.c +ldflags=$(OBJDIR)../src/libApp.a + +[appinterface.c] +depends=$(OBJDIR)../src/libApp.a + [appmessage] type=binary sources=appmessage.c diff --git a/tests/tests.sh b/tests/tests.sh index 54f1679..1369e93 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -134,6 +134,7 @@ while [ $# -ne 0 ]; do _test "appbroker.sh" "Test" "Test.interface" APPINTERFACE_Test=Test.interface \ _test "appclient" "appclient" -a "Test" -n tcp:localhost:4242 + _test "appinterface" "appinterface" -a "Dummy" _test "appmessage" "appmessage" APPINTERFACE_Dummy=../data/Dummy.interface \ _test "appserver" "appserver" -a "Dummy" -n tcp:localhost:4242