From f70b69d055544c212348e6cf1c6e0baa8321a3fa Mon Sep 17 00:00:00 2001 From: Marc Schlaich Date: Thu, 11 Dec 2014 10:25:15 +0100 Subject: [PATCH] test: improve compatibility for dlerror test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check uv_dlerror() doesn't return "no_error", in order to make the test less dependent on the exact error message the platform produces when loading a dynamic library fails. PR-URL: https://github.com/libuv/libuv/pull/59 Reviewed-By: Bert Belder Reviewed-By: Saúl Ibarra Corretgé --- test/test-dlerror.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/test/test-dlerror.c b/test/test-dlerror.c index 877ebf37..31f1326f 100644 --- a/test/test-dlerror.c +++ b/test/test-dlerror.c @@ -26,31 +26,22 @@ TEST_IMPL(dlerror) { const char* path = "test/fixtures/load_error.node"; + const char* dlerror_no_error = "no error"; const char* msg; uv_lib_t lib; int r; -#ifdef __linux__ - const char* dlerror_desc = "file too short"; -#elif defined (__sun__) - const char* dlerror_desc = "unknown file type"; -#elif defined (_WIN32) - const char* dlerror_desc = "%1 is not a valid Win32 application"; -#else - const char* dlerror_desc = ""; -#endif - r = uv_dlopen(path, &lib); ASSERT(r == -1); msg = uv_dlerror(&lib); ASSERT(msg != NULL); - ASSERT(strstr(msg, dlerror_desc) != NULL); + ASSERT(strstr(msg, dlerror_no_error) == NULL); /* Should return the same error twice in a row. */ msg = uv_dlerror(&lib); ASSERT(msg != NULL); - ASSERT(strstr(msg, dlerror_desc) != NULL); + ASSERT(strstr(msg, dlerror_no_error) == NULL); uv_dlclose(&lib);