mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[Testing] Gnc-module: Provide checked error messages to replace noted warnings (c-files only)
Much better for expected warnings to be tested for than to have a lead-in message saying that they're really OK. Don't have the test utilities in Scheme yet. Set the phony modules in misc-modules to be libtool modules instead of shared libraries. Aside from being more correct, this ensures that they'll have the same name on Linux and OSX. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21677 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
02071518ee
commit
629e375784
@ -10,18 +10,18 @@ PWD := $(shell pwd)
|
||||
check_LTLIBRARIES=libgncmod_futuremodsys.la libgncmod_incompatdep.la libgncmod_agedver.la
|
||||
|
||||
libgncmod_futuremodsys_la_SOURCES=futuremodsys.c
|
||||
libgncmod_futuremodsys_la_LDFLAGS=-rpath ${PWD} -avoid-version
|
||||
libgncmod_futuremodsys_la_LDFLAGS=-rpath ${PWD} -avoid-version -module
|
||||
libgncmod_futuremodsys_la_LIBADD = \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
libgncmod_incompatdep_la_SOURCES=incompatdep.c
|
||||
libgncmod_incompatdep_la_LDFLAGS=--rpath ${PWD} -avoid-version
|
||||
libgncmod_incompatdep_la_LDFLAGS=--rpath ${PWD} -avoid-version -module
|
||||
libgncmod_incompatdep_la_LIBADD = \
|
||||
../../libgnc-module.la \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
libgncmod_agedver_la_SOURCES=agedver.c
|
||||
libgncmod_agedver_la_LDFLAGS=-rpath ${PWD} -avoid-version
|
||||
libgncmod_agedver_la_LDFLAGS=-rpath ${PWD} -avoid-version -module
|
||||
libgncmod_agedver_la_LIBADD = \
|
||||
$(GLIB_LIBS)
|
||||
|
||||
|
@ -1,15 +1,22 @@
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <libguile.h>
|
||||
|
||||
#include "gnc-module.h"
|
||||
#include <test-stuff.h>
|
||||
|
||||
static void
|
||||
guile_main(void *closure, int argc, char ** argv)
|
||||
{
|
||||
GNCModule foo;
|
||||
|
||||
printf(" test-agedver.c: asking for an old but supported interface ...");
|
||||
gchar *msg = "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
|
||||
gchar *logdomain = "gnc.module";
|
||||
guint loglevel = G_LOG_LEVEL_WARNING;
|
||||
TestErrorStruct check = { loglevel, logdomain, msg };
|
||||
g_log_set_handler (logdomain, loglevel,
|
||||
(GLogFunc)test_checked_handler, &check);
|
||||
g_test_message(" test-agedver.c: asking for an old but supported interface ...");
|
||||
|
||||
gnc_module_system_init();
|
||||
|
||||
|
@ -4,9 +4,11 @@
|
||||
* it via dlsym
|
||||
*********************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <gmodule.h>
|
||||
#include <libguile.h>
|
||||
#include <test-stuff.h>
|
||||
|
||||
#include "gnc-module.h"
|
||||
|
||||
@ -14,8 +16,14 @@ static void
|
||||
guile_main(void *closure, int argc, char ** argv)
|
||||
{
|
||||
GModule *gmodule;
|
||||
gchar *msg = "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
|
||||
gchar *logdomain = "gnc.module";
|
||||
guint loglevel = G_LOG_LEVEL_WARNING;
|
||||
TestErrorStruct check = { loglevel, logdomain, msg };
|
||||
g_log_set_handler (logdomain, loglevel,
|
||||
(GLogFunc)test_checked_handler, &check);
|
||||
|
||||
printf(" test-dynload.c: testing dynamic linking of libgnc-module ...");
|
||||
g_test_message(" test-dynload.c: testing dynamic linking of libgnc-module ...");
|
||||
gmodule = g_module_open("libgnc-module", 0);
|
||||
|
||||
/* Maybe MacOS? */
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <libguile.h>
|
||||
#include <test-stuff.h>
|
||||
|
||||
#include "gnc-module.h"
|
||||
|
||||
@ -8,8 +10,18 @@ static void
|
||||
guile_main(void *closure, int argc, char ** argv)
|
||||
{
|
||||
GNCModule foo;
|
||||
gchar *msg1 = "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
|
||||
gchar *msg2 = "Could not locate module gnucash/incompatdep interface v.0";
|
||||
gchar *logdomain = "gnc.module";
|
||||
guint loglevel = G_LOG_LEVEL_WARNING;
|
||||
TestErrorStruct check1 = { loglevel, logdomain, msg1 };
|
||||
TestErrorStruct check2 = { loglevel, logdomain, msg2 };
|
||||
test_add_error (&check1);
|
||||
test_add_error (&check2);
|
||||
g_log_set_handler (logdomain, loglevel,
|
||||
(GLogFunc)test_list_handler, NULL);
|
||||
|
||||
printf(" test-incompatdep.c: loading a module with bad deps ...\n");
|
||||
g_test_message(" test-incompatdep.c: loading a module with bad deps ...\n");
|
||||
|
||||
gnc_module_system_init();
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <libguile.h>
|
||||
#include <test-stuff.h>
|
||||
|
||||
#include "gnc-module.h"
|
||||
|
||||
@ -9,8 +10,14 @@ static void
|
||||
guile_main(void *closure, int argc, char ** argv)
|
||||
{
|
||||
GNCModule foo;
|
||||
gchar *msg = "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
|
||||
gchar *logdomain = "gnc.module";
|
||||
guint loglevel = G_LOG_LEVEL_WARNING;
|
||||
TestErrorStruct check = { loglevel, logdomain, msg };
|
||||
g_log_set_handler (logdomain, loglevel,
|
||||
(GLogFunc)test_checked_handler, &check);
|
||||
|
||||
printf(" test-load-c.c: testing module load/unload from C ... ");
|
||||
g_test_message(" test-load-c.c: testing module load/unload from C ... ");
|
||||
|
||||
gnc_module_system_init();
|
||||
|
||||
@ -18,16 +25,16 @@ guile_main(void *closure, int argc, char ** argv)
|
||||
|
||||
if (!foo)
|
||||
{
|
||||
printf(" Failed to load foo\n");
|
||||
g_test_message(" Failed to load foo\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (!gnc_module_unload(foo))
|
||||
{
|
||||
printf(" Failed to unload foo\n");
|
||||
g_test_message(" Failed to unload foo\n");
|
||||
exit(-1);
|
||||
}
|
||||
printf(" successful.\n");
|
||||
g_test_message(" successful.\n");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <libguile.h>
|
||||
#include <test-stuff.h>
|
||||
|
||||
#include "gnc-module.h"
|
||||
|
||||
@ -8,8 +10,18 @@ static void
|
||||
guile_main(void *closure, int argc, char ** argv)
|
||||
{
|
||||
GNCModule foo;
|
||||
gchar *msg1 = "Module '../../../src/gnc-module/test/misc-mods/.libs/libgncmod_futuremodsys.so' requires newer module system\n";
|
||||
gchar *msg2 = "Could not locate module gnucash/futuremodsys interface v.0";
|
||||
gchar *logdomain = "gnc.module";
|
||||
guint loglevel = G_LOG_LEVEL_WARNING;
|
||||
TestErrorStruct check1 = { loglevel, logdomain, msg1 };
|
||||
TestErrorStruct check2 = { loglevel, logdomain, msg2 };
|
||||
test_add_error (&check1);
|
||||
test_add_error (&check2);
|
||||
g_log_set_handler (logdomain, loglevel,
|
||||
(GLogFunc)test_list_handler, NULL);
|
||||
|
||||
printf(" test-modsysver.c: checking for a module we shouldn't find ...\n");
|
||||
g_test_message(" test-modsysver.c: checking for a module we shouldn't find ...\n");
|
||||
|
||||
gnc_module_system_init();
|
||||
|
||||
@ -25,6 +37,7 @@ guile_main(void *closure, int argc, char ** argv)
|
||||
printf(" oops! loaded incompatible module\n");
|
||||
exit(-1);
|
||||
}
|
||||
test_error_clear_list ();
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user