Age | Commit message (Collapse) | Author | Files | Lines |
|
We need to escape the braces or cmake will break it up.
Fixes #101
|
|
The %x specifier expects an unsigned argument. If char is signed,
cmocka_print_error() may incorrectly display values sign-extended. To
fix this, use an unsigned char and the corresponding format specifier
(%hhx).
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(backported from commit 2206c22515e788f7a43cde2162408081b3e8f6ae)
|
|
Disable `-Wdeclaration-after-statement`.
Before ISO C99, declaring variables after statements was not allowed
by the C standard, but was allowed by GCC as an extension.
CMocka now requires a minimum version of C99,
since commit 5a4b15870efa2225e6586fbb4c3af05ff0659434, so this
behaviour is valid on all compilers.
on-behalf-of: @nqminds <info@nqminds.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit bfdf78c4e6f870977ff8996abecd84ba7086a331)
|
|
Replace characters with their XML string equivalents to allow for them
in the tests and groups names.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 90315882d6de183ab31b66b5008d4ca3d1fea140)
|
|
Return successfuly if there is nothing to replace.
Allow for replacement with superset pattern.
Simplified example without fix:
c_strreplace("ABCD", "A", "AX") -> "AAAAAA...AAAXBCD"
Simplified example with fix:
c_strreplace("ABCD", "A", "AX") -> "AXBCD"
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 54b3af4631e19bdf64ebfc3985c3dd9abf775321)
|
|
Projects using cmocka could have done this successfully from version 1.0 to
1.1.5 to build against cmocka:
```
find_package(cmocka 1.0 REQUIRED CONFIG)
```
and later
```
target_link_libraries(myapp
${CMOCKA_LIBRARIES}
)
```
Modern apps should just "link" against 'cmocka::cmocka' instead like it's done in
examples already. To not break old builds (as it is the case with cmocka
release 1.1.7) we can put that modern target string into the variable
CMOCKA_LIBRARIES and thus trick old projects to just use that, keeping
compatibility until those projects explicitly use the modern version.
Link: https://cmake.org/cmake/help/latest/command/install.html#install-export
Link: https://cmake.org/cmake/help/latest/manual/cmake-packages.7.html#package-configuration-file
Link: https://cmake.org/cmake/help/latest/module/CMakePackageConfigHelpers.html#module:CMakePackageConfigHelpers
Fixes: #87
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit de67675842e549008f3e1aeb03ae7995afa3dd26)
|
|
Makes the implementation behave the same like libc calloc() and not fail with
unpredictable errors in test_malloc() anymore.
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 6ff1378b6f4e82af7bb53868f8526cf8e0a0cf98)
|
|
calloc() is prone to integer overflow on multiplication of its arguments.
glibc, musl, and uclibc test for that in its implementations and return NULL in
that case with errno set to ENOMEM. cmocka lacks such a check and passes all
kinds of overflown values to test_malloc() with different ways to fail.
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit d87c470017e095a01d9e9233f35c0b5254431648)
|
|
|
|
Fixes #86
|
|
|
|
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
|
|
This way compilers should not mark it as unreachable.
|
|
|
|
|
|
This fixes path relocation in mingw environment by using predefined
Libs and Cflags variable in pkgconfig file. Otherwise, libdir and
includedir are not shown in pkgconf output. e.g.
* Without predefined variables:
- pkgconf -cflags cmocka: No output
- pkgconf -libs cmocka: -lcmocka
* With predefined variables:
- pkgconf -cflags cmocka: -IC:/msys64/mingw64/include
- pkgconf -libs cmocka: -LC:/msys64/mingw64/lib -lcmocka
Also official documentation suggests to use predefiend keywords here
https://people.freedesktop.org/~dbn/pkg-config-guide.html
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
|
|
This should fix being imported by other projects.
Fixes #85
|
|
Fixes #63
|
|
Fixes #65
|
|
|
|
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
|
|
Fixes: 400038f6cac9 ("include: Add a group for mock objects.")
Signed-off-by: Alexander Dahl <ada@thorsis.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
|
|
|
|
Fixes #26
(cherry picked from commit fe9663b80e1e505e93522ef75a660bedc32d7775)
|
|
|
|
Will be required in future.
|
|
The documentation is doxygen generated in the meantime!
|
|
Also add basic tests
Fixes #48
|
|
Fixes #51
|
|
Version must be specified in a first line of TAP13 output.
See TAP13 specification -
https://testanything.org/tap-version-13-specification.html
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
|
|
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
|
|
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
|
|
This introduces the CMOCKA_NORETURN macro which adds the
__attribute__((noreturn)) attribute to non-returning functions. In
Windows, __declspec(noreturn) is added instead.
Functions that don't return but are not marked with the attribute can
confuse static analysers, making them to report false positives.
Add CMOCKA_NORETURN attribute to _fail(), _skip(), and to the internal
exception_handler().
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
|
|
Signed-off-by: Sirio Balmelli <sirio@b-ad.ch>
|
|
|
|
According to [1], a skipped test should print "ok" and not "not ok"
before "# SKIP". This breaks tests harnesses like the one built into
Meson [2].
[1] http://testanything.org/tap-specification.html
[2] https://mesonbuild.com/Unit-tests.html
|
|
|
|
Removes a undefined behaviour (uint underflow) happening when freeing a
value. Fortunately this undefined behaviour has no effect on the
program. It only manifests itself when cmocka is compiled using
clangs undefined behaviour sanitizer.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
|
|
|
|
When using cmocka_run_group_tests_name, group_name was not printed; which made
it complicated to know when one failure occurs.
|