test: improve compatibility for dlerror test
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 <bertbelder@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
parent
4272e0a61a
commit
f70b69d055
@ -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);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user