Now converting the tests ..and some missing things
* fixed include paths * lots of build system fixes * initialization, shutdown, state and nobug flags are factored out into a liblumierainit.a to simplify test builds
This commit is contained in:
parent
52a9c7fb27
commit
37f56a670e
13 changed files with 120 additions and 113 deletions
|
|
@ -16,18 +16,13 @@
|
|||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
lumiera_srcdir = $(top_srcdir)/src/lumiera
|
||||
bin_PROGRAMS += lumiera
|
||||
|
||||
lumiera_CPPFLAGS = $(AM_CPPFLAGS) -DLUMIERA_PLUGIN_PATH="\"$(pkglibdir)\""
|
||||
lumiera_CFLAGS = $(AM_CFLAGS) -std=gnu99 -Wextra -Wall -Werror
|
||||
lumiera_LDADD = liblumiera.a $(LUMIERA_PLUGIN_LIBS) $(NOBUGMT_LUMIERA_LIBS)
|
||||
|
||||
lumiera_SOURCES = \
|
||||
$(lumiera_srcdir)/lumiera.c \
|
||||
$(lumiera_srcdir)/interface.c \
|
||||
$(lumiera_srcdir)/interfaceregistry.c \
|
||||
$(lumiera_srcdir)/plugin.c \
|
||||
$(lumiera_srcdir)/plugin_dynlib.c \
|
||||
noinst_LIBRARIES += liblumieraconfig.a
|
||||
liblumieraconfig_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
liblumieraconfig_a_CFLAGS = $(AM_CFLAGS) -std=gnu99 -Wextra -Wall -Werror
|
||||
|
||||
liblumieraconfig_a_SOURCES = \
|
||||
$(lumiera_srcdir)/config.c \
|
||||
$(lumiera_srcdir)/config_typed.c \
|
||||
$(lumiera_srcdir)/config_wordlist.c \
|
||||
|
|
@ -36,6 +31,36 @@ lumiera_SOURCES = \
|
|||
$(lumiera_srcdir)/config_lookup.c
|
||||
|
||||
|
||||
|
||||
noinst_LIBRARIES += liblumieraplugin.a
|
||||
liblumieraplugin_a_CPPFLAGS = $(AM_CPPFLAGS) -DLUMIERA_PLUGIN_PATH="\"$(pkglibdir)\""
|
||||
liblumieraplugin_a_CFLAGS = $(AM_CFLAGS) -std=gnu99 -Wextra -Wall -Werror
|
||||
|
||||
liblumieraplugin_a_SOURCES = \
|
||||
$(lumiera_srcdir)/interface.c \
|
||||
$(lumiera_srcdir)/interfaceregistry.c \
|
||||
$(lumiera_srcdir)/plugin.c \
|
||||
$(lumiera_srcdir)/plugin_dynlib.c
|
||||
|
||||
|
||||
|
||||
noinst_LIBRARIES += liblumierainit.a
|
||||
liblumierainit_a_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
liblumierainit_a_CFLAGS = $(AM_CFLAGS) -std=gnu99 -Wextra -Wall -Werror
|
||||
|
||||
liblumierainit_a_SOURCES = \
|
||||
$(lumiera_srcdir)/lumiera_init.c
|
||||
|
||||
|
||||
bin_PROGRAMS += lumiera
|
||||
lumiera_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
lumiera_CFLAGS = $(AM_CFLAGS) -std=gnu99 -Wextra -Wall -Werror
|
||||
lumiera_LDADD = liblumierainit.a liblumieraconfig.a liblumieraplugin.a liblumiera.a $(LUMIERA_PLUGIN_LIBS) $(NOBUGMT_LUMIERA_LIBS)
|
||||
|
||||
lumiera_SOURCES = \
|
||||
$(lumiera_srcdir)/lumiera.c
|
||||
|
||||
|
||||
noinst_HEADERS += \
|
||||
$(lumiera_srcdir)/interface.h \
|
||||
$(lumiera_srcdir)/interfaceregistry.h \
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#ifndef LUMIERA_INTERFACEDESCRIPTOR_H
|
||||
#define LUMIERA_INTERFACEDESCRIPTOR_H
|
||||
|
||||
#include "backend/interface.h"
|
||||
#include "lumiera/interface.h"
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -36,25 +36,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
NOBUG_DEFINE_FLAG (all);
|
||||
NOBUG_DEFINE_FLAG_PARENT (lumiera_all, all);
|
||||
NOBUG_DEFINE_FLAG_PARENT (lumiera, lumiera_all);
|
||||
|
||||
|
||||
//code goes here//
|
||||
|
||||
static void
|
||||
lumiera_init (void)
|
||||
{
|
||||
NOBUG_INIT;
|
||||
NOBUG_INIT_FLAG (all);
|
||||
NOBUG_INIT_FLAG (lumiera_all);
|
||||
NOBUG_INIT_FLAG (lumiera);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char** argv)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ NOBUG_DECLARE_FLAG (lumiera);
|
|||
*/
|
||||
|
||||
//TODO: declarations go here//
|
||||
void
|
||||
lumiera_init (void);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
63
src/lumiera/lumiera_init.c
Normal file
63
src/lumiera/lumiera_init.c
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
lumiera_init.c - Lumiera initialization and shutdowen and global state
|
||||
|
||||
Copyright (C) Lumiera.org
|
||||
2008, Christian Thaeter <ct@pipapo.org>
|
||||
|
||||
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; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
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, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
//TODO: Support library includes//
|
||||
|
||||
|
||||
//TODO: Lumiera header includes//
|
||||
#include "lumiera/lumiera.h"
|
||||
|
||||
//TODO: internal/static forward declarations//
|
||||
|
||||
|
||||
//TODO: System includes//
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
*/
|
||||
|
||||
NOBUG_DEFINE_FLAG (all);
|
||||
NOBUG_DEFINE_FLAG_PARENT (lumiera_all, all);
|
||||
NOBUG_DEFINE_FLAG_PARENT (lumiera, lumiera_all);
|
||||
|
||||
|
||||
//code goes here//
|
||||
|
||||
void
|
||||
lumiera_init (void)
|
||||
{
|
||||
NOBUG_INIT;
|
||||
NOBUG_INIT_FLAG (all);
|
||||
NOBUG_INIT_FLAG (lumiera_all);
|
||||
NOBUG_INIT_FLAG (lumiera);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
// Local Variables:
|
||||
// mode: C
|
||||
// c-file-style: "gnu"
|
||||
// indent-tabs-mode: nil
|
||||
// End:
|
||||
*/
|
||||
|
|
@ -58,21 +58,24 @@ test_filehandles_SOURCES = $(tests_srcdir)/backend/test-filehandles.c
|
|||
test_filehandles_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror
|
||||
test_filehandles_LDADD = liblumibackend.a liblumiera.a $(NOBUGMT_LUMIERA_LIBS)
|
||||
|
||||
|
||||
|
||||
|
||||
check_PROGRAMS += test-config
|
||||
test_config_SOURCES = $(tests_srcdir)/backend/test-config.c
|
||||
test_config_SOURCES = $(tests_srcdir)/lumiera/test-config.c
|
||||
test_config_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -I$(top_srcdir)/src/
|
||||
test_config_LDADD = liblumibackend.a liblumiera.a $(NOBUGMT_LUMIERA_LIBS)
|
||||
test_config_LDADD = liblumieraconfig.a liblumierainit.a liblumiera.a $(NOBUGMT_LUMIERA_LIBS)
|
||||
|
||||
check_LTLIBRARIES += examplepluginc.la
|
||||
examplepluginc_la_SOURCES = $(tests_srcdir)/backend/example_plugin.c
|
||||
examplepluginc_la_SOURCES = $(tests_srcdir)/lumiera/example_plugin.c
|
||||
examplepluginc_la_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -DLUMIERA_PLUGIN -I$(top_srcdir)/src/
|
||||
examplepluginc_la_LDFLAGS = -module -avoid-version -no-undefined -rpath /dev/null
|
||||
|
||||
check_PROGRAMS += test-interfaces
|
||||
test_interfaces_SOURCES = $(tests_srcdir)/backend/test-interfaces.c
|
||||
test_interfaces_SOURCES = $(tests_srcdir)/lumiera/test-interfaces.c
|
||||
test_interfaces_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror
|
||||
test_interfaces_LDADD = liblumibackend.a liblumiera.a $(LUMIERA_PLUGIN_LIBS) $(NOBUGMT_LUMIERA_LIBS)
|
||||
test_interfaces_DEPENDENCIES = examplepluginc.la liblumibackend.a liblumiera.a
|
||||
test_interfaces_LDADD = liblumieraplugin.a liblumieraconfig.a liblumierainit.a liblumiera.a $(LUMIERA_PLUGIN_LIBS) $(NOBUGMT_LUMIERA_LIBS)
|
||||
test_interfaces_DEPENDENCIES = examplepluginc.la liblumierainit.a liblumieraconfig.a liblumieraplugin.a liblumiera.a
|
||||
|
||||
check_PROGRAMS += test-filemmap
|
||||
test_filemmap_SOURCES = $(tests_srcdir)/backend/test-filemmap.c
|
||||
|
|
|
|||
|
|
@ -1,70 +0,0 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "lib/plugin.h"
|
||||
#include "hello_interface.h"
|
||||
|
||||
LUMIERA_ERROR_DEFINE(FAILURE, "test failure");
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
NOBUG_INIT;
|
||||
|
||||
if (argc < 2)
|
||||
return -1;
|
||||
|
||||
lumiera_init_plugin ();
|
||||
/*
|
||||
we have a plugin 'hello_1' which provides us 2 hello interfaces, one for english and one for german output,
|
||||
open both try them, close them.
|
||||
*/
|
||||
|
||||
TODO("macros, doing casting and typing");
|
||||
|
||||
if( !strcmp(argv[1],"C"))
|
||||
{
|
||||
LUMIERA_INTERFACE_TYPE(hello, 1)* hello_de =
|
||||
(LUMIERA_INTERFACE_TYPE(hello, 1)*) lumiera_interface_open ("example_plugin", "german_1", sizeof(LUMIERA_INTERFACE_TYPE(hello, 1)));
|
||||
|
||||
if (!hello_de) LUMIERA_DIE (FAILURE);
|
||||
|
||||
hello_de->hello();
|
||||
hello_de->goodbye(argv[1]);
|
||||
|
||||
LUMIERA_INTERFACE_TYPE(hello, 1)* hello_en =
|
||||
(LUMIERA_INTERFACE_TYPE(hello, 1)*) lumiera_interface_open ("example_plugin", "english_1", sizeof(LUMIERA_INTERFACE_TYPE(hello, 1)));
|
||||
|
||||
if (!hello_en) LUMIERA_DIE (FAILURE);
|
||||
|
||||
hello_en->hello();
|
||||
hello_en->goodbye(argv[1]);
|
||||
|
||||
lumiera_interface_close (hello_en);
|
||||
lumiera_interface_close (hello_de);
|
||||
}
|
||||
|
||||
if( !strcmp(argv[1],"C++"))
|
||||
{
|
||||
/* same again for a plugin written in C++ */
|
||||
LUMIERA_INTERFACE_TYPE(hello, 1)* hello_de =
|
||||
(LUMIERA_INTERFACE_TYPE(hello, 1)*) lumiera_interface_open ("example_plugin_cpp", "german_1", sizeof(LUMIERA_INTERFACE_TYPE(hello, 1)));
|
||||
|
||||
if (!hello_de) LUMIERA_DIE (FAILURE);
|
||||
|
||||
hello_de->hello();
|
||||
hello_de->goodbye(argv[1]);
|
||||
|
||||
LUMIERA_INTERFACE_TYPE(hello, 1)* hello_en =
|
||||
(LUMIERA_INTERFACE_TYPE(hello, 1)*) lumiera_interface_open ("example_plugin_cpp", "english_1", sizeof(LUMIERA_INTERFACE_TYPE(hello, 1)));
|
||||
|
||||
if (!hello_en) LUMIERA_DIE (FAILURE);
|
||||
|
||||
hello_en->hello();
|
||||
hello_en->goodbye(argv[1]);
|
||||
|
||||
lumiera_interface_close (hello_en);
|
||||
lumiera_interface_close (hello_de);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
1
tests/lumiera/DIR_INFO
Normal file
1
tests/lumiera/DIR_INFO
Normal file
|
|
@ -0,0 +1 @@
|
|||
tests for the main lumiera loader
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "hello_interface.h"
|
||||
#include "backend/interfacedescriptor.h"
|
||||
#include "lumiera/interfacedescriptor.h"
|
||||
|
||||
int myopen(void)
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "backend/interface.h"
|
||||
#include "lumiera/interface.h"
|
||||
|
||||
LUMIERA_INTERFACE_DECLARE (lumieraorg_testhello, 0,
|
||||
LUMIERA_INTERFACE_SLOT (void, hello, (void)),
|
||||
|
|
@ -21,8 +21,8 @@
|
|||
*/
|
||||
#include "lib/safeclib.h"
|
||||
|
||||
#include "backend/config.h"
|
||||
#include "backend/configitem.h"
|
||||
#include "lumiera/config.h"
|
||||
#include "lumiera/configitem.h"
|
||||
|
||||
#include "tests/test.h"
|
||||
|
||||
|
|
@ -19,13 +19,13 @@
|
|||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "backend/interface.h"
|
||||
#include "backend/interfaceregistry.h"
|
||||
#include "backend/interfacedescriptor.h"
|
||||
#include "backend/config.h"
|
||||
#include "lumiera/interface.h"
|
||||
#include "lumiera/interfaceregistry.h"
|
||||
#include "lumiera/interfacedescriptor.h"
|
||||
#include "lumiera/config.h"
|
||||
|
||||
#include "tests/test.h"
|
||||
#include "tests/backend/hello_interface.h"
|
||||
#include "tests/lumiera/hello_interface.h"
|
||||
|
||||
/*
|
||||
define 2 example interfaces
|
||||
Loading…
Reference in a new issue