testsuite updates
* Makefile.am removed -lm, added $(LUMIERA_PLUGIN_LIBS) * simple test for the plugin loader * remove the old 20plugin.tests, new 31plugin.tests
This commit is contained in:
parent
d5c61c0e9d
commit
038f127946
4 changed files with 97 additions and 35 deletions
|
|
@ -1,24 +0,0 @@
|
|||
TESTING "test plugin example code" ./test-plugin
|
||||
|
||||
PLANNED "C plugin example" C <<END
|
||||
out: opened
|
||||
out: Hallo Welt!
|
||||
out: Tschuess C
|
||||
out: opened
|
||||
out: Hello World!
|
||||
out: Bye C
|
||||
out: closed
|
||||
out: closed
|
||||
END
|
||||
|
||||
PLANNED "C++ plugin example" C++ <<END
|
||||
out: opened
|
||||
out: Hallo Welt!
|
||||
out: Tschuess C++
|
||||
out: opened
|
||||
out: Hello World!
|
||||
out: Bye C++
|
||||
out: closed
|
||||
out: closed
|
||||
END
|
||||
|
||||
29
tests/31plugin.tests
Normal file
29
tests/31plugin.tests
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
TESTING "testing plugins" ./test-interfaces
|
||||
|
||||
|
||||
TEST "discovering plugins, missing path" plugin_discover <<END
|
||||
out: error: LUMIERA_ERROR_CONFIG_NO_ENTRY:no configuration entry
|
||||
return: 0
|
||||
END
|
||||
|
||||
export LUMIERA_PLUGIN_PATH=.libs
|
||||
|
||||
TEST "discovering plugins" plugin_discover <<END
|
||||
out: found plugin: .libs/examplepluginc.so
|
||||
return: 0
|
||||
END
|
||||
|
||||
TEST "plugin unloading" plugin_unload <<END
|
||||
out: plugin unload: (nil)
|
||||
return: 0
|
||||
END
|
||||
|
||||
TEST "C plugin test" plugin_examplepluginc <<END
|
||||
out: Hallo Welt!
|
||||
out: Tschuess Welt!
|
||||
out: Hello World!
|
||||
out: Bye World!
|
||||
return: 0
|
||||
END
|
||||
|
||||
unset LUMIERA_PLUGIN_PATH
|
||||
|
|
@ -26,42 +26,42 @@ test_error_LDADD = liblumiera.a $(NOBUGMT_LUMIERA_LIBS)
|
|||
check_PROGRAMS += test-locking
|
||||
test_locking_SOURCES = $(tests_srcdir)/library/test-locking.c
|
||||
test_locking_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror
|
||||
test_locking_LDADD = liblumiera.a $(NOBUGMT_LUMIERA_LIBS) -lm
|
||||
test_locking_LDADD = liblumiera.a $(NOBUGMT_LUMIERA_LIBS)
|
||||
|
||||
check_PROGRAMS += test-llist
|
||||
test_llist_SOURCES = $(tests_srcdir)/library/test-llist.c
|
||||
test_llist_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror
|
||||
test_llist_LDADD = liblumiera.a $(NOBUGMT_LUMIERA_LIBS) -lm
|
||||
test_llist_LDADD = liblumiera.a $(NOBUGMT_LUMIERA_LIBS)
|
||||
|
||||
check_PROGRAMS += test-psplay
|
||||
test_psplay_SOURCES = $(tests_srcdir)/library/test-psplay.c
|
||||
test_psplay_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -I$(top_srcdir)/src/
|
||||
test_psplay_LDADD = liblumiera.a $(NOBUGMT_LUMIERA_LIBS) -lm
|
||||
test_psplay_LDADD = liblumiera.a $(NOBUGMT_LUMIERA_LIBS)
|
||||
|
||||
check_PROGRAMS += test-safeclib
|
||||
test_safeclib_SOURCES = $(tests_srcdir)/library/test-safeclib.c
|
||||
test_safeclib_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror
|
||||
test_safeclib_LDADD = liblumiera.a $(NOBUGMT_LUMIERA_LIBS) -lm
|
||||
test_safeclib_LDADD = liblumiera.a $(NOBUGMT_LUMIERA_LIBS)
|
||||
|
||||
check_PROGRAMS += test-luid
|
||||
test_luid_SOURCES = $(tests_srcdir)/library/test-luid.c
|
||||
test_luid_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror
|
||||
test_luid_LDADD = liblumiera.a $(NOBUGMT_LUMIERA_LIBS) -lm
|
||||
test_luid_LDADD = liblumiera.a $(NOBUGMT_LUMIERA_LIBS)
|
||||
|
||||
check_PROGRAMS += test-filedescriptors
|
||||
test_filedescriptors_SOURCES = $(tests_srcdir)/backend/test-filedescriptors.c
|
||||
test_filedescriptors_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror
|
||||
test_filedescriptors_LDADD = liblumibackend.a liblumiera.a $(NOBUGMT_LUMIERA_LIBS) -lm
|
||||
test_filedescriptors_LDADD = liblumibackend.a liblumiera.a $(NOBUGMT_LUMIERA_LIBS)
|
||||
|
||||
check_PROGRAMS += test-filehandles
|
||||
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) -lm
|
||||
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_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -I$(top_srcdir)/src/
|
||||
test_config_LDADD = liblumibackend.a liblumiera.a $(NOBUGMT_LUMIERA_LIBS) -lm
|
||||
test_config_LDADD = liblumibackend.a liblumiera.a $(NOBUGMT_LUMIERA_LIBS)
|
||||
|
||||
check_LTLIBRARIES += examplepluginc.la
|
||||
examplepluginc_la_SOURCES = $(tests_srcdir)/backend/example_plugin.c
|
||||
|
|
@ -71,7 +71,7 @@ examplepluginc_la_LDFLAGS = -module -avoid-version -no-undefined -rpath /dev/nul
|
|||
check_PROGRAMS += test-interfaces
|
||||
test_interfaces_SOURCES = $(tests_srcdir)/backend/test-interfaces.c
|
||||
test_interfaces_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror
|
||||
test_interfaces_LDADD = liblumibackend.a liblumiera.a $(NOBUGMT_LUMIERA_LIBS) -lm
|
||||
test_interfaces_LDADD = liblumibackend.a liblumiera.a $(LUMIERA_PLUGIN_LIBS) $(NOBUGMT_LUMIERA_LIBS)
|
||||
test_interfaces_DEPENDENCIES = examplepluginc.la liblumibackend.a liblumiera.a
|
||||
|
||||
TESTS = $(tests_srcdir)/test.sh
|
||||
|
|
|
|||
|
|
@ -22,7 +22,10 @@
|
|||
#include "backend/interface.h"
|
||||
#include "backend/interfaceregistry.h"
|
||||
#include "backend/interfacedescriptor.h"
|
||||
#include "backend/config.h"
|
||||
|
||||
#include "tests/test.h"
|
||||
#include "tests/backend/hello_interface.h"
|
||||
|
||||
/*
|
||||
define 2 example interfaces
|
||||
|
|
@ -452,11 +455,65 @@ TEST ("dependencies_all")
|
|||
}
|
||||
|
||||
|
||||
|
||||
TEST ("highlevel, plugin")
|
||||
TEST ("plugin_discover")
|
||||
{
|
||||
lumiera_config_init ("./");
|
||||
lumiera_interfaceregistry_init ();
|
||||
|
||||
if (lumiera_plugin_discover (lumiera_plugin_load, lumiera_plugin_register))
|
||||
{
|
||||
LumieraPlugin p = lumiera_plugin_lookup (".libs/examplepluginc.so");
|
||||
printf ("found plugin: %s\n", lumiera_plugin_name (p));
|
||||
lumiera_plugin_discover (lumiera_plugin_load, lumiera_plugin_register);
|
||||
}
|
||||
else
|
||||
printf ("error: %s\n", lumiera_error ());
|
||||
|
||||
lumiera_interfaceregistry_destroy ();
|
||||
lumiera_config_destroy ();
|
||||
}
|
||||
|
||||
|
||||
TEST ("plugin_unload")
|
||||
{
|
||||
lumiera_config_init ("./");
|
||||
lumiera_interfaceregistry_init ();
|
||||
|
||||
lumiera_plugin_discover (lumiera_plugin_load, lumiera_plugin_register);
|
||||
lumiera_plugin_unload (lumiera_plugin_lookup (".libs/examplepluginc.so"));
|
||||
LumieraPlugin p = lumiera_plugin_lookup (".libs/examplepluginc.so");
|
||||
printf ("plugin unload: %p\n", p);
|
||||
|
||||
lumiera_interfaceregistry_destroy ();
|
||||
lumiera_config_destroy ();
|
||||
}
|
||||
|
||||
|
||||
TEST ("plugin_examplepluginc")
|
||||
{
|
||||
lumiera_config_init ("./");
|
||||
lumiera_interfaceregistry_init ();
|
||||
lumiera_plugin_discover (lumiera_plugin_load, lumiera_plugin_register);
|
||||
|
||||
TODO ("macro to derrive minminor version from a slot");
|
||||
|
||||
LUMIERA_INTERFACE_HANDLE(lumieraorg_testhello, 0) german =
|
||||
LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_german);
|
||||
|
||||
LUMIERA_INTERFACE_HANDLE(lumieraorg_testhello, 0) english =
|
||||
LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_english);
|
||||
|
||||
german->hello ();
|
||||
german->goodbye ("Welt!");
|
||||
|
||||
english->hello ();
|
||||
english->goodbye ("World!");
|
||||
|
||||
LUMIERA_INTERFACE_CLOSE (german);
|
||||
LUMIERA_INTERFACE_CLOSE (english);
|
||||
|
||||
lumiera_interfaceregistry_destroy ();
|
||||
lumiera_config_destroy ();
|
||||
}
|
||||
|
||||
TESTS_END
|
||||
|
|
|
|||
Loading…
Reference in a new issue