1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

testModule: exit if the module can't be opened

Instead of silently exiting with success when the module cannot be found,
emit a message and fail the test.
This commit is contained in:
Ross Burton 2022-12-06 14:33:32 +00:00
parent b1b0df6e9b
commit 21f2ce7112

View File

@ -49,24 +49,26 @@ int main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
xmlStrPrintf(filename, sizeof(filename),
"%s/testdso%s",
(const xmlChar*)MODULE_PATH,
(const xmlChar*)LIBXML_MODULE_EXTENSION);
(const xmlChar*)LIBXML_MODULE_EXTENSION);
module = xmlModuleOpen((const char*)filename, 0);
if (module)
{
if (xmlModuleSymbol(module, "hello_world", (void **) &hello_world)) {
fprintf(stderr, "Failure to lookup\n");
return(1);
}
if (hello_world == NULL) {
fprintf(stderr, "Lookup returned NULL\n");
return(1);
}
if (module == NULL) {
fprintf(stderr, "Failed to open module\n");
return(1);
}
(*hello_world)();
if (xmlModuleSymbol(module, "hello_world", (void **) &hello_world)) {
fprintf(stderr, "Failure to lookup\n");
return(1);
}
if (hello_world == NULL) {
fprintf(stderr, "Lookup returned NULL\n");
return(1);
}
xmlModuleClose(module);
}
(*hello_world)();
xmlModuleClose(module);
xmlMemoryDump();