--- a/test/logging_tests.c Mon Oct 08 14:04:52 2012 +0200 +++ b/test/logging_tests.c Tue Oct 09 10:21:18 2012 +0200 @@ -3,27 +3,19 @@ */ #include "logging_tests.h" -#ifndef _WIN32 -#include <unistd.h> -#endif /* not _WIN32 */ UCX_TEST_IMPLEMENT(test_ucx_logger_log) { char buffer[100]; -#if defined _USE_GNU || defined _USE_XOPEN2K8 - FILE *stream = fmemopen(buffer, 100, "w"); -#else - FILE *stream = fopen("test_ucx_logger", "w+"); -#endif /* _WIN32 */ + FILE *stream = tmpfile(); + UcxLogger *logger = ucx_logger_new(stream, UCX_LOGGER_INFO); UCX_TEST_BEGIN ucx_logger_info(logger, ST("[INFO:] allright\n")); ucx_logger_trace(logger, ST("[TRACE:] dont log this!\n")); ucx_logger_error(logger, ST("[ERROR:] error!\n")); -#if !(defined _USE_GNU || defined _USE_XOPEN2K8) fseek(stream, 0, SEEK_SET); fread(buffer, 1, 100, stream); -#endif /* _WIN32 */ UCX_TEST_ASSERT(strncmp(buffer, "[INFO:] allright\n[ERROR:] error!\n", 33) == 0, "incorrect logs"); @@ -32,7 +24,4 @@ free(logger); fclose(stream); -#if !(defined _USE_GNU || defined _USE_XOPEN2K8) - unlink("test_ucx_logger"); -#endif }