16 Commits
Author SHA1 Message Date
Chris Dickens f2e551a5ff build: Prepare config.h for inclusion in examples/tests
There are certain games played in the examples and tests source to
account for differences in build environments and target platforms. This
can be simplified by including config.h and using the definitions there.

To that end, move the printf function attribute definition from
libusbi.h to config.h and leverage it where it is used in the examples
and tests.

Signed-off-by: Chris Dickens <[email protected]>
2020-11-27 15:22:29 -08:00
Chris Dickens a016a082a8 tests: Refactor testlib to simplify and fix Cygwin build
Signed-off-by: Chris Dickens <[email protected]>
2020-11-07 21:11:33 -08:00
Uri Lublin ab68ed4697 stress: test_get_device_list: change printf format for ssize_t
The type of list_size is ssize_t.
First idea was to use "%zd" printf format specifier.
But that is not supported by Visual Studio 2013.

Use "%ld" + cast list_size to long.

Closes #751

Suggested-by: Chris Dickens <[email protected]>
Signed-off-by: Uri Lublin <[email protected]>
Signed-off-by: Chris Dickens <[email protected]>
2020-08-10 10:51:42 -07:00
Chris Dickens 9a1bc8cafb build: Require C11 to build and clean up autoconfig/automake files
C11 compiler support has been available for many years now. It is not
unreasonable to require this now, and doing so allows some cleanup to
the configure script. It is no longer necessary to check for compiler
support of the '-fvibility' flag because any compiler that supports C11
will support this flag as well.

Fix up the way that compiler and linker flags are passed down to the
various makefiles. The compiler flags should be shared by all, but the
linker flags and libraries should be separated between the library and
the examples/tests. The visibility flag is only relevant for the
library and the thread flags are only relevant for sources using thread
constructs, so provide them as needed.

Rearrange configure.ac to group similar functionality and consolidate
where possible.

Based on these changes, update the Travis configuration file to include
newer versions of test platforms to ensure proper C11 compiler support.

Signed-off-by: Chris Dickens <[email protected]>
2020-03-30 12:28:11 -07:00
Chris Dickens f90d07613c Windows: Remove support for WinCE and Visual Studio older than 2013
There appears to be no need for the WinCE backend anymore, and it is
increasingly difficult to keep healthy as the rest of the library
changes.

Require at least Visual Studio 2013 to compile. This simplifies matters
as there is some semblance of C99 support there.

Signed-off-by: Chris Dickens <[email protected]>
2020-01-20 18:02:19 -08:00
Chris Dickens 539f22e2fd core: Introduce libusb_set_option() API function
This new function allows more flexibility in extending the library to
support more user-configurable options. It is intended to provide a
single API that can support a wide variety of needs and eliminates the
need for new API functions to set future options.

The function is introduced with a single option (LIBUSB_OPTION_LOG_LEVEL)
that replaces the libusb_set_debug() function. Documentation relating to
libusb_set_debug() and the uses of this function in the examples and
tests have been updated accordingly.

Signed-off-by: Chris Dickens <[email protected]>
2017-07-16 14:02:05 -07:00
[email protected] 1eff220474 Misc: Revert all references to libusb/libusb.info 2014-01-08 23:51:01 +00:00
Ludovic Rousseau c4f2c353b9 tests: set output_file to a valid value
If fdopen(3) fails then ctx->output_file is NULL and should not be used
in cleanup_test_output() called next.

Problem detected by the Coverity tool
CID 1042543 (#1 of 1): Dereference after null check (FORWARD_NULL)9.
var_deref_model: Passing "ctx" to function
"cleanup_test_output(libusbx_testlib_ctx *)", which dereferences null
"ctx->output_file".
2013-09-28 12:19:16 +02:00
Toby Gray c632101790 Android: Add examples and stress tests 2013-08-11 22:14:13 +01:00
Pete Batard 196acee784 libusbx 1.0.15-rc1
* Also fix missing header in release tarball
2013-04-02 20:21:48 +01:00
Pete Batard 5ab16a2165 Tests: Suppress Visual Studio 2012 Code Analysis warnings 2013-03-16 23:40:30 +00:00
Pete Batard 0ded9c126e Misc: Simplify includes and misc. cleanup
* fxload sample provenance
* No need for <sys/types.h> in samples as already in libusb.h
* Don't bother about sscanf_s in xusb
* Use HAVE_### and rely on config.h where possible
* Formal inclusion of <winsock.h> in libusb.h for WinCE and WDK
* Cleanup of Windows' config.h
* Avoid ENAMETOOLONG and ENOTEMPTY conflict between errno.h and winsock.h for WinCE
* Additional newlines & braces cleanup
2013-02-27 22:58:49 +00:00
Xiaofan Chen c56f890684 Tests: Fix broken OS-X and Linux builds
* _dup2 is Windows only. Use dup2 instead
* Breakage was introduced in 76eecc6ce1
2013-02-24 23:03:32 +00:00
Pete Batard 76eecc6ce1 Tests: Simplify stdout redirection and fix Windows assertion error on cleanup
* cleanup_test_output() produced an assertion error when compiled with MSVC
  due to closing ctx->output_file
* set ctx->output_file to stdout by default
2013-02-22 00:49:29 +00:00
Toby Gray 244271931a WinCE: Add support for WinCE (sources) 2013-01-23 00:40:18 +00:00
Toby Gray 21cf6e4748 Tests: Add libusbx stress test
See https://github.com/tobygray/libusbx/tree/testing as well
as http://libusbx.1081486.n5.nabble.com/Libusbx-devel-Crashes-tt433.html#a438
2012-11-25 01:32:59 +00:00