aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2019-11-19cmocka: Add new assert macros to compare 2 double given an epsilon.Arnaud Gelas2-0/+41
assert_double_equal and assert_double_not_equal Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-10-22cmake: Create a static cmocka library for testingAndreas Schneider1-1/+1
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-10-16cmake: Make shared lib optionalArnaud Gelas1-6/+10
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-08-22meson: Build and run unit testsDima Krasner1-0/+30
2019-03-28tests: Add tests for skip filterAnderson Toshiyuki Sasaki2-1/+60
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-25tests: Mark state unused in float testAndreas Schneider1-1/+4
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-22include: Add new assert macros to compare 2 floats given an epsilon.Arnaud Gelas2-0/+38
assert_float_equal and assert_float_not_equal
2018-09-27cmake: Update AddCMockaTestAndreas Schneider1-14/+15
2018-09-26tests: Remove left over debug messageAndreas Schneider1-1/+0
2018-09-25cmake: Add -DCMAKE_BUILD_TYPE=UndefinedSanitizerAndreas Schneider1-15/+26
2018-09-11cmake: Fix linking with -fstack-protector* on SolarisAndreas Schneider1-0/+5
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-10cmake: Use modern cmake for buildng the testsAndreas Schneider1-6/+1
2018-08-29cmake: Don't use CMAKE_SOURCE_DIRAndreas Schneider1-1/+1
2018-08-23cmake: Also handle Illegal instructionAndreas Schneider1-1/+1
This is raised on a -O3 build.
2018-08-22cmake: Add new CompilerCheck.cmakeAndreas Schneider1-0/+2
2018-07-06cmake: Add better comment for ctest default variablesAndreas Schneider1-1/+4
2018-07-06cmake: Add new ctest scriptAndreas Schneider1-0/+226
2018-06-21tests: Give each test a different nameAndreas Schneider1-3/+18
2018-06-11tests: Add a test to check if wildcards are workingAndreas Schneider2-1/+55
2018-06-11cmocka: Add c_strmatch() functionAndreas Schneider2-0/+100
2017-08-11cmocka: Print the error message of a fixture if it failsAndreas Schneider1-2/+2
This adds error information to the output.
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>