diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2019-07-25 00:48:45 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2019-07-25 01:43:39 +0530 |
commit | c8824ab317e24317c7d00fb71d49ea57125d4485 (patch) | |
tree | 161aafd887fa697034d7f143c408aa15064a0d4c | |
parent | 676cc0934b75b9f428f86399d70a178aa31500d4 (diff) | |
download | meson-nirbheek/fix-cross-mingw-travis-failure.tar.gz |
tests/122 shared module: More verbose loggingnirbheek/fix-cross-mingw-travis-failure
So we know why the syscalls failed.
-rw-r--r-- | test cases/common/122 shared module/module.c | 16 | ||||
-rw-r--r-- | test cases/common/122 shared module/prog.c | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/test cases/common/122 shared module/module.c b/test cases/common/122 shared module/module.c index 181b760ff..9c8774dd9 100644 --- a/test cases/common/122 shared module/module.c +++ b/test cases/common/122 shared module/module.c @@ -27,6 +27,19 @@ fptr find_any_f (const char *name) { #include <windows.h> #include <tlhelp32.h> +static wchar_t* +win32_get_last_error (void) +{ + wchar_t *msg = NULL; + + FormatMessageW (FORMAT_MESSAGE_ALLOCATE_BUFFER + | FORMAT_MESSAGE_IGNORE_INSERTS + | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, GetLastError (), 0, + (LPWSTR) &msg, 0, NULL); + return msg; +} + /* Unlike Linux and OS X, when a library is loaded, all the symbols aren't * loaded into a single namespace. You must fetch the symbol by iterating over * all loaded modules. Code for finding the function from any of the loaded @@ -38,7 +51,8 @@ fptr find_any_f (const char *name) { snapshot = CreateToolhelp32Snapshot (TH32CS_SNAPMODULE, 0); if (snapshot == (HANDLE) -1) { - printf("Could not get snapshot\n"); + wchar_t *msg = win32_get_last_error (); + printf("Could not get snapshot: %S\n", msg); return 0; } diff --git a/test cases/common/122 shared module/prog.c b/test cases/common/122 shared module/prog.c index 2b638409b..8b56d9377 100644 --- a/test cases/common/122 shared module/prog.c +++ b/test cases/common/122 shared module/prog.c @@ -8,7 +8,7 @@ typedef int (*fptr) (void); #include <windows.h> -wchar_t* +static wchar_t* win32_get_last_error (void) { wchar_t *msg = NULL; |