Andreas Schneider [Tue, 10 Feb 2015 14:36:13 +0000 (15:36 +0100)]
cmocka: Fix a double free in cmprintf_tap()
CID: #1268622
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Tue, 10 Feb 2015 14:34:23 +0000 (15:34 +0100)]
cmocka: Initialize group_state in _cmocka_run_group_tests()
CID: #1268623
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Tue, 10 Feb 2015 14:05:37 +0000 (15:05 +0100)]
cmake: Turn off deprecated warning for test_cmockery.c
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Tue, 10 Feb 2015 09:59:15 +0000 (10:59 +0100)]
include: Define fix defintion of LargestIntegralType
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Tue, 10 Feb 2015 09:53:32 +0000 (10:53 +0100)]
cmocka: Fix printf integer formats.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Tue, 10 Feb 2015 07:11:30 +0000 (08:11 +0100)]
cmocka: Add printf attribute checking for vcm_print_error()
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Mon, 9 Feb 2015 12:39:57 +0000 (13:39 +0100)]
cmocka: Check if 'struct timespec' is available.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Mon, 9 Feb 2015 13:42:34 +0000 (14:42 +0100)]
cmocka: Only handle SIGBUS and SIGSYS if the system supports it.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Tue, 10 Feb 2015 07:07:16 +0000 (08:07 +0100)]
cmocka: Fix length calculation.
CID: #1268624
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
SQ
Andreas Schneider [Tue, 10 Feb 2015 07:23:25 +0000 (08:23 +0100)]
cmocka: Allow include of cmocka_platform.h
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Jakub Hrozek [Mon, 9 Feb 2015 22:44:59 +0000 (23:44 +0100)]
tests: Add message output format tests
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Jakub Hrozek [Tue, 10 Feb 2015 10:12:00 +0000 (11:12 +0100)]
cmocka: Add a newline to subunit error output
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Jakub Hrozek [Tue, 10 Feb 2015 12:03:03 +0000 (13:03 +0100)]
cmocka: Print test errors directly to make them included in the XML output
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Jakub Hrozek [Mon, 9 Feb 2015 20:52:30 +0000 (21:52 +0100)]
docs: Mark the old test runner functions as deprecated
Marks the old test runner functions as @deprecated in the doxygen config
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Andreas Schneider [Mon, 9 Feb 2015 12:16:07 +0000 (13:16 +0100)]
cmake: Add ctest script.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Sat, 7 Feb 2015 17:14:46 +0000 (18:14 +0100)]
Add cmockery legacy header.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Luis Pabón [Sat, 7 Feb 2015 17:18:12 +0000 (18:18 +0100)]
include: Add Programming by Contract header.
Signed-off-by: Luis Pabón <lpabon@redhat.com>
Jakub Hrozek [Sat, 7 Feb 2015 16:48:06 +0000 (17:48 +0100)]
cmocka: Add support for skipping a test
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Andreas Schneider [Sat, 7 Feb 2015 14:27:29 +0000 (15:27 +0100)]
cmocka: Add Test Anything Protocol message output
This adds support to print test reporting in the Test Anything Protocol.
See http://testanything.org/tap-specification.html
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Jakub Hrozek [Thu, 5 Feb 2015 16:05:56 +0000 (17:05 +0100)]
cmocka: Add support for xunit reports
Pair-Programmed-With: Andreas Schneider <asn@cryptomilk.org>
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Jakub Hrozek [Wed, 4 Feb 2015 17:38:38 +0000 (18:38 +0100)]
cmocka: Add subunit message output type
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Jakub Hrozek [Wed, 4 Feb 2015 17:01:02 +0000 (18:01 +0100)]
cmocka: Add a function to select the message output type
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Jakub Hrozek [Sat, 7 Feb 2015 09:41:46 +0000 (10:41 +0100)]
doc: Update cmocka documentation for new environment variables
Adds documentation for the new XML and subunit output.
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Andreas Schneider [Mon, 15 Sep 2014 07:47:53 +0000 (09:47 +0200)]
doc: Update cmocka documentation for new test runner.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Sun, 14 Sep 2014 18:05:06 +0000 (20:05 +0200)]
cmocka: Mark run_tests as deprecated.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Jakub Hrozek [Wed, 4 Feb 2015 16:48:42 +0000 (17:48 +0100)]
cmocka: Add new message printing formatter for testcases
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Jakub Hrozek [Sat, 7 Feb 2015 14:18:25 +0000 (15:18 +0100)]
tests: Add a test for failing group setup
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Andreas Schneider [Fri, 12 Sep 2014 15:18:57 +0000 (17:18 +0200)]
tests: Use new cmocka test runner in our tests and examples
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Thu, 5 Feb 2015 09:45:30 +0000 (10:45 +0100)]
cmocka: Add support to print errors into a buffer.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Mon, 20 Oct 2014 08:17:03 +0000 (10:17 +0200)]
cmocka: Add correct checks for clock_gettime().
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Fri, 5 Sep 2014 15:02:04 +0000 (17:02 +0200)]
cmocka: Implement a new test runner.
Pair-Programmed-With: Jakub Hrozek <jakub.hrozek@posteo.se>
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Andreas Schneider [Fri, 6 Feb 2015 10:50:41 +0000 (11:50 +0100)]
tests: Add tests for test_malloc() and test_realloc().
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Jakub Hrozek [Sat, 7 Feb 2015 15:27:31 +0000 (16:27 +0100)]
cmocka: Add explicit libc_alloc, realloc, free
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
Andreas Schneider [Fri, 6 Feb 2015 10:50:05 +0000 (11:50 +0100)]
cmocka: Add a test_realloc() function.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Fri, 6 Feb 2015 10:51:22 +0000 (11:51 +0100)]
cmocka: Allow test_free() to deal with NULL pointers.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Thu, 11 Sep 2014 15:19:27 +0000 (17:19 +0200)]
cmocka: Make global variables thread local.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Thu, 11 Sep 2014 15:07:50 +0000 (17:07 +0200)]
cmake: Add configure checks for thread local storage.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Thu, 11 Sep 2014 15:10:56 +0000 (17:10 +0200)]
config: Remove unused options.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Sun, 14 Sep 2014 18:09:27 +0000 (20:09 +0200)]
cmocka: Use ARRAY_SIZE everywhere.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Mon, 20 Oct 2014 08:13:27 +0000 (10:13 +0200)]
config: Fix define for strsignal().
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Tue, 30 Sep 2014 14:32:46 +0000 (16:32 +0200)]
cmocka: Fix setting size_of_set in expect_set().
BUG: https://open.cryptomilk.org/issues/34
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Jakub Hrozek [Tue, 29 Jul 2014 08:22:31 +0000 (10:22 +0200)]
GNU_SOURCE is not a compiler flag
This line in DefineCompilerFlags.cmake always passed:
check_c_compiler_flag("-D_GNU_SOURCE" WITH_GNU_SOURCE)
because -D$string just defined a preprocessor macro, so the compilation
would always succeed.
On UNIX platforms, with GCC or LLVM compilers, we want to always use
GNU_SOURCE.
Andreas Schneider [Thu, 7 Aug 2014 11:29:33 +0000 (13:29 +0200)]
cmake: Use standard cmake variables in CMakeLists.txt.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Emil Velikov [Fri, 25 Jul 2014 13:31:24 +0000 (14:31 +0100)]
cmocka: do not use # with the %p printf modifier
Missed out during while amending commit
61b2b557951(cmocka: use %p to
printf a pointer).
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Emil Velikov [Fri, 25 Jul 2014 13:31:23 +0000 (14:31 +0100)]
cmocka: use ISO C99 PRIu64 over LargestIntegralTypePrintfUnsignedFormat
With commit commit
8642ef21b07(cmocka: introduce
LargestIntegralTypePrintfUnsignedFormat modifier) we introduces this
superfluous macro in order to work around the differences when printing
64bit unsigned integer values.
Rather than reinventing the wheel use the C99's PRIu64 and fall back
locally to their platform/compiler specific counterparts if the
inttypes.h header does not exist.
Thanks to scythe from the #cmocka channel for pointing out.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Emil Velikov [Sat, 19 Jul 2014 17:51:18 +0000 (18:51 +0100)]
cmocka: introduce LargestIntegralTypePrintfUnsignedFormat modifier
The modifier is almost identical to LargestIntegralTypePrintfFormat
in terms that it handles 64bit integer values, but unlike the latter
it prints them as unsigned value.
Behind the scenes it uses %I64u for windows, and %llu otherwise.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Emil Velikov [Sat, 19 Jul 2014 17:51:19 +0000 (18:51 +0100)]
cmocka: use %p to printf a pointer
Allegedly some versions of MSVC do not prefix the address with 0x
whenever %p is used, while gcc (mingw-w64) always do. There is no
clear way around this without providing a custom define, which
currently is an overkill imho, as there is only one use-case.
Silences the following warning when building with mingw-w64
cmocka/src/cmocka.c:1636:25: warning: format ‘%x’ expects argument of
type ‘unsigned int’, but argument 3 has type ‘PVOID’ [-Wformat=]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Michael Adam [Thu, 29 May 2014 14:00:11 +0000 (16:00 +0200)]
cmocka: fix doxygen comment for assert_not_in_range()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Michael Adam [Thu, 29 May 2014 13:57:37 +0000 (15:57 +0200)]
cmocka: fix doxygen comment for assert_in_range()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Michael Adam [Thu, 29 May 2014 13:55:11 +0000 (15:55 +0200)]
cmocka: fix doxygen comment for assert_return_code()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Thu, 22 May 2014 12:40:35 +0000 (14:40 +0200)]
Bump version to 0.4.1.
Andreas Schneider [Thu, 22 May 2014 12:34:11 +0000 (14:34 +0200)]
cmake: Fix cmocka cmake-config files.
Andreas Schneider [Tue, 20 May 2014 09:03:39 +0000 (11:03 +0200)]
doc: Improve documentation for fail_msg().
BUG: https://open.cryptomilk.org/issues/29
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Wed, 16 Apr 2014 13:46:10 +0000 (15:46 +0200)]
cmake: Install cmake config to the correct directory.
Andreas Schneider [Tue, 15 Apr 2014 15:21:30 +0000 (17:21 +0200)]
cmocka: Fix type of number_of_test_states which can be negative.
Sebastian Dröge [Tue, 15 Apr 2014 12:38:07 +0000 (14:38 +0200)]
Correctly report the number of tests without the number of setup/teardown functions included
Reviewed-by: Andreas Schneider <asn@samba.org>
Andreas Schneider [Tue, 15 Apr 2014 14:58:25 +0000 (16:58 +0200)]
cmocka: Add CMOCKA_TEST_ABORT env variable to leave threading apps.
BUG: https://open.cryptomilk.org/issues/26
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Andreas Schneider [Tue, 15 Apr 2014 14:49:07 +0000 (16:49 +0200)]
coverity: Add _assert_return_code model.
Andreas Schneider [Mon, 14 Apr 2014 07:23:23 +0000 (09:23 +0200)]
cmake: Ignore .ycm_extra_conf.pyc.
Andreas Schneider [Fri, 11 Apr 2014 14:49:27 +0000 (16:49 +0200)]
doc: Document the group functions.
Sebastian Dröge [Fri, 7 Feb 2014 16:51:21 +0000 (17:51 +0100)]
include: Fix count parameter of expect_check() macro
It was always using 0, which meant that the values were never
ever used. This commit changes it to 1, which is consistent with
the other macros.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Fri, 11 Apr 2014 13:22:07 +0000 (15:22 +0200)]
Bump version to 0.4.0.
Andreas Schneider [Fri, 11 Apr 2014 13:43:12 +0000 (15:43 +0200)]
cmocka: Define inline if not defined with MSVC.
Andreas Schneider [Fri, 11 Apr 2014 12:44:48 +0000 (14:44 +0200)]
Add YouCompleteMe config.
You should use 'obj' as your build directory.
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Andreas Schneider [Mon, 23 Dec 2013 18:06:11 +0000 (19:06 +0100)]
tests: Add test_group_fixtures.
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Andreas Schneider [Mon, 23 Dec 2013 18:05:14 +0000 (19:05 +0100)]
cmocka: Add support for test groups.
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Andreas Schneider [Thu, 10 Apr 2014 09:28:22 +0000 (11:28 +0200)]
cmake: Update UseDoxygen.cmake.
Andreas Schneider [Thu, 10 Apr 2014 09:23:17 +0000 (11:23 +0200)]
tests: Improve the fixture test.
This way we make sure we don't run into an assert if we have more
teardown functions than setup functions.
Andreas Schneider [Thu, 10 Apr 2014 09:22:16 +0000 (11:22 +0200)]
cmocka: Add a dummy function for setup and teardown.
We need a matching number for setup and teardown functions else we can
run in an assert. So this adds a dummy which doesn't do anything.
Andreas Schneider [Wed, 9 Apr 2014 08:10:57 +0000 (10:10 +0200)]
cmake: Create the compile command database by default.
Andreas Schneider [Wed, 9 Apr 2014 08:10:48 +0000 (10:10 +0200)]
doc: Fix some typos.
Lukas Slebodnik [Wed, 26 Feb 2014 12:45:02 +0000 (13:45 +0100)]
Test should not be run if setup function fails
Assertions are commonly used in setup function. If setup function fail
test should not be executed, because it may result into unexpected behaviour
(crash)
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Lukas Slebodnik [Wed, 26 Feb 2014 12:46:18 +0000 (13:46 +0100)]
basic_test should be run with other CMOCKA_TESTS
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Lukas Slebodnik [Fri, 21 Feb 2014 10:45:27 +0000 (11:45 +0100)]
Use prefix for commonly used macro PRINTF_ATTRIBUTE
It may cause warning:
/usr/include/cmocka.h:50:0: warning: "PRINTF_ATTRIBUTE" redefined
[enabled by default]
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Lukas Slebodnik [Fri, 21 Feb 2014 10:58:03 +0000 (11:58 +0100)]
Enable warning Wundef
It is better to use "#ifdef" for testing macros instead of "#if"
In header file, "#ifdef DOXYGEN" was used 30 times and "#if DOXYGEN"
23 times. This patch makes it consistent and enable warning Wundef to prevent
this kind of issues.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Lukas Slebodnik [Fri, 21 Feb 2014 12:37:46 +0000 (13:37 +0100)]
Use static modifier for temporary_buffer
temporary_buffer is used only in the module calculator_test.c
It's better to use use static modifier explicitly in this case.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Lukas Slebodnik [Fri, 21 Feb 2014 10:22:50 +0000 (11:22 +0100)]
Use better formatting string for printing numbers
Numbers were printed as hexadecimal.n eror message,
It is good practice to print "0x" before hexadecimal numbers,
because it may be confusing without this.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Andreas Schneider [Wed, 22 Jan 2014 14:50:40 +0000 (15:50 +0100)]
cmake: Do not build the chef_wrap example on OSX.
Andreas Schneider [Mon, 20 Jan 2014 22:39:19 +0000 (23:39 +0100)]
cmake: Add cmake config mode support.
Andreas Schneider [Tue, 24 Dec 2013 08:26:42 +0000 (09:26 +0100)]
tests: Close the fd in test_assert_macros_fail.
This is not really necessary but it fixes Coverity.
CID #1146810
Andreas Schneider [Mon, 23 Dec 2013 18:58:34 +0000 (19:58 +0100)]
Revert "tests: Use internal allocation for test_fixtures."
This reverts commit
eb3613e6b4c7b1d6d3a6593bd20ce8654e6bc5b8.
Andreas Schneider [Mon, 23 Dec 2013 15:16:01 +0000 (16:16 +0100)]
cmocka: Fix typo in the docs.
Andreas Schneider [Mon, 23 Dec 2013 15:13:51 +0000 (16:13 +0100)]
cmake: Run examples in 'make test' too.
Andreas Schneider [Mon, 23 Dec 2013 15:12:23 +0000 (16:12 +0100)]
tests: Add test_basics.
Andreas Schneider [Mon, 23 Dec 2013 18:06:07 +0000 (19:06 +0100)]
tests: Use internal allocation for test_fixtures.
Andreas Schneider [Mon, 23 Dec 2013 15:07:46 +0000 (16:07 +0100)]
tests: Add test_fixtures.
Andreas Schneider [Mon, 23 Dec 2013 15:06:04 +0000 (16:06 +0100)]
tests: Add test_exception_handler_fail.
Andreas Schneider [Mon, 23 Dec 2013 15:03:50 +0000 (16:03 +0100)]
tests: Add test_assert_macros_fail.
Andreas Schneider [Mon, 23 Dec 2013 15:00:07 +0000 (16:00 +0100)]
tests: Add test_assert_macros.
Andreas Schneider [Mon, 23 Dec 2013 14:38:00 +0000 (15:38 +0100)]
cmocka: Add assert_return_code().
Andreas Schneider [Sat, 21 Dec 2013 16:22:35 +0000 (17:22 +0100)]
example: Define UNIT_TESTING in run_tests.c.
This makes sure we ue the unit test allocators.
Andreas Schneider [Sat, 21 Dec 2013 16:19:22 +0000 (17:19 +0100)]
cmake: Fix calling the assert_module test.
Andreas Schneider [Thu, 19 Dec 2013 17:00:17 +0000 (18:00 +0100)]
doc: Improve the API mainpage.
Andreas Schneider [Fri, 13 Dec 2013 09:54:53 +0000 (10:54 +0100)]
example: Add the most simple test with cmocka.
Andreas Schneider [Fri, 13 Dec 2013 09:51:04 +0000 (10:51 +0100)]
example: Fix exception handler test on Solaris.
Andreas Schneider [Fri, 13 Dec 2013 09:55:11 +0000 (10:55 +0100)]
Add obj directory for config.h to .clang_complete.
Andreas Schneider [Wed, 11 Dec 2013 17:52:12 +0000 (18:52 +0100)]
example: Add an exampele to test exception handling.
Andreas Schneider [Wed, 11 Dec 2013 17:51:25 +0000 (18:51 +0100)]
cmocka: Print better message for exceptions.
Andreas Schneider [Wed, 11 Dec 2013 17:51:04 +0000 (18:51 +0100)]
config: Add missing define for strsignal().
Andreas Schneider [Thu, 28 Nov 2013 13:10:03 +0000 (14:10 +0100)]
cmake: Fix compilation with -D_FORTIFY_SOURCE.