Hello community,
here is the log from the commit of package cmocka for openSUSE:Factory checked in at 2019-04-03 09:22:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cmocka (Old)
and /work/SRC/openSUSE:Factory/.cmocka.new.25356 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cmocka"
Wed Apr 3 09:22:59 2019 rev:17 rq:689374 version:1.1.5
Changes:
--------
--- /work/SRC/openSUSE:Factory/cmocka/cmocka.changes 2018-10-02 19:42:45.290116912 +0200
+++ /work/SRC/openSUSE:Factory/.cmocka.new.25356/cmocka.changes 2019-04-03 09:23:05.435677018 +0200
@@ -1,0 +2,10 @@
+Thu Mar 28 13:54:53 UTC 2019 - Andreas Schneider
+
+- Update to version 1.1.5
+ * Added cmocka_set_skip_filter()
+ * cmocka version 1.1.4
+ * Added assert_float(_not)_equal()
+ * Added expect_any_always()
+ * Small bug fixes
+
+-------------------------------------------------------------------
Old:
----
cmocka-1.1.3.tar.xz
cmocka-1.1.3.tar.xz.asc
New:
----
cmocka-1.1.5.tar.xz
cmocka-1.1.5.tar.xz.asc
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ cmocka.spec ++++++
--- /var/tmp/diff_new_pack.itkxpd/_old 2019-04-03 09:23:07.547677978 +0200
+++ /var/tmp/diff_new_pack.itkxpd/_new 2019-04-03 09:23:07.571677989 +0200
@@ -1,7 +1,7 @@
#
# spec file for package cmocka
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,7 +24,7 @@
%endif
Name: cmocka
-Version: 1.1.3
+Version: 1.1.5
Release: 0
Summary: Lightweight library to simplify and generalize unit tests for C
License: Apache-2.0
++++++ cmocka-1.1.3.tar.xz -> cmocka-1.1.5.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/.gitlab-ci.yml new/cmocka-1.1.5/.gitlab-ci.yml
--- old/cmocka-1.1.3/.gitlab-ci.yml 2018-09-27 14:45:25.000000000 +0200
+++ new/cmocka-1.1.5/.gitlab-ci.yml 2019-02-19 16:13:00.000000000 +0100
@@ -60,6 +60,24 @@
paths:
- obj/
+fedora/memory-sanitizer:
+ image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
+ script:
+ - mkdir -p obj && cd obj && cmake
+ -DCMAKE_BUILD_TYPE=MemorySanitizer
+ -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
+ -DUNIT_TESTING=ON ..
+ && make -j$(nproc) && ctest --output-on-failure
+ tags:
+ - shared
+ except:
+ - tags
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj/
+
fedora/undefined-sanitizer:
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
script:
@@ -77,6 +95,37 @@
paths:
- obj/
+fedora/csbuild:
+ image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
+ script:
+ - |
+ if [[ -z "$CI_COMMIT_BEFORE_SHA" ]]; then
+ export CI_COMMIT_BEFORE_SHA=$(git rev-parse "${CI_COMMIT_SHA}~20")
+ fi
+
+ # Check if the commit exists in this branch
+ # This is not the case for a force push
+ git branch --contains $CI_COMMIT_BEFORE_SHA 2>/dev/null || export CI_COMMIT_BEFORE_SHA=$(git rev-parse "${CI_COMMIT_SHA}~20")
+
+ export CI_COMMIT_RANGE="$CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA"
+
+ - csbuild
+ --build-dir=obj-csbuild
+ --prep-cmd="cmake -DCMAKE_BUILD_TYPE=Debug -DPICKY_DEVELOPER=ON -DUNIT_TESTING=ON @SRCDIR@"
+ --build-cmd "make clean && make -j$(nproc)"
+ --git-commit-range $CI_COMMIT_RANGE
+ --color
+ --print-current --print-fixed
+ tags:
+ - shared
+ except:
+ - tags
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj-csbuild/
+
freebsd/x86_64:
image:
script:
@@ -148,11 +197,11 @@
- build=$(dpkg-architecture -qDEB_HOST_GNU_TYPE)
- host="${CI_JOB_NAME#*.cross.}"
- mkdir -p obj && cd obj && cmake
- -DCMAKE_C_COMPILER="$(which $host-gcc)"
- -DCMAKE_CXX_COMPILER="$(which $host-g++)"
+ -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-Debian-mips.cmake
-DCMAKE_BUILD_TYPE=RelWithDebInfo
- -DUNIT_TESTING=ON .. && make -j$(nproc)
- - ctest --output-on-failure -j$(nproc)
+ -DUNIT_TESTING=ON .. &&
+ make -j$(nproc) &&
+ ctest --output-on-failure -j$(nproc)
tags:
- shared
except:
@@ -295,3 +344,57 @@
when: on_failure
paths:
- obj/scan
+
+visualstudio/x86_64:
+ script:
+ - $env:VCPKG_DEFAULT_TRIPLET="x64-windows"
+ - mkdir obj
+ - cd obj
+ - cmake
+ -A x64
+ -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_TOOLCHAIN_FILE"
+ -DPICKY_DEVELOPER=ON
+ -DUNIT_TESTING=ON ..
+ - cmake --build .
+ - ctest --output-on-failure
+ tags:
+ - vs2017
+ - windows
+ except:
+ - tags
+ only:
+ - branches@cmocka/cmocka
+ - branches@ansasaki/cmocka
+ - branches@cryptomilk/cmocka
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj/
+
+visualstudio/x86:
+ script:
+ - $env:VCPKG_DEFAULT_TRIPLET="x86-windows"
+ - mkdir obj
+ - cd obj
+ - cmake
+ -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_TOOLCHAIN_FILE"
+ -DPICKY_DEVELOPER=ON
+ -DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
+ -DUNIT_TESTING=ON ..
+ - cmake --build .
+ - ctest --output-on-failure
+ tags:
+ - vs2017
+ - windows
+ except:
+ - tags
+ only:
+ - branches@cmocka/cmocka
+ - branches@ansasaki/cmocka
+ - branches@cryptomilk/cmocka
+ artifacts:
+ expire_in: 1 week
+ when: on_failure
+ paths:
+ - obj/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/5.patch new/cmocka-1.1.5/5.patch
--- old/cmocka-1.1.3/5.patch 1970-01-01 01:00:00.000000000 +0100
+++ new/cmocka-1.1.5/5.patch 2019-02-25 16:24:29.000000000 +0100
@@ -0,0 +1,34 @@
+From addb1927eb979310a01abc65f29a5408a970da11 Mon Sep 17 00:00:00 2001
+From: Richard Bayerle
+Date: Sun, 24 Feb 2019 16:38:05 +0000
+Subject: [PATCH] XML output is JUnit XML, not xUnit XML.
+
+---
+ doc/mainpage.dox | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/doc/mainpage.dox b/doc/mainpage.dox
+index 4c26d96..c378bb1 100644
+--- a/doc/mainpage.dox
++++ b/doc/mainpage.dox
+@@ -33,7 +33,7 @@ The CMocka library provides:
+ - Very well tested
+ - Testing of memory leaks, buffer overflows and underflows.
+ - A set of assert macros.
+- - Several supported output formats (stdout, TAP, xUnit XML, Subunit)
++ - Several supported output formats (stdout, TAP, JUnit XML, Subunit)
+ - License: Apache License 2.0
+
+ @section main-test A cmocka test
+@@ -119,7 +119,7 @@ supported values are:
+ - <tt>STDOUT</tt> for the default standard output printer
+ - <tt>SUBUNIT</tt> for subunit output
+ - <tt>TAP</tt> for Test Anything Protocol (TAP) output
+- - <tt>XML</tt> for xUnit XML format
++ - <tt>XML</tt> for JUnit XML format
+ The case doesn't matter.
+
+ The XML output goes to stderr by default. If the environment variable
+--
+2.18.1
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/CMakeLists.txt new/cmocka-1.1.5/CMakeLists.txt
--- old/cmocka-1.1.3/CMakeLists.txt 2018-09-27 14:45:25.000000000 +0200
+++ new/cmocka-1.1.5/CMakeLists.txt 2019-03-28 13:33:50.000000000 +0100
@@ -15,7 +15,7 @@
include(DefineCompilerFlags)
include(DefinePlatformDefaults)
-project(cmocka VERSION 1.1.3 LANGUAGES C)
+project(cmocka VERSION 1.1.5 LANGUAGES C)
# global needed variables
set(APPLICATION_NAME ${PROJECT_NAME})
@@ -27,7 +27,7 @@
# Increment AGE. Set REVISION to 0
# If the source code was changed, but there were no interface changes:
# Increment REVISION.
-set(LIBRARY_VERSION "0.5.1")
+set(LIBRARY_VERSION "0.7.0")
set(LIBRARY_SOVERSION "0")
# include cmake files
@@ -51,16 +51,18 @@
endif (MINGW)
# check subdirectories
-add_subdirectory(doc)
add_subdirectory(include)
add_subdirectory(src)
+add_subdirectory(doc)
include(AddCMockaTest)
if (UNIT_TESTING)
add_subdirectory(tests)
endif (UNIT_TESTING)
-add_subdirectory(example)
+if (WITH_EXAMPLES)
+ add_subdirectory(example)
+endif ()
# pkg-config file
configure_file(cmocka.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/cmocka.pc)
@@ -74,7 +76,11 @@
)
# cmake config files
-set(CMOCKA_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
+if (WIN32)
+ set(CMOCKA_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX})
+else()
+ set(CMOCKA_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
+endif()
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE INTERNAL "")
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE INTERNAL "")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/ChangeLog new/cmocka-1.1.5/ChangeLog
--- old/cmocka-1.1.3/ChangeLog 2018-09-27 14:45:25.000000000 +0200
+++ new/cmocka-1.1.5/ChangeLog 2019-03-28 13:33:50.000000000 +0100
@@ -1,3 +1,13 @@
+Thu Mar 28 2019 Andreas Schneider
+ * cmocka version 1.1.5
+ * Added cmocka_set_skip_filter()
+
+Thu Mar 28 2019 Andreas Schneider
+ * cmocka version 1.1.4
+ * Added assert_float(_not)_equal()
+ * Added expect_any_always()
+ * Small bug fixes
+
Wed Sep 26 2018 Andreas Schneider
* cmocka version 1.1.3
* Fixed subunit output on failures
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/CompilerChecks.cmake new/cmocka-1.1.5/CompilerChecks.cmake
--- old/cmocka-1.1.3/CompilerChecks.cmake 2018-09-25 10:50:24.000000000 +0200
+++ new/cmocka-1.1.5/CompilerChecks.cmake 2019-02-19 16:12:24.000000000 +0100
@@ -41,6 +41,7 @@
add_c_compiler_flag("-Werror=strict-overflow" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wstrict-overflow=2" SUPPORTED_COMPILER_FLAGS)
add_c_compiler_flag("-Wno-format-zero-length" SUPPORTED_COMPILER_FLAGS)
+ add_c_compiler_flag("-Wmissing-field-initializers" SUPPORTED_COMPILER_FLAGS)
check_c_compiler_flag("-Wformat" REQUIRED_FLAGS_WFORMAT)
if (REQUIRED_FLAGS_WFORMAT)
@@ -51,7 +52,10 @@
add_c_compiler_flag("-Werror=format-security" SUPPORTED_COMPILER_FLAGS)
# Allow zero for a variadic macro argument
- add_c_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments" SUPPORTED_COMPILER_FLAGS)
+ string(TOLOWER "${CMAKE_C_COMPILER_ID}" _C_COMPILER_ID)
+ if ("${_C_COMPILER_ID}" STREQUAL "clang")
+ add_c_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments" SUPPORTED_COMPILER_FLAGS)
+ endif()
add_c_compiler_flag("-fno-common" SUPPORTED_COMPILER_FLAGS)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/ConfigureChecks.cmake new/cmocka-1.1.5/ConfigureChecks.cmake
--- old/cmocka-1.1.3/ConfigureChecks.cmake 2018-09-11 16:43:16.000000000 +0200
+++ new/cmocka-1.1.5/ConfigureChecks.cmake 2019-03-28 13:26:56.000000000 +0100
@@ -100,7 +100,7 @@
endif (WIN32)
find_library(RT_LIBRARY rt)
-if (RT_LIBRARY AND NOT LINUX)
+if (RT_LIBRARY AND NOT LINUX AND NOT ANDROID)
set(CMOCKA_REQUIRED_LIBRARIES ${RT_LIBRARY} CACHE INTERNAL "cmocka required system libraries")
endif ()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/DefineOptions.cmake new/cmocka-1.1.5/DefineOptions.cmake
--- old/cmocka-1.1.3/DefineOptions.cmake 2018-09-27 14:45:25.000000000 +0200
+++ new/cmocka-1.1.5/DefineOptions.cmake 2019-02-19 16:13:00.000000000 +0100
@@ -1,5 +1,6 @@
option(WITH_STATIC_LIB "Build with a static library" OFF)
option(WITH_CMOCKERY_SUPPORT "Install a cmockery header" OFF)
+option(WITH_EXAMPLES "Build examples" ON)
option(UNIT_TESTING "Build with unit testing" OFF)
option(PICKY_DEVELOPER "Build with picky developer flags" OFF)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/cmake/Modules/DefineCMakeDefaults.cmake new/cmocka-1.1.5/cmake/Modules/DefineCMakeDefaults.cmake
--- old/cmocka-1.1.3/cmake/Modules/DefineCMakeDefaults.cmake 2018-09-11 11:04:00.000000000 +0200
+++ new/cmocka-1.1.5/cmake/Modules/DefineCMakeDefaults.cmake 2019-03-28 13:26:56.000000000 +0100
@@ -16,3 +16,10 @@
# Create the compile command database for clang by default
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+# Always build with -fPIC
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+
+# Avoid source tree pollution
+set(CMAKE_DISABLE_SOURCE_CHANGES ON)
+set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/cmake/Modules/DefineCompilerFlags.cmake new/cmocka-1.1.5/cmake/Modules/DefineCompilerFlags.cmake
--- old/cmocka-1.1.3/cmake/Modules/DefineCompilerFlags.cmake 2018-09-25 13:04:02.000000000 +0200
+++ new/cmocka-1.1.5/cmake/Modules/DefineCompilerFlags.cmake 2019-02-19 16:13:00.000000000 +0100
@@ -23,6 +23,18 @@
set(CMAKE_EXEC_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address"
CACHE STRING "Flags used by the linker during ADDRESSSANITIZER builds.")
+ # Activate with: -DCMAKE_BUILD_TYPE=MemorySanitizer
+ set(CMAKE_C_FLAGS_MEMORYSANITIZER "-g -O2 -fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer"
+ CACHE STRING "Flags used by the C compiler during MEMORYSANITIZER builds.")
+ set(CMAKE_CXX_FLAGS_MEMORYSANITIZER "-g -O2 -fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer"
+ CACHE STRING "Flags used by the CXX compiler during MEMORYSANITIZER builds.")
+ set(CMAKE_SHARED_LINKER_FLAGS_MEMORYSANITIZER "-fsanitize=memory"
+ CACHE STRING "Flags used by the linker during the creation of shared libraries during MEMORYSANITIZER builds.")
+ set(CMAKE_MODULE_LINKER_FLAGS_MEMORYSANITIZER "-fsanitize=memory"
+ CACHE STRING "Flags used by the linker during the creation of shared libraries during MEMORYSANITIZER builds.")
+ set(CMAKE_EXEC_LINKER_FLAGS_MEMORYSANITIZER "-fsanitize=memory"
+ CACHE STRING "Flags used by the linker during MEMORYSANITIZER builds.")
+
# Activate with: -DCMAKE_BUILD_TYPE=UndefinedSanitizer
set(CMAKE_C_FLAGS_UNDEFINEDSANITIZER "-g -O1 -fsanitize=undefined -fsanitize=null -fsanitize=alignment -fno-sanitize-recover"
CACHE STRING "Flags used by the C compiler during UNDEFINEDSANITIZER builds.")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/cmake/Toolchain-Debian-mips.cmake new/cmocka-1.1.5/cmake/Toolchain-Debian-mips.cmake
--- old/cmocka-1.1.3/cmake/Toolchain-Debian-mips.cmake 1970-01-01 01:00:00.000000000 +0100
+++ new/cmocka-1.1.5/cmake/Toolchain-Debian-mips.cmake 2018-09-27 21:24:05.000000000 +0200
@@ -0,0 +1,21 @@
+include(CMakeForceCompiler)
+
+set(TOOLCHAIN_PREFIX mips-linux-gnu)
+
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_VERSION 1)
+set(CMAKE_SYSTEM_PROCESSOR mips)
+
+# This is the location of the mips toolchain
+set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
+set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
+
+# This is the file system root of the target
+set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
+
+# Search for programs in the build host directories
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+
+# For libraries and headers in the target directories
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/coverity/coverity_assert_model.c new/cmocka-1.1.5/coverity/coverity_assert_model.c
--- old/cmocka-1.1.3/coverity/coverity_assert_model.c 2014-04-14 21:37:54.000000000 +0200
+++ new/cmocka-1.1.5/coverity/coverity_assert_model.c 2019-02-19 16:11:47.000000000 +0100
@@ -1,24 +1,31 @@
#define LargestIntegralType unsigned long long
+
void _assert_true(const LargestIntegralType result,
const char* const expression,
const char * const file, const int line)
{
- __coverity_panic__();
+ if (!result) {
+ __coverity_panic__();
+ }
}
void _assert_int_equal(
const LargestIntegralType a, const LargestIntegralType b,
const char * const file, const int line)
{
- __coverity_panic__();
+ if (a != b) {
+ __coverity_panic__();
+ }
}
void _assert_int_not_equal(
const LargestIntegralType a, const LargestIntegralType b,
const char * const file, const int line)
{
- __coverity_panic__();
+ if (a == b) {
+ __coverity_panic__();
+ }
}
void _assert_return_code(const LargestIntegralType result,
@@ -28,60 +35,122 @@
const char * const file,
const int line)
{
- __coverity_panic__();
+ if (result != 0) {
+ __coverity_panic__();
+ }
}
void _assert_string_equal(const char * const a, const char * const b,
const char * const file, const int line)
{
- __coverity_panic__();
+ char ch;
+ int cmp;
+
+ __coverity_weak_guard_sink__(a, b);
+ __coverity_weak_guard_sink__(b, a);
+
+ ch = *((char *)a);
+ ch = *((char *)b);
+
+ if (cmp != 0) {
+ __coverity_panic__();
+ }
}
void _assert_string_not_equal(const char * const a, const char * const b,
const char *file, const int line)
{
- __coverity_panic__();
+ char ch;
+ int cmp;
+
+ __coverity_weak_guard_sink__(a, b);
+ __coverity_weak_guard_sink__(b, a);
+
+ ch = *((char *)a);
+ ch = *((char *)b);
+
+ if (cmp == 0) {
+ __coverity_panic__();
+ }
}
void _assert_memory_equal(const void * const a, const void * const b,
const size_t size, const char* const file,
const int line)
{
- __coverity_panic__();
+ unsigned char ch;
+ int cmp;
+
+ __coverity_weak_guard_sink__(a, b);
+ __coverity_weak_guard_sink__(b, a);
+
+ ch = *((unsigned char *)a);
+ ch = *((unsigned char *)b);
+
+ if (cmp != 0) {
+ __coverity_panic__();
+ }
}
void _assert_memory_not_equal(const void * const a, const void * const b,
const size_t size, const char* const file,
const int line)
{
- __coverity_panic__();
+ unsigned char ch;
+ int cmp;
+
+ __coverity_weak_guard_sink__(a, b);
+ __coverity_weak_guard_sink__(b, a);
+
+ ch = *((unsigned char *)a);
+ ch = *((unsigned char *)b);
+
+ if (cmp == 0) {
+ __coverity_panic__();
+ }
}
void _assert_in_range(
const LargestIntegralType value, const LargestIntegralType minimum,
const LargestIntegralType maximum, const char* const file, const int line)
{
- __coverity_panic__();
+ if (value < minimum || value > maximum) {
+ __coverity_panic__();
+ }
}
void _assert_not_in_range(
const LargestIntegralType value, const LargestIntegralType minimum,
const LargestIntegralType maximum, const char* const file, const int line)
{
- __coverity_panic__();
+ if (value > minimum && value < maximum) {
+ __coverity_panic__();
+ }
}
void _assert_in_set(
const LargestIntegralType value, const LargestIntegralType values[],
const size_t number_of_values, const char* const file, const int line)
{
- __coverity_panic__();
+ size_t i;
+
+ for (i = 0; i < number_of_values; i++) {
+ if (value == values[i]) {
+ return;
+ }
+ }
+ __coverity_panic__();
}
void _assert_not_in_set(
const LargestIntegralType value, const LargestIntegralType values[],
const size_t number_of_values, const char* const file, const int line)
{
- __coverity_panic__();
-}
+ size_t i;
+ for (i = 0; i < number_of_values; i++) {
+ if (value == values[i]) {
+ __coverity_panic__();
+ }
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/doc/CMakeLists.txt new/cmocka-1.1.5/doc/CMakeLists.txt
--- old/cmocka-1.1.3/doc/CMakeLists.txt 2018-09-11 11:04:00.000000000 +0200
+++ new/cmocka-1.1.5/doc/CMakeLists.txt 2018-11-07 08:24:06.000000000 +0100
@@ -38,7 +38,7 @@
doxygen_add_docs(docs
${cmocka-library_SOURCE_DIR}
- ${cmocka-headers_SOURCE_DIR}
+ ${cmocka-header_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR})
endif(DOXYGEN_FOUND)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/doc/mainpage.dox new/cmocka-1.1.5/doc/mainpage.dox
--- old/cmocka-1.1.3/doc/mainpage.dox 2018-08-29 16:58:45.000000000 +0200
+++ new/cmocka-1.1.5/doc/mainpage.dox 2019-03-27 15:46:08.000000000 +0100
@@ -33,7 +33,7 @@
- Very well tested
- Testing of memory leaks, buffer overflows and underflows.
- A set of assert macros.
- - Several supported output formats (stdout, TAP, xUnit XML, Subunit)
+ - Several supported output formats (stdout, TAP, JUnit XML, Subunit)
- License: Apache License 2.0
@section main-test A cmocka test
@@ -119,7 +119,7 @@
- <tt>STDOUT</tt> for the default standard output printer
- <tt>SUBUNIT</tt> for subunit output
- <tt>TAP</tt> for Test Anything Protocol (TAP) output
- - <tt>XML</tt> for xUnit XML format
+ - <tt>XML</tt> for JUnit XML format
The case doesn't matter.
The XML output goes to stderr by default. If the environment variable
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/example/mock/uptime/test_uptime.c new/cmocka-1.1.5/example/mock/uptime/test_uptime.c
--- old/cmocka-1.1.3/example/mock/uptime/test_uptime.c 2018-09-27 14:45:25.000000000 +0200
+++ new/cmocka-1.1.5/example/mock/uptime/test_uptime.c 2019-02-19 16:11:47.000000000 +0100
@@ -16,6 +16,7 @@
#include
#include
+#include
#include
#include
@@ -166,6 +167,8 @@
uptime_str = calc_uptime();
assert_null(uptime_str);
+
+ free(uptime_str);
}
int main(void)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/example/simple_test.c new/cmocka-1.1.5/example/simple_test.c
--- old/cmocka-1.1.3/example/simple_test.c 2018-09-27 08:35:11.000000000 +0200
+++ new/cmocka-1.1.5/example/simple_test.c 2019-02-19 16:13:07.000000000 +0100
@@ -1,6 +1,7 @@
#include
#include
#include
+#include
#include
/* A test case that does nothing and succeeds. */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/include/cmocka.h new/cmocka-1.1.5/include/cmocka.h
--- old/cmocka-1.1.3/include/cmocka.h 2018-09-06 08:15:11.000000000 +0200
+++ new/cmocka-1.1.5/include/cmocka.h 2019-03-28 13:33:50.000000000 +0100
@@ -41,12 +41,13 @@
/**
* @defgroup cmocka The CMocka API
*
- * These headers or their equivalents should be included prior to including
+ * These headers or their equivalents MUST be included prior to including
* this header file.
* @code
* #include
* #include
* #include
+ * #include
* @endcode
*
* This allows test applications to use custom definitions of C standard
@@ -106,6 +107,10 @@
# endif /* _WIN32 */
#endif /* LargestIntegralTypePrintfFormat */
+#ifndef FloatPrintfFormat
+# define FloatPrintfFormat "%f"
+#endif /* FloatPrintfFormat */
+
/* Perform an unsigned cast to LargestIntegralType. */
#define cast_to_largest_integral_type(value) \
((LargestIntegralType)(value))
@@ -116,7 +121,7 @@
/* WIN32 is an ILP32 platform */
typedef unsigned int uintptr_t;
# elif defined(_WIN64)
- typedef unsigned long int uintptr_t
+ typedef unsigned long int uintptr_t;
# else /* _WIN32 */
/* ILP32 and LP64 platforms */
@@ -208,8 +213,8 @@
* }
* @endcode
*
- * For a complete example please at a look
- * <a href="http://git.cryptomilk.org/projects/cmocka.git/tree/example/chef_wrap/waiter_test_wrap.c">here</a>.
+ * For a complete example please take a look
+ * <a href="https://git.cryptomilk.org/projects/cmocka.git/tree/example/mock">here</a>.
*
* @{
*/
@@ -425,8 +430,8 @@
* }
* @endcode
*
- * For a complete example please at a look at
- * <a href="http://git.cryptomilk.org/projects/cmocka.git/tree/example/chef_wrap/waiter_test_wrap.c">here</a>
+ * For a complete example please take a look
+ * <a href="https://git.cryptomilk.org/projects/cmocka.git/tree/example/mock">here</a>
*
* @{
*/
@@ -966,6 +971,24 @@
#ifdef DOXYGEN
/**
+ * @brief Add an event to always check if a parameter (of any value) has been passed.
+ *
+ * The event is triggered by calling check_expected() in the mocked function.
+ *
+ * @param[in] #function The function to add the check for.
+ *
+ * @param[in] #parameter The name of the parameter passed to the function.
+ *
+ * @see check_expected().
+ */
+void expect_any_always(#function, #parameter);
+#else
+#define expect_any_always(function, parameter) \
+ expect_any_count(function, parameter, WILL_RETURN_ALWAYS)
+#endif
+
+#ifdef DOXYGEN
+/**
* @brief Add an event to repeatedly check if a parameter (of any value) has
* been passed.
*
@@ -1217,6 +1240,51 @@
#ifdef DOXYGEN
/**
+ * @brief Assert that the two given float are equal given an epsilon.
+ *
+ * The function prints an error message to standard error and terminates the
+ * test by calling fail() if the float are not equal (given an epsilon).
+ *
+ * @param[in] a The first float to compare.
+ *
+ * @param[in] b The float to compare against the first one.
+ *
+ * @param[in] epsilon The epsilon used as margin for float comparison.
+ */
+void assert_float_equal(float a, float b, float epsilon);
+#else
+#define assert_float_equal(a, b, epsilon) \
+ _assert_float_equal((float)a, \
+ (float)b, \
+ (float)epsilon, \
+ __FILE__, __LINE__)
+#endif
+
+#ifdef DOXYGEN
+/**
+ * @brief Assert that the two given float are not equal given an epsilon.
+ *
+ * The function prints an error message to standard error and terminates the
+ * test by calling fail() if the float are not equal (given an epsilon).
+ *
+ * @param[in] a The first float to compare.
+ *
+ * @param[in] b The float to compare against the first one.
+ *
+ * @param[in] epsilon The epsilon used as margin for float comparison.
+ */
+void assert_float_not_equal(float a, float b, float epsilon);
+#else
+#define assert_float_not_equal(a, b, epsilon) \
+ _assert_float_not_equal((float)a, \
+ (float)b, \
+ (float)epsilon, \
+ __FILE__, __LINE__)
+#endif
+
+
+#ifdef DOXYGEN
+/**
* @brief Assert that the two given strings are equal.
*
* The function prints an error message to standard error and terminates the
@@ -2199,6 +2267,12 @@
const char * const expression,
const char * const file,
const int line);
+void _assert_float_equal(const float a, const float n,
+ const float epsilon, const char* const file,
+ const int line);
+void _assert_float_not_equal(const float a, const float n,
+ const float epsilon, const char* const file,
+ const int line);
void _assert_int_equal(
const LargestIntegralType a, const LargestIntegralType b,
const char * const file, const int line);
@@ -2284,7 +2358,7 @@
/**
* @brief Set a pattern to only run the test matching the pattern.
*
- * This allows to filter tests and only run the ones matching the pattern. Thep
+ * This allows to filter tests and only run the ones matching the pattern. The
* pattern can include two wildards. The first is '*', a wildcard that matches
* zero or more characters, or ‘?’, a wildcard that matches exactly one
* character.
@@ -2293,6 +2367,18 @@
*/
void cmocka_set_test_filter(const char *pattern);
+/**
+ * @brief Set a pattern to skip tests matching the pattern.
+ *
+ * This allows to filter tests and skip the ones matching the pattern. The
+ * pattern can include two wildards. The first is '*', a wildcard that matches
+ * zero or more characters, or ‘?’, a wildcard that matches exactly one
+ * character.
+ *
+ * @param[in] pattern The pattern to match, e.g. "test_wurst*"
+ */
+void cmocka_set_skip_filter(const char *pattern);
+
/** @} */
#endif /* CMOCKA_H_ */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/src/CMakeLists.txt new/cmocka-1.1.5/src/CMakeLists.txt
--- old/cmocka-1.1.3/src/CMakeLists.txt 2018-09-27 15:27:59.000000000 +0200
+++ new/cmocka-1.1.5/src/CMakeLists.txt 2019-02-19 16:11:47.000000000 +0100
@@ -78,6 +78,8 @@
${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION
${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION
+ ${CMAKE_INSTALL_BINDIR}
COMPONENT
${PROJECT_NAME})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/src/cmocka.c new/cmocka-1.1.5/src/cmocka.c
--- old/cmocka-1.1.3/src/cmocka.c 2018-09-27 14:45:15.000000000 +0200
+++ new/cmocka-1.1.5/src/cmocka.c 2019-03-28 13:33:50.000000000 +0100
@@ -43,6 +43,7 @@
#include
#include
#include
+#include
/*
* This allows to add a platform specific header file. Some embedded platforms
@@ -312,6 +313,8 @@
static const char *global_test_filter_pattern;
+static const char *global_skip_filter_pattern;
+
#ifndef _WIN32
/* Signals caught by exception_handler(). */
static const int exception_signals[] = {
@@ -567,7 +570,7 @@
remove_always_return_values_from_list(&global_call_ordering_head);
if (check_for_leftover_values_list(&global_call_ordering_head,
- "%s function was expected to be called but was not not.\n")) {
+ "%s function was expected to be called but was not.\n")) {
error_occurred = 1;
}
if (error_occurred) {
@@ -898,7 +901,7 @@
child_node = child_node->next, ++leftover_count) {
const FuncOrderingValue *const o =
(const FuncOrderingValue*) child_node->value;
- cm_print_error(error_message, o->function);
+ cm_print_error(error_message, "%s", o->function);
cm_print_error(SOURCE_LOCATION_FORMAT
": note: remaining item was declared here\n",
o->location.file, o->location.line);
@@ -930,7 +933,7 @@
if (!list_empty(child_list)) {
if (number_of_symbol_names == 1) {
const ListNode *child_node;
- cm_print_error(error_message, value->symbol_name);
+ cm_print_error(error_message, "%s", value->symbol_name);
for (child_node = child_list->next; child_node != child_list;
child_node = child_node->next) {
@@ -1122,6 +1125,62 @@
list_add_value(&global_call_ordering_head, ordering, count);
}
+/* Returns 1 if the specified float values are equal, else returns 0. */
+static int float_compare(const float left,
+ const float right,
+ const float epsilon) {
+ float absLeft;
+ float absRight;
+ float largest;
+ float relDiff;
+
+ float diff = left - right;
+ diff = (diff >= 0.f) ? diff : -diff;
+
+ // Check if the numbers are really close -- needed
+ // when comparing numbers near zero.
+ if (diff <= epsilon) {
+ return 1;
+ }
+
+ absLeft = (left >= 0.f) ? left : -left;
+ absRight = (right >= 0.f) ? right : -right;
+
+ largest = (absRight > absLeft) ? absRight : absLeft;
+ relDiff = largest * FLT_EPSILON;
+
+ if (diff > relDiff) {
+ return 0;
+ }
+ return 1;
+}
+
+/* Returns 1 if the specified float values are equal. If the values are not equal
+ * an error is displayed and 0 is returned. */
+static int float_values_equal_display_error(const float left,
+ const float right,
+ const float epsilon) {
+ const int equal = float_compare(left, right, epsilon);
+ if (!equal) {
+ cm_print_error(FloatPrintfFormat " != "
+ FloatPrintfFormat "\n", left, right);
+ }
+ return equal;
+}
+
+/* Returns 1 if the specified float values are different. If the values are equal
+ * an error is displayed and 0 is returned. */
+static int float_values_not_equal_display_error(const float left,
+ const float right,
+ const float epsilon) {
+ const int not_equal = (float_compare(left, right, epsilon) == 0);
+ if (!not_equal) {
+ cm_print_error(FloatPrintfFormat " == "
+ FloatPrintfFormat "\n", left, right);
+ }
+ return not_equal;
+}
+
/* Returns 1 if the specified values are equal. If the values are not equal
* an error is displayed and 0 is returned. */
static int values_equal_display_error(const LargestIntegralType left,
@@ -1714,6 +1773,26 @@
}
}
+void _assert_float_equal(const float a,
+ const float b,
+ const float epsilon,
+ const char * const file,
+ const int line) {
+ if (!float_values_equal_display_error(a, b, epsilon)) {
+ _fail(file, line);
+ }
+}
+
+void _assert_float_not_equal(const float a,
+ const float b,
+ const float epsilon,
+ const char * const file,
+ const int line) {
+ if (!float_values_not_equal_display_error(a, b, epsilon)) {
+ _fail(file, line);
+ }
+}
+
void _assert_int_equal(
const LargestIntegralType a, const LargestIntegralType b,
const char * const file, const int line) {
@@ -1820,11 +1899,11 @@
return &global_allocated_blocks;
}
-static void *libc_malloc(size_t size)
+static void *libc_calloc(size_t nmemb, size_t size)
{
-#undef malloc
- return malloc(size);
-#define malloc test_malloc
+#undef calloc
+ return calloc(nmemb, size);
+#define calloc test_calloc
}
static void libc_free(void *ptr)
@@ -1864,7 +1943,7 @@
if (cm_error_message == NULL) {
/* CREATE MESSAGE */
- cm_error_message = libc_malloc(len + 1);
+ cm_error_message = libc_calloc(1, len + 1);
if (cm_error_message == NULL) {
/* TODO */
goto end;
@@ -1944,6 +2023,7 @@
}
return ptr;
}
+#define calloc test_calloc
/* Use the real free in this function. */
@@ -2615,6 +2695,11 @@
global_test_filter_pattern = pattern;
}
+void cmocka_set_skip_filter(const char *pattern)
+{
+ global_skip_filter_pattern = pattern;
+}
+
/****************************************************************************
* TIME CALCULATIONS
****************************************************************************/
@@ -2889,7 +2974,7 @@
/* Make sure LargestIntegralType is at least the size of a pointer. */
assert_true(sizeof(LargestIntegralType) >= sizeof(void*));
- cm_tests = (struct CMUnitTestState *)libc_malloc(sizeof(struct CMUnitTestState) * num_tests);
+ cm_tests = libc_calloc(1, sizeof(struct CMUnitTestState) * num_tests);
if (cm_tests == NULL) {
return -1;
}
@@ -2901,10 +2986,18 @@
|| tests[i].setup_func != NULL
|| tests[i].teardown_func != NULL)) {
if (global_test_filter_pattern != NULL) {
- int ok;
+ int match;
+
+ match = c_strmatch(tests[i].name, global_test_filter_pattern);
+ if (!match) {
+ continue;
+ }
+ }
+ if (global_skip_filter_pattern != NULL) {
+ int match;
- ok = c_strmatch(tests[i].name, global_test_filter_pattern);
- if (!ok) {
+ match = c_strmatch(tests[i].name, global_skip_filter_pattern);
+ if (match) {
continue;
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/src/cmocka.def new/cmocka-1.1.5/src/cmocka.def
--- old/cmocka-1.1.3/src/cmocka.def 2018-06-14 12:13:44.000000000 +0200
+++ new/cmocka-1.1.5/src/cmocka.def 2019-03-28 13:33:50.000000000 +0100
@@ -1,5 +1,7 @@
LIBRARY cmocka
EXPORTS
+ _assert_float_equal
+ _assert_float_not_equal
_assert_in_range
_assert_in_set
_assert_int_equal
@@ -41,6 +43,7 @@
cm_print_error
cmocka_set_message_output
cmocka_set_test_filter
+ cmocka_set_skip_filter
global_expect_assert_env
global_expecting_assert
global_last_failed_assert
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/tests/CMakeLists.txt new/cmocka-1.1.5/tests/CMakeLists.txt
--- old/cmocka-1.1.3/tests/CMakeLists.txt 2018-09-27 14:45:25.000000000 +0200
+++ new/cmocka-1.1.5/tests/CMakeLists.txt 2019-03-28 13:33:50.000000000 +0100
@@ -15,6 +15,7 @@
test_fixtures
test_group_fixtures
test_groups
+ test_float_macros
test_assert_macros
test_assert_macros_fail
test_basics
@@ -25,7 +26,9 @@
test_ordering_fail
test_returns
test_returns_fail
- test_wildcard)
+ test_wildcard
+ test_skip_filter
+ )
if (TEST_EXCEPTION_HANDLER)
list(APPEND CMOCKA_TESTS test_exception_handler)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/tests/test_float_macros.c new/cmocka-1.1.5/tests/test_float_macros.c
--- old/cmocka-1.1.3/tests/test_float_macros.c 1970-01-01 01:00:00.000000000 +0100
+++ new/cmocka-1.1.5/tests/test_float_macros.c 2019-02-19 16:13:00.000000000 +0100
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2019 Arnaud Gelas
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* Use the unit test allocators */
+#define UNIT_TESTING 1
+
+#include
+#include
+#include
+#include
+
+/* A test case that does check if float is equal. */
+static void float_test_success(void **state)
+{
+ (void)state; /* unused */
+
+ assert_float_equal(0.5f, 1.f / 2.f, 0.000001f);
+ assert_float_not_equal(0.5, 0.499f, 0.000001f);
+}
+
+int main(void) {
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(float_test_success),
+ };
+
+ return cmocka_run_group_tests(tests, NULL, NULL);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cmocka-1.1.3/tests/test_skip_filter.c new/cmocka-1.1.5/tests/test_skip_filter.c
--- old/cmocka-1.1.3/tests/test_skip_filter.c 1970-01-01 01:00:00.000000000 +0100
+++ new/cmocka-1.1.5/tests/test_skip_filter.c 2019-03-28 13:33:50.000000000 +0100
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2019 by Red Hat, Inc.
+ *
+ * Author: Anderson Toshiyuki Sasaki
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include
+#include
+#include
+#include
+
+static void test_skip1(void **state)
+{
+ (void)state;
+
+ assert_true(1);
+}
+
+static void test_skip2(void **state)
+{
+ (void)state;
+
+ assert_false(1);
+}
+
+static void test_fail(void **state)
+{
+ (void)state;
+
+ assert_false(1);
+}
+
+int main(void) {
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(test_skip1),
+ cmocka_unit_test(test_skip2),
+ cmocka_unit_test(test_fail),
+ };
+
+ cmocka_set_test_filter("test_skip*");
+
+ cmocka_set_skip_filter("test_skip2");
+
+ return cmocka_run_group_tests(tests, NULL, NULL);
+}