From 244271931a782028fd9bc1cdcdb12200f65cf8d9 Mon Sep 17 00:00:00 2001 From: Toby Gray Date: Wed, 16 Jan 2013 02:07:29 +0000 Subject: WinCE: Add support for WinCE (sources) --- tests/stress.c | 4 +++- tests/testlib.c | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/stress.c b/tests/stress.c index c4a92fa..26860a0 100644 --- a/tests/stress.c +++ b/tests/stress.c @@ -18,8 +18,10 @@ */ #include -#include #include +#if !defined(_WIN32_WCE) +#include +#endif #include "libusb.h" diff --git a/tests/testlib.c b/tests/testlib.c index 9e45d31..3a91933 100644 --- a/tests/testlib.c +++ b/tests/testlib.c @@ -23,11 +23,17 @@ #include #include #include +#if !defined(_WIN32_WCE) #include #include #include +#endif -#ifdef _WIN32 +#if defined(_WIN32_WCE) +// No support for selective redirection of STDOUT on WinCE. +#define DISABLE_STDOUT_REDIRECTION +#define STDOUT_FILENO 1 +#elif defined(_WIN32) #include #define dup _dup #define dup2 _dup2 @@ -72,6 +78,7 @@ static void print_usage(int argc, char ** argv) static void cleanup_test_output(libusbx_testlib_ctx * ctx) { +#ifndef DISABLE_STDOUT_REDIRECTION if (ctx->output_file != NULL) { fclose(ctx->output_file); ctx->output_file = NULL; @@ -84,6 +91,7 @@ static void cleanup_test_output(libusbx_testlib_ctx * ctx) close(ctx->null_fd); ctx->null_fd = INVALID_FD; } +#endif } /** @@ -92,6 +100,11 @@ static void cleanup_test_output(libusbx_testlib_ctx * ctx) */ static int setup_test_output(libusbx_testlib_ctx * ctx) { +#ifdef DISABLE_STDOUT_REDIRECTION + ctx->output_fd = STDOUT_FILENO; + ctx->output_file = stdout; + return 0; +#else /* Keep a copy of STDOUT for test output */ ctx->output_fd = dup(STDOUT_FILENO); if (ctx->output_fd < 0) { @@ -122,6 +135,7 @@ static int setup_test_output(libusbx_testlib_ctx * ctx) } } return 0; +#endif } void libusbx_testlib_logf(libusbx_testlib_ctx * ctx, -- cgit v1.2.1