[sgen] Include optimization for arm/arm64 targets
[mono-project.git] / eglib / test / module.c
bloba28363785ff0a8868edab43584f52447245c1b4c
1 #include <config.h>
2 #include <glib.h>
3 #include <gmodule.h>
4 #include <string.h>
5 #include <stdio.h>
6 #ifdef HAVE_UNISTD_H
7 #include <unistd.h>
8 #endif
9 #include "test.h"
11 #if defined (G_OS_WIN32)
12 #define EXTERNAL_SYMBOL "GetProcAddress"
13 #else
14 #define EXTERNAL_SYMBOL "system"
15 #endif
17 void G_MODULE_EXPORT
18 dummy_test_export ()
22 /* test for g_module_open (NULL, ...) */
23 RESULT
24 test_module_symbol_null ()
26 gpointer proc = GINT_TO_POINTER (42);
28 GModule *m = g_module_open (NULL, G_MODULE_BIND_LAZY);
30 if (m == NULL)
31 return FAILED ("bind to main module failed. #0");
33 if (g_module_symbol (m, "__unlikely_\nexistent__", &proc))
34 return FAILED ("non-existent symbol lookup failed. #1");
36 if (proc)
37 return FAILED ("non-existent symbol lookup failed. #2");
39 if (!g_module_symbol (m, EXTERNAL_SYMBOL, &proc))
40 return FAILED ("external lookup failed. #3");
42 if (!proc)
43 return FAILED ("external lookup failed. #4");
45 if (!g_module_symbol (m, "dummy_test_export", &proc))
46 return FAILED ("in-proc lookup failed. #5");
48 if (!proc)
49 return FAILED ("in-proc lookup failed. #6");
51 if (!g_module_close (m))
52 return FAILED ("close failed. #7");
54 return OK;
57 static Test module_tests [] = {
58 {"g_module_symbol_null", test_module_symbol_null},
59 {NULL, NULL}
62 DEFINE_TEST_GROUP_INIT(module_tests_init, module_tests)