summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2022-12-27Imported Upstream version 1.1.5upstream/1.1.5cmocka-1.1.5upstreamTizenOpenSource3-1/+101
2022-12-27Imported Upstream version 1.1.3cmocka-1.1.3JinWang An1-29/+40
2022-12-27Imported Upstream version 1.1.2cmocka-1.1.2JinWang An5-8/+408
2017-04-05Fix TAP output and summary.Stas Kobzar1-13/+13
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-09-21tests: Add test_groups test to validate xml outputDavid Schneider2-15/+127
This is for multiple groups in one test to make sure they do not create invalid xml. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2016-02-10cmocka: Add will_return_maybe() for ignoring mock returnsJoseph Ates3-2/+158
As both parameter and function call order checking allow for ignoring cases where they are never invoked, the mock return values are at somewhat of a mismatch in that they must always be returned at least once (even in the case of will_return_always()). Therefore, the ability to set the count to -2 on will_return_count was added with a new macro (will_return_maybe) that indicates that that the value field may never be returned and still allow a successful test. Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2016-02-10tests: Add a group setup assert testAndreas Schneider2-0/+45
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-12-18tests: Add test for call ordering functionalityJoseph Ates3-1/+218
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2015-09-23cmocka: Allow to pass initial data to test casesPawel Szewczyk2-0/+39
Sometimes multiple test cases share the same test function, running it on different data. To pass this data to test functions we must define setup function for each data set. It's not very convienient when there are many states to test. This commit introduce more elegant way to pass data to tests. The initial_state field of CMUnitTest structure can be defined by user. It will be either passed to setup function, which makes any preparation needed, or it will be passed directly to test function when setup func is NULL. Signed-off-by: Pawel Szewczyk <p.szewczyk@samsung.com>
2015-09-14test: update test_segfault_recovery to try multiple faultsJonathon Reinhart1-0/+2
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2015-05-11cmocka: Add subtests for groups using TAP outputEllie Timoney1-2/+3
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2015-03-02cmocka: realloc(ptr, 0) should act as free(ptr)Niels de Vos1-0/+17
Currently, realloc(ptr, 0) does not free the pointer as specified by 'man 3 realloc': The realloc() function changes the size of the memory block pointed to by ptr to size bytes. [...] if size is equal to zero, and ptr is not NULL, then the call is equivalent to free(ptr). [...] This causes a leak of the allocated memory, and tests that use this particular realloc() pattern fail. Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
2015-02-12tests: Use a different regex for segfault on WindowsJakub Hrozek1-6/+14
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
2015-02-12cmocka: Include cmocka_private.h after cmocka.hJakub Hrozek3-3/+3
cmocka_private.h uses WORDSIZE: # if __WORDSIZE == 64 # define __PRI64_PREFIX "l" But on some platforms, like Solaris, cmocka guesses its own WORDSIZE value in cmocka.h. Therefore it's important to include cmocka_private.h after cmocka.h
2015-02-12cmake: Build tests with the static library.Andreas Schneider1-2/+2
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-11tests: Add io.h for open() and close() on Windows.Andreas Schneider1-0/+3
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-11cmake: Do not set gcc flags in VC.Andreas Schneider1-1/+3
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-11tests: Fix test_assert_macros* with Visual Studio.Andreas Schneider2-0/+7
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-11tests: Fix building the tests with Visual Studio.Andreas Schneider2-0/+8
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-11cmake: Fix a typo in the optionsAndreas Schneider1-1/+1
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-10cmake: Turn off deprecated warning for test_cmockery.cAndreas Schneider1-2/+5
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-10tests: Add message output format testsJakub Hrozek1-0/+62
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
2015-02-09cmake: Add ctest script.Andreas Schneider1-0/+74
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-09Add cmockery legacy header.Andreas Schneider2-1/+34
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-09cmocka: Add support for skipping a testJakub Hrozek2-0/+48
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
2015-02-08tests: Add a test for failing group setupJakub Hrozek2-0/+42
Signed-off-by: Jakub Hrozek <jakub.hrozek@posteo.se>
2015-02-08tests: Use new cmocka test runner in our tests and examplesAndreas Schneider8-45/+62
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2015-02-08tests: Add tests for test_malloc() and test_realloc().Andreas Schneider2-0/+72
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2014-04-11tests: Add test_group_fixtures.Andreas Schneider2-0/+49
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
2014-04-10tests: Improve the fixture test.Andreas Schneider1-0/+4
This way we make sure we don't run into an assert if we have more teardown functions than setup functions.
2014-03-03Test should not be run if setup function failsLukas Slebodnik2-1/+88
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>
2014-03-03basic_test should be run with other CMOCKA_TESTSLukas Slebodnik1-1/+2
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2013-12-24tests: Close the fd in test_assert_macros_fail.Andreas Schneider1-3/+7
This is not really necessary but it fixes Coverity. CID #1146810
2013-12-23Revert "tests: Use internal allocation for test_fixtures."Andreas Schneider1-2/+2
This reverts commit eb3613e6b4c7b1d6d3a6593bd20ce8654e6bc5b8.
2013-12-23tests: Add test_basics.Andreas Schneider1-0/+58
2013-12-23tests: Use internal allocation for test_fixtures.Andreas Schneider1-2/+2
2013-12-23tests: Add test_fixtures.Andreas Schneider2-0/+38
2013-12-23tests: Add test_exception_handler_fail.Andreas Schneider2-1/+38
2013-12-23tests: Add test_assert_macros_fail.Andreas Schneider2-1/+42
2013-12-23tests: Add test_assert_macros.Andreas Schneider2-0/+47