summaryrefslogtreecommitdiff
path: root/testModule.c
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2022-12-06 14:33:32 +0000
committerRoss Burton <ross.burton@arm.com>2022-12-06 17:24:37 +0000
commit21f2ce71127dd5f3c5684b1b12175a744c1c2885 (patch)
treee3588e0eba604c82588a574e7a58759ce4d63d8d /testModule.c
parentb1b0df6e9b19d961fc685d991c8ebb34d38b9955 (diff)
downloadlibxml2-21f2ce71127dd5f3c5684b1b12175a744c1c2885.tar.gz
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.
Diffstat (limited to 'testModule.c')
-rw-r--r--testModule.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/testModule.c b/testModule.c
index 77b7ba10..6d00596f 100644
--- a/testModule.c
+++ b/testModule.c
@@ -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();