Import a "appinterface" test
This commit is contained in:
parent
bb6c173feb
commit
aa43762f90
69
tests/appinterface.c
Normal file
69
tests/appinterface.c
Normal file
|
@ -0,0 +1,69 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2017 Pierre Pronchery <khorben@defora.org> */
|
||||
/* 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <System/error.h>
|
||||
#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;
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user