diff options
author | Toby Gray <toby.gray@realvnc.com> | 2013-01-16 02:07:29 +0000 |
---|---|---|
committer | Toby Gray <toby.gray@realvnc.com> | 2013-01-23 00:40:18 +0000 |
commit | 244271931a782028fd9bc1cdcdb12200f65cf8d9 (patch) | |
tree | eea17ea7e2e4c8638b26aa5a8984ef1b272a1566 /tests | |
parent | 790ffc78b008a03c95d10899f53997b504f55c72 (diff) | |
download | libusb-244271931a782028fd9bc1cdcdb12200f65cf8d9.tar.gz |
WinCE: Add support for WinCE (sources)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stress.c | 4 | ||||
-rw-r--r-- | tests/testlib.c | 16 |
2 files changed, 18 insertions, 2 deletions
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 <stdio.h> -#include <sys/types.h> #include <memory.h> +#if !defined(_WIN32_WCE) +#include <sys/types.h> +#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 <stdarg.h> #include <string.h> #include <errno.h> +#if !defined(_WIN32_WCE) #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> +#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 <io.h> #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, |