From: Andreas Schneider
Date: Thu, 14 Jun 2012 10:45:59 +0000 (+0200)
Subject: Rename cmokery to cmocka for a fork.
X-Git-Tag: cmocka-1.1.1~329
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=734210f6e75a04d740a3921660cb6d4290e7875b;p=platform%2Fupstream%2Fcmocka.git
Rename cmokery to cmocka for a fork.
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c087424..9667171 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-project(cmockery C)
+project(cmocka C)
# Required cmake version
cmake_minimum_required(VERSION 2.6.0)
diff --git a/CPackConfig.cmake b/CPackConfig.cmake
index bcd367c..5dffb30 100644
--- a/CPackConfig.cmake
+++ b/CPackConfig.cmake
@@ -5,7 +5,7 @@
set(CPACK_PACKAGE_NAME ${APPLICATION_NAME})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The lightweight C unit testing library")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
-set(CPACK_PACKAGE_VENDOR "Google Inc.")
+set(CPACK_PACKAGE_VENDOR "Andreas Schneider")
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
@@ -31,20 +31,20 @@ if (WIN32)
set(CPACK_GENERATOR "${CPACK_GENERATOR};NSIS")
set(CPACK_NSIS_DISPLAY_NAME ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
set(CPACK_NSIS_COMPRESSOR "/SOLID zlib")
- set(CPACK_NSIS_MENU_LINKS "https://code.google.com/p/cmockery/" "cmockery homepage")
+ set(CPACK_NSIS_MENU_LINKS "https://code.google.com/p/cmocka/" "cmocka homepage")
endif (NSIS_MAKE)
endif (WIN32)
-set(CPACK_PACKAGE_INSTALL_DIRECTORY "cmockery")
+set(CPACK_PACKAGE_INSTALL_DIRECTORY "cmocka")
set(CPACK_PACKAGE_FILE_NAME ${APPLICATION_NAME}-${CPACK_PACKAGE_VERSION})
set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "Libraries")
set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C/C++ Headers")
set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION
- "Libraries used to build programs which use cmockery")
+ "Libraries used to build programs which use cmocka")
set(CPACK_COMPONENT_HEADERS_DESCRIPTION
- "C/C++ header files for use with cmockery")
+ "C/C++ header files for use with cmocka")
set(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
#set(CPACK_COMPONENT_APPLICATIONS_GROUP "Runtime")
set(CPACK_COMPONENT_LIBRARIES_GROUP "Development")
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 77333db..798e95f 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -87,7 +87,7 @@ if (WIN32)
check_function_exists(_snprintf_s HAVE__SNPRINTF_S)
endif (WIN32)
-set(CMOCKERY_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "cmockery required system libraries")
+set(CMOCKA_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "cmocka required system libraries")
# OPTIONS
diff --git a/README b/README
index 7593c25..3829dae 100644
--- a/README
+++ b/README
@@ -1,10 +1,14 @@
-For information about how to use the cmockery unit testing framework see
+CMOCKA
+=======
+
+cmocka is a fork for Google's cmockery unit testing framework to fix bugs and
+support it in future.
+See https://code.google.com/p/cmockery/
+
+For information about how to use the cmocka unit testing framework see
doc/index.html.
COMPILING
---------
-To compile the cmockery library and example applications run ./configure
-followed by make. On Windows from the command line run vsvars.bat then cd into
-the windows subdirectory of this project and run nmake.
-
-This code has been tested on Linux (Ubuntu) and Windows using VC++7 and VC++8.
+To compile the cmocka library and example applications run cmake /path/to/source
+followed by make. On Windows you can use the cmake gui.
diff --git a/doc/html2wiki.sh b/doc/html2wiki.sh
deleted file mode 100644
index f962e2e..0000000
--- a/doc/html2wiki.sh
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/bin/bash
-#
-# Translate really simple html to googlecode.com wiki.
-#
-# Usage: cat input.html | html2wiki.sh > outputwiki.txt
-#
-# Most of this script is simple sed substitutions with an awk script to handle
-# hierarchical lists.
-
-# Awk program to escape all instances of * outside of
-awk '
-BEGIN { in_listing = 0; }
-/<[Ll][Ii][Ss][Tt][Ii][Nn][Gg]>/ { in_listing = 1; }
-/<\/[Ll][Ii][Ss][Tt][Ii][Nn][Gg]>/ { in_listing = 0; }
-/.*/ {
- if (in_listing) {
- print $0;
- } else {
- print gensub("*", "`*`", "g", $0)
- }
-}' | \
-# Awk program to convert hierachical unordered and ordered lists into
-# googlecode wiki list markup. This is limited to converting very simple
-# html lists in the form:
-#
-#
-# - item 1
-# ...
-# - item N
-#
-#
-# This script also removes leading spaces from all lines outside of
-# sections.
-awk '
-BEGIN {
- list_type_none = 0;
- list_type_ordered = 1;
- list_type_unordered = 2;
- # Number of nested lists.
- list_depth = 0;
- # Number of items in the list.
- list_items[list_depth] = 0;
- # Type of list.
- list_type[list_depth] = list_type_none;
- # Do nott strip whitespace from listing sections.
- in_listing = 0;
-}
-
-# Generate a string of indent spaces.
-function list_indent(indent) {
- format = sprintf("%%%ds", indent);
- return sprintf(format, "");
-}
-
-/<[Ll][Ii][Ss][Tt][Ii][Nn][Gg]>/ { in_listing = 1; }
-/<\/[Ll][Ii][Ss][Tt][Ii][Nn][Gg]>/ { in_listing = 0; }
-
-# Process all lines non-blank lines.
-/^.*$/ {
- # Remove leading white space.
- if (!in_listing) {
- output_string = gensub(/^ */, "", 1, $0);
- } else {
- output_string = $0;
- }
- search_string = output_string
-
- # Replace list tags with googlecode wiki markup.
- while (match(search_string, /<[^>]*>/, matches)) {
- tag = matches[0];
- search_string = substr(search_string,
- matches[0, "start"] + matches[0, "length"]);
- if (match(tag, /^<[Uu][Ll]>$/)) {
- list_depth++;
- list_type[list_depth] = list_type_unordered;
- list_items[list_depth] = 0;
- output_string = gensub(tag, "", 1, output_string);
- } else if (match(tag, /^[Oo][Ll]>$/)) {
- list_depth++;
- list_type[list_depth] = list_type_ordered;
- list_items[list_depth] = 0;
- output_string = gensub(tag, "", 1, output_string);
- } else if (match(tag, /^<\/[Ll][Ii]>$/)) {
- output_string = gensub(tag, "", 1, output_string);
- } else if (list_depth) {
- if (match(tag, /^<[Ll][Ii]>$/)) {
- if (list_type[list_depth] == list_type_unordered) {
- output_string = gensub(tag, list_indent(list_depth) "* ", 1,
- output_string);
- } else if (list_type[list_depth] == list_type_ordered) {
- output_string = gensub(tag, list_indent(list_depth) "# ", 1,
- output_string);
- }
- } else if (match(tag, /^<\/[Uu][Ll]>$/) ||
- match(tag, /^<\/[Ou][Ll]>$/)) {
- output_string = gensub(tag, "", 1, output_string);
- list_depth --;
- }
- }
- }
- # If a list is being parsed then filter blank lines.
- if (list_depth == 0 || length(output_string)) {
- print output_string
- }
-}
-' | \
-# This sed program translates really simple html into wiki suitable for
-# googlecode.com.
-#
-# Supported tags:
-#
-#
-#
-Cmockery only requires a test application is linked with the standard C
+
cmocka only requires a test application is linked with the standard C
library which minimizes conflicts with standard C library headers. Also,
-Cmockery tries avoid the use of some of the newer features of C compilers.
+cmocka tries avoid the use of some of the newer features of C compilers.
-This results in Cmockery being a relatively small library that can be used
+
This results in cmocka being a relatively small library that can be used
to test a variety of exotic code. If a developer wishes to simply test an
application with the latest compiler then other unit testing frameworks maybe
preferable.
Overview
-Cmockery tests are compiled into stand-alone executables and linked with
-the Cmockery library, the standard C library and module being tested. Any
+
cmocka tests are compiled into stand-alone executables and linked with
+the cmocka library, the standard C library and module being tested. Any
symbols external to the module being tested should be mocked - replaced with
functions that return values determined by the test - within the test
application. Even though significant differences may exist between the target
@@ -59,12 +59,12 @@ with the target execution environment.
It may not be possible to compile a module into a test application without
some modification, therefore the preprocessor symbol UNIT_TESTING should
-be defined when Cmockery unit test applications are compiled so code within the
+be defined when cmocka unit test applications are compiled so code within the
module can be conditionally compiled for tests.
Test Execution
-Cmockery unit test cases are functions with the signature
-void function(void **state). Cmockery test applications initialize a
+
cmocka unit test cases are functions with the signature
+void function(void **state). cmocka test applications initialize a
table with test case function pointers using unit_test*() macros. This
table is then passed to the run_tests() macro to execute the tests.
@@ -79,7 +79,7 @@ the test succeeded.
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
-#include <cmockery.h>
+#include <cmocka.h>
// A test case that does nothing and succeeds.
void null_test_success(void **state) {
@@ -97,7 +97,7 @@ int main(int argc, char* argv[]) {
Before a test function is executed by run_tests(),
exception / signal handlers are overridden with a handler that simply
displays an error and exits a test function if an exception occurs. If an
-exception occurs outside of a test function, for example in Cmockery itself,
+exception occurs outside of a test function, for example in cmocka itself,
the application aborts execution and returns an error code.
Failure Conditions
@@ -105,8 +105,8 @@ the application aborts execution and returns an error code.
run_tests(), the test function is aborted and the application's
execution resumes with the next test function.
-Test failures are ultimately signalled via the Cmockery function fail().
-The following events will result in the Cmockery library signalling a test
+Test failures are ultimately signalled via the cmocka function fail().
+The following events will result in the cmocka library signalling a test
failure...
@@ -123,7 +123,7 @@ failure...
Assertions
Runtime assert macros like the standard C library's assert() should
-be redefined in modules being tested to use Cmockery's mock_assert()
+be redefined in modules being tested to use cmocka's mock_assert()
function. Normally mock_assert() signals a
test failure. If a function is called using
the expect_assert_failure() macro, any calls to mock_assert()
@@ -161,7 +161,7 @@ void decrement_value(int * const value) {
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
-#include <cmockery.h>
+#include <cmocka.h>
extern void increment_value(int * const value);
@@ -194,13 +194,13 @@ int main(int argc, char *argv[]) {
Assert Macros
-Cmockery provides an assortment of assert macros that tests applications
+
cmocka provides an assortment of assert macros that tests applications
should use use in preference to the C standard library's assert macro. On an
-assertion failure a Cmockery assert macro will write the failure to the
+assertion failure a cmocka assert macro will write the failure to the
standard error stream and signal a test failure. Due to limitations of the
-C language the general C standard library assert() and Cmockery's
+C language the general C standard library assert() and cmocka's
assert_true() and assert_false() macros can only display the expression that
-caused the assert failure. Cmockery's type specific assert macros,
+caused the assert failure. cmocka's type specific assert macros,
assert_{type}_equal() and assert_{type}_not_equal(), display the data that
caused the assertion failure which increases data visibility aiding
debugging of failing test cases.
@@ -236,7 +236,7 @@ unsigned int string_to_status_code(const char* const status_code_string) {
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
-#include <cmockery.h>
+#include <cmocka.h>
extern const char* get_status_code_string(const unsigned int status_code);
extern unsigned int string_to_status_code(
@@ -267,20 +267,20 @@ int main(int argc, char *argv[]) {
Dynamic Memory Allocation
To test for memory leaks, buffer overflows and underflows a module being
-tested by Cmockery should replace calls to malloc(), calloc() and
+tested by cmocka should replace calls to malloc(), calloc() and
free() to test_malloc(), test_calloc() and
test_free() respectively. Each time a block is deallocated using
test_free() it is checked for corruption, if a corrupt block is found
a test failure is signalled. All blocks
allocated using the test_*() allocation functions are tracked by the
-Cmockery library. When a test completes if any allocated blocks (memory leaks)
+cmocka library. When a test completes if any allocated blocks (memory leaks)
remain they are reported and a test failure is signalled.
-For simplicity Cmockery currently executes all tests in one process.
+
For simplicity cmocka currently executes all tests in one process.
Therefore all test cases in a test application share a single address space
which means memory corruption from a single test case could potentially cause
the test application to exit prematurely.
-Using Cmockery's Allocators
+Using cmocka's Allocators
allocate_module.c
#include <malloc.h>
@@ -318,7 +318,7 @@ void buffer_underflow() {
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
-#include <cmockery.h>
+#include <cmocka.h>
extern void leak_memory();
extern void buffer_overflow();
@@ -361,7 +361,7 @@ a mock function defined in the unit test.
Return Values
-In order to simplify the implementation of mock functions Cmockery provides
+
In order to simplify the implementation of mock functions cmocka provides
functionality which stores return values for mock functions in each test
case using will_return(). These values are then returned by each mock
function using calls to mock().
@@ -435,7 +435,7 @@ unsigned int get_customer_id_by_name(
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
-#include <cmockery.h>
+#include <cmocka.h>
#include <database.h>
@@ -493,7 +493,7 @@ int main(int argc, char* argv[]) {
Checking Parameters
-In addition to storing the return values of mock functions, Cmockery
+
In addition to storing the return values of mock functions, cmocka
provides functionality to store expected values for mock function parameters
using the expect_*() functions provided. A mock function parameter can then
be validated using the check_expected() macro.
@@ -519,7 +519,7 @@ DatabaseConnection* connect_to_product_database() {
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
-#include <cmockery.h>
+#include <cmocka.h>
#include <database.h>
extern DatabaseConnection* connect_to_product_database();
@@ -571,7 +571,7 @@ int main(int argc, char* argv[]) {
Test State
-
Cmockery allows the specification of multiple setup and tear down functions
+
cmocka allows the specification of multiple setup and tear down functions
for each test case. Setup functions, specified by the unit_test_setup()
or unit_test_setup_teardown() macros allow common initialization to be
shared between multiple test cases. In addition, tear down functions,
@@ -628,7 +628,7 @@ void sort_items_by_key() {
#include <stddef.h>
#include <setjmp.h>
#include <string.h>
-#include <cmockery.h>
+#include <cmocka.h>
/* This is duplicated here from the module setup_teardown.c to reduce the
* number of files used in this test. */
@@ -697,7 +697,7 @@ int main(int argc, char* argv[]) {
calculator.c application
and test application that full exercises the calculator application
calculator_test.c
-are provided as an example of Cmockery's features discussed in this document.
+are provided as an example of cmocka's features discussed in this document.
diff --git a/packages/deb.sh b/packages/deb.sh
deleted file mode 100755
index ced98fa..0000000
--- a/packages/deb.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/bash -e
-
-# This takes one commandline argument, the name of the package. If no
-# name is given, then we'll end up just using the name associated with
-# an arbitrary .tar.gz file in the rootdir. That's fine: there's probably
-# only one.
-#
-# Run this from the 'packages' directory, just under rootdir
-
-## Set LIB to lib if exporting a library, empty-string else
-LIB=
-#LIB=lib
-
-PACKAGE="$1"
-
-# We can only build Debian packages, if the Debian build tools are installed
-if [ \! -x /usr/bin/debuild ]; then
- echo "Cannot find /usr/bin/debuild. Not building Debian packages." 1>&2
- exit 0
-fi
-
-# Double-check we're in the packages directory, just under rootdir
-if [ \! -r ../Makefile -a \! -r ../INSTALL ]; then
- echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2
- echo "Also, you must run \"make dist\" before running this script." 1>&2
- exit 0
-fi
-
-# Find the top directory for this package
-topdir="${PWD%/*}"
-
-# Find the tar archive built by "make dist"
-archive="$(basename "$(ls -1 ${topdir}/$PACKAGE*.tar.gz | tail -n 1)" .tar.gz)"
-if [ -z "${archive}" ]; then
- echo "Cannot find ../$PACKAGE*.tar.gz. Run \"make dist\" first." 1>&2
- exit 0
-fi
-
-# Create a pristine directory for building the Debian package files
-trap 'rm -rf '`pwd`/tmp'; exit $?' EXIT SIGHUP SIGINT SIGTERM
-
-rm -rf tmp
-mkdir -p tmp
-cd tmp
-
-# Debian has very specific requirements about the naming of build
-# directories, and tar archives. It also wants to write all generated
-# packages to the parent of the source directory. We accommodate these
-# requirements by building directly from the tar file.
-ln -s "${topdir}/${archive}.tar.gz" "${LIB}${archive}.orig.tar.gz"
-tar zfx "${LIB}${archive}.orig.tar.gz"
-[ -n "${LIB}" ] && mv "${archive}" "${LIB}${archive}"
-cd "${LIB}${archive}"
-# This is one of those 'specific requirements': where the deb control files live
-ln -s "packages/deb" "debian"
-
-# Now, we can call Debian's standard build tool
-debuild -uc -us
-cd ../.. # get back to the original top-level dir
-
-# We'll put the result in a subdirectory that's named after the OS version
-# we've made this .deb file for.
-destdir="debian-$(cat /etc/debian_version 2>/dev/null || echo UNKNOWN)"
-
-rm -rf "$destdir"
-mkdir -p "$destdir"
-mv $(find tmp -mindepth 1 -maxdepth 1 -type f) "$destdir"
-
-echo
-echo "The Debian package files are located in $PWD/$destdir"
diff --git a/packages/deb/README b/packages/deb/README
deleted file mode 100644
index 57becfd..0000000
--- a/packages/deb/README
+++ /dev/null
@@ -1,7 +0,0 @@
-The list of files here isn't complete. For a step-by-step guide on
-how to set this package up correctly, check out
- http://www.debian.org/doc/maint-guide/
-
-Most of the files that are in this directory are boilerplate.
-However, you may need to change the list of binary-arch dependencies
-in 'rules'.
diff --git a/packages/deb/changelog b/packages/deb/changelog
deleted file mode 100644
index 11544e1..0000000
--- a/packages/deb/changelog
+++ /dev/null
@@ -1,7 +0,0 @@
-cmockery (0.1-2) unstable; urgency=low
- * cmockery: version 0.12
- Made it possible to specify additional compiler, lib tool and link
- flags on Windows.
- Added Windows makefile to the tar ball.
-
- -- Google Inc. Mon, 28 Aug 2008 17:43:20 -0700
diff --git a/packages/deb/compat b/packages/deb/compat
deleted file mode 100644
index b8626c4..0000000
--- a/packages/deb/compat
+++ /dev/null
@@ -1 +0,0 @@
-4
diff --git a/packages/deb/control b/packages/deb/control
deleted file mode 100644
index 3679d0e..0000000
--- a/packages/deb/control
+++ /dev/null
@@ -1,20 +0,0 @@
-Source: cmockery
-Section: libdevel
-Priority: optional
-Maintainer: Google Inc,
-Build-Depends: debhelper (>= 4.0.0), binutils
-Standards-Version: 3.6.1
-
-Package: libcmockery-dev
-Section: libdevel
-Architecture: any
-Depends: libcmockery0 (= ${Source-Version})
-Description: The cmockery package contains a lightweight library to simplify
- and generalize the process of writing unit tests for C applications.
-
-Package: libcmockery0
-Section: libs
-Architecture: any
-Description: The cmockery package contains static and debug libraries and
- header files for the development of test applications using %name.
-
diff --git a/packages/deb/copyright b/packages/deb/copyright
deleted file mode 100644
index 8367bab..0000000
--- a/packages/deb/copyright
+++ /dev/null
@@ -1,35 +0,0 @@
-This package was debianized by Google Inc. on
-28 August 2008.
-
-It was downloaded from http://code.google.com/
-
-Upstream Author: opensource@google.com
-
-Copyright (c) 2006, Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/packages/deb/docs b/packages/deb/docs
deleted file mode 100644
index c19d53d..0000000
--- a/packages/deb/docs
+++ /dev/null
@@ -1,7 +0,0 @@
-AUTHORS
-COPYING
-ChangeLog
-INSTALL
-NEWS
-README
-doc/index.html
diff --git a/packages/deb/libcmockery-dev.dirs b/packages/deb/libcmockery-dev.dirs
deleted file mode 100644
index d3ea20b..0000000
--- a/packages/deb/libcmockery-dev.dirs
+++ /dev/null
@@ -1,4 +0,0 @@
-usr/lib
-usr/include
-usr/include/google
-
diff --git a/packages/deb/libcmockery-dev.install b/packages/deb/libcmockery-dev.install
deleted file mode 100644
index 96e0c43..0000000
--- a/packages/deb/libcmockery-dev.install
+++ /dev/null
@@ -1,9 +0,0 @@
-usr/include/google/*
-usr/lib/lib*.so
-usr/lib/lib*.a
-usr/lib/lib*.la
-debian/tmp/usr/include/google/*
-debian/tmp/usr/lib/lib*.so
-debian/tmp/usr/lib/lib*.a
-debian/tmp/usr/lib/lib*.la
-
diff --git a/packages/deb/libcmockery0.dirs b/packages/deb/libcmockery0.dirs
deleted file mode 100644
index 6845771..0000000
--- a/packages/deb/libcmockery0.dirs
+++ /dev/null
@@ -1 +0,0 @@
-usr/lib
diff --git a/packages/deb/libcmockery0.install b/packages/deb/libcmockery0.install
deleted file mode 100644
index 704ea87..0000000
--- a/packages/deb/libcmockery0.install
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/lib/lib*.so.*
-debian/tmp/usr/lib/lib*.so.*
diff --git a/packages/deb/rules b/packages/deb/rules
deleted file mode 100755
index f520bef..0000000
--- a/packages/deb/rules
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/usr/bin/make -f
-# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-
-# These are used for cross-compiling and for saving the configure script
-# from having to guess our platform (since we know it already)
-DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-
-
-CFLAGS = -Wall -g
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
-else
- CFLAGS += -O2
-endif
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
- INSTALL_PROGRAM += -s
-endif
-
-# shared library versions, option 1
-#version=2.0.5
-#major=2
-# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so
-version=`ls src/.libs/lib*.so.* | \
- awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
-major=`ls src/.libs/lib*.so.* | \
- awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`
-
-config.status: configure
- dh_testdir
- # Add here commands to configure the package.
- CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
-
-
-build: build-stamp
-build-stamp: config.status
- dh_testdir
-
- # Add here commands to compile the package.
- $(MAKE)
-
- touch build-stamp
-
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp
-
- # Add here commands to clean up after the build process.
- -$(MAKE) distclean
-ifneq "$(wildcard /usr/share/misc/config.sub)" ""
- cp -f /usr/share/misc/config.sub config.sub
-endif
-ifneq "$(wildcard /usr/share/misc/config.guess)" ""
- cp -f /usr/share/misc/config.guess config.guess
-endif
-
-
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- # Add here commands to install the package into debian/tmp
- $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
-
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs ChangeLog
- dh_installdocs
- dh_installexamples
- dh_install --sourcedir=debian/tmp
-# dh_installmenu
-# dh_installdebconf
-# dh_installlogrotate
-# dh_installemacsen
-# dh_installpam
-# dh_installmime
-# dh_installinit
-# dh_installcron
-# dh_installinfo
- dh_installman
- dh_link
- dh_strip
- dh_compress
- dh_fixperms
-# dh_perl
-# dh_python
- dh_makeshlibs
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
diff --git a/packages/rpm.sh b/packages/rpm.sh
deleted file mode 100755
index 5395dc0..0000000
--- a/packages/rpm.sh
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/sh -e
-
-# Run this from the 'packages' directory, just under rootdir
-
-# We can only build rpm packages, if the rpm build tools are installed
-if [ \! -x /usr/bin/rpmbuild ]
-then
- echo "Cannot find /usr/bin/rpmbuild. Not building an rpm." 1>&2
- exit 0
-fi
-
-# Check the commandline flags
-PACKAGE="$1"
-VERSION="$2"
-fullname="${PACKAGE}-${VERSION}"
-archive=../$fullname.tar.gz
-
-if [ -z "$1" -o -z "$2" ]
-then
- echo "Usage: $0 " 1>&2
- exit 0
-fi
-
-# Double-check we're in the packages directory, just under rootdir
-if [ \! -r ../Makefile -a \! -r ../INSTALL ]
-then
- echo "Must run $0 in the 'packages' directory, under the root directory." 1>&2
- echo "Also, you must run \"make dist\" before running this script." 1>&2
- exit 0
-fi
-
-if [ \! -r "$archive" ]
-then
- echo "Cannot find $archive. Run \"make dist\" first." 1>&2
- exit 0
-fi
-
-# Create the directory where the input lives, and where the output should live
-RPM_SOURCE_DIR="/tmp/rpmsource-$fullname"
-RPM_BUILD_DIR="/tmp/rpmbuild-$fullname"
-
-trap 'rm -rf $RPM_SOURCE_DIR $RPM_BUILD_DIR; exit $?' EXIT SIGHUP SIGINT SIGTERM
-
-rm -rf "$RPM_SOURCE_DIR" "$RPM_BUILD_DIR"
-mkdir "$RPM_SOURCE_DIR"
-mkdir "$RPM_BUILD_DIR"
-
-cp "$archive" "$RPM_SOURCE_DIR"
-
-rpmbuild -bb rpm/rpm.spec \
- --define "NAME $PACKAGE" \
- --define "VERSION $VERSION" \
- --define "_sourcedir $RPM_SOURCE_DIR" \
- --define "_builddir $RPM_BUILD_DIR" \
- --define "_rpmdir $RPM_SOURCE_DIR"
-
-# We put the output in a directory based on what system we've built for
-destdir=rpm-unknown
-if [ -r /etc/issue ]
-then
- grep "Red Hat.*release 7" /etc/issue >/dev/null 2>&1 && destdir=rh7
- grep "Red Hat.*release 8" /etc/issue >/dev/null 2>&1 && destdir=rh8
- grep "Red Hat.*release 9" /etc/issue >/dev/null 2>&1 && destdir=rh9
- if grep Fedora /etc/issue >/dev/null; then
- destdir=fc`grep Fedora /etc/issue | cut -d' ' -f 4`;
- fi
-fi
-
-rm -rf "$destdir"
-mkdir -p "$destdir"
-# We want to get not only the main package but devel etc, hence the middle *
-mv "$RPM_SOURCE_DIR"/*/"${PACKAGE}"-*"${VERSION}"*.rpm "$destdir"
-
-echo
-echo "The rpm package file(s) are located in $PWD/$destdir"
diff --git a/packages/rpm/rpm.spec b/packages/rpm/rpm.spec
deleted file mode 100644
index 032485c..0000000
--- a/packages/rpm/rpm.spec
+++ /dev/null
@@ -1,76 +0,0 @@
-## This is a boilerplate file for Google opensource projects.
-## To make it useful, replace <> with actual text for your project.
-## Also, look at comments with "## double hashes" to see if any are worth
-## uncommenting or modifying.
-
-%define RELEASE 1
-%define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:%RELEASE}
-%define prefix /usr
-
-Name: %NAME
-Summary: Lightweight C unit testing framework.
-Version: %VERSION
-Release: %rel
-Group: Development/Libraries
-URL: http://code.google.com/p/cmockery
-License: Apache
-Vendor: Google
-Packager: Google Inc.
-Source: http://%{NAME}.googlecode.com/files/%{NAME}-%{VERSION}.tar.gz
-Distribution: Redhat 7 and above.
-Buildroot: %{_tmppath}/%{name}-root
-Prefix: %prefix
-
-%description
-The %name package contains a lightweight library to simplify and generalize the
-process of writing unit tests for C applications.
-
-%package devel
-Summary: Lightweight C unit testing framework.
-Group: Development/Libraries
-Requires: %{NAME} = %{VERSION}
-
-%description devel
-The %name package contains static and debug libraries and header files for the
-development of test applications using %name.
-
-%changelog
- * Mon Aug 25 2008
- - First draft
-
-%prep
-%setup
-
-%build
-./configure
-make prefix=%prefix
-
-%install
-rm -rf $RPM_BUILD_ROOT
-make prefix=$RPM_BUILD_ROOT%{prefix} install
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,root,root)
-
-## Mark all installed files within /usr/share/doc/{package name} as
-## documentation. This depends on the following two lines appearing in
-## Makefile.am:
-## docdir = $(prefix)/share/doc/$(PACKAGE)-$(VERSION)
-## dist_doc_DATA = AUTHORS COPYING ChangeLog INSTALL NEWS README
-%docdir %{prefix}/share/doc/%{NAME}-%{VERSION}
-%{prefix}/share/doc/%{NAME}-%{VERSION}/*
-
-%{prefix}/lib/libcmockery.so.0
-%{prefix}/lib/libcmockery.so.0.0.0
-
-
-%files devel
-%defattr(-,root,root)
-
-%{prefix}/include/google
-%{prefix}/lib/libcmockery.a
-%{prefix}/lib/libcmockery.la
-%{prefix}/lib/libcmockery.so
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 65b5762..8390d60 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,68 +1,68 @@
-project(cmockery-library C)
+project(cmocka-library C)
-set(CMOCKERY_PUBLIC_INCLUDE_DIRS
- ${CMAKE_SOURCE_DIR}/src/google
- CACHE INTERNAL "cmockery public include directories"
+set(CMOCKA_PUBLIC_INCLUDE_DIRS
+ ${CMAKE_SOURCE_DIR}/src/include
+ CACHE INTERNAL "cmocka public include directories"
)
-set(CMOCKERY_PRIVATE_INCLUDE_DIRS
+set(CMOCKA_PRIVATE_INCLUDE_DIRS
${CMAKE_BINARY_DIR}
)
-set(CMOCKERY_SHARED_LIBRARY
- cmockery_shared
- CACHE INTERNAL "cmockery shared library"
+set(CMOCKA_SHARED_LIBRARY
+ cmocka_shared
+ CACHE INTERNAL "cmocka shared library"
)
if (WITH_STATIC_LIB)
- set(CMOCKERY_STATIC_LIBRARY
- cmockery_static
- CACHE INTERNAL "cmockery static library"
+ set(CMOCKA_STATIC_LIBRARY
+ cmocka_static
+ CACHE INTERNAL "cmocka static library"
)
endif (WITH_STATIC_LIB)
-set(CMOCKERY_LINK_LIBRARIES
- ${CMOCKERY_REQUIRED_LIBRARIES}
- CACHE INTERNAL "cmockery link libraries"
+set(CMOCKA_LINK_LIBRARIES
+ ${CMOCKA_REQUIRED_LIBRARIES}
+ CACHE INTERNAL "cmocka link libraries"
)
-set(cmockery_SRCS
- cmockery.c
+set(cmocka_SRCS
+ cmocka.c
)
if (WIN32)
- set(cmockery_SRCS
- ${cmockery_SRCS}
- cmockery.def
+ set(cmocka_SRCS
+ ${cmocka_SRCS}
+ cmocka.def
)
endif (WIN32)
include_directories(
- ${CMOCKERY_PUBLIC_INCLUDE_DIRS}
- ${CMOCKERY_PRIVATE_INCLUDE_DIRS}
+ ${CMOCKA_PUBLIC_INCLUDE_DIRS}
+ ${CMOCKA_PRIVATE_INCLUDE_DIRS}
)
add_definitions(-DHAVE_CONFIG_H=1)
-add_library(${CMOCKERY_SHARED_LIBRARY} SHARED ${cmockery_SRCS})
+add_library(${CMOCKA_SHARED_LIBRARY} SHARED ${cmocka_SRCS})
-target_link_libraries(${CMOCKERY_SHARED_LIBRARY} ${CMOCKERY_LINK_LIBRARIES})
+target_link_libraries(${CMOCKA_SHARED_LIBRARY} ${CMOCKA_LINK_LIBRARIES})
set_target_properties(
- ${CMOCKERY_SHARED_LIBRARY}
+ ${CMOCKA_SHARED_LIBRARY}
PROPERTIES
VERSION
${LIBRARY_VERSION}
SOVERSION
${LIBRARY_SOVERSION}
OUTPUT_NAME
- cmockery
+ cmocka
DEFINE_SYMBOL
- CMOCKERY_EXPORTS
+ CMOCKA_EXPORTS
)
install(
- TARGETS ${CMOCKERY_SHARED_LIBRARY}
+ TARGETS ${CMOCKA_SHARED_LIBRARY}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
@@ -70,25 +70,25 @@ install(
)
if (WITH_STATIC_LIB)
- add_library(${CMOCKERY_STATIC_LIBRARY} STATIC ${cmockery_SRCS})
+ add_library(${CMOCKA_STATIC_LIBRARY} STATIC ${cmocka_SRCS})
set_target_properties(
- ${CMOCKERY_STATIC_LIBRARY}
+ ${CMOCKA_STATIC_LIBRARY}
PROPERTIES
VERSION
${LIBRARY_VERSION}
SOVERSION
${LIBRARY_SOVERSION}
OUTPUT_NAME
- cmockery
+ cmocka
)
install(
- TARGETS ${CMOCKERY_STATIC_LIBRARY}
+ TARGETS ${CMOCKA_STATIC_LIBRARY}
DESTINATION ${LIB_INSTALL_DIR}
COMPONENT libraries
)
endif (WITH_STATIC_LIB)
-add_subdirectory(google)
+add_subdirectory(include)
add_subdirectory(example)
diff --git a/src/cmockery.c b/src/cmocka.c
similarity index 99%
rename from src/cmockery.c
rename to src/cmocka.c
index a320eee..dc13c59 100755
--- a/src/cmockery.c
+++ b/src/cmocka.c
@@ -42,7 +42,7 @@ WINBASEAPI BOOL WINAPI IsDebuggerPresent(VOID);
#include
#endif /* _WIN32 */
-#include
+#include
// Size of guard bytes around dynamically allocated blocks.
#define MALLOC_GUARD_SIZE 16
diff --git a/src/cmockery.def b/src/cmocka.def
similarity index 97%
rename from src/cmockery.def
rename to src/cmocka.def
index ca3757b..268e1bd 100644
--- a/src/cmockery.def
+++ b/src/cmocka.def
@@ -1,4 +1,4 @@
-LIBRARY cmockery
+LIBRARY cmocka
EXPORTS
_assert_in_range
_assert_in_set
diff --git a/src/example/CMakeLists.txt b/src/example/CMakeLists.txt
index 0ba8f21..a75c353 100644
--- a/src/example/CMakeLists.txt
+++ b/src/example/CMakeLists.txt
@@ -1,30 +1,30 @@
-project(cmockery-examples C CXX)
+project(cmocka-examples C CXX)
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
- ${CMOCKERY_PUBLIC_INCLUDE_DIRS}
+ ${CMOCKA_PUBLIC_INCLUDE_DIRS}
)
add_definitions(-DUNIT_TESTING=1)
add_executable(calculator_test calculator.c calculator_test.c)
-target_link_libraries(calculator_test ${CMOCKERY_SHARED_LIBRARY})
+target_link_libraries(calculator_test ${CMOCKA_SHARED_LIBRARY})
add_executable(allocate_module_test allocate_module.c allocate_module_test.c)
-target_link_libraries(allocate_module_test ${CMOCKERY_SHARED_LIBRARY})
+target_link_libraries(allocate_module_test ${CMOCKA_SHARED_LIBRARY})
add_executable(assert_macro_test assert_macro.c assert_macro_test.c)
-target_link_libraries(assert_macro_test ${CMOCKERY_SHARED_LIBRARY})
+target_link_libraries(assert_macro_test ${CMOCKA_SHARED_LIBRARY})
add_executable(customer_database_test customer_database.c customer_database_test.c)
-target_link_libraries(customer_database_test ${CMOCKERY_SHARED_LIBRARY})
+target_link_libraries(customer_database_test ${CMOCKA_SHARED_LIBRARY})
add_executable(key_value_test key_value.c key_value_test.c)
-target_link_libraries(key_value_test ${CMOCKERY_SHARED_LIBRARY})
+target_link_libraries(key_value_test ${CMOCKA_SHARED_LIBRARY})
add_executable(product_database_test product_database.c product_database_test.c)
-target_link_libraries(product_database_test ${CMOCKERY_SHARED_LIBRARY})
+target_link_libraries(product_database_test ${CMOCKA_SHARED_LIBRARY})
add_executable(run_tests run_tests.c)
-target_link_libraries(run_tests ${CMOCKERY_SHARED_LIBRARY})
+target_link_libraries(run_tests ${CMOCKA_SHARED_LIBRARY})
diff --git a/src/example/allocate_module_test.c b/src/example/allocate_module_test.c
index b4519b5..2346a69 100644
--- a/src/example/allocate_module_test.c
+++ b/src/example/allocate_module_test.c
@@ -16,7 +16,7 @@
#include
#include
#include
-#include
+#include
extern void leak_memory();
extern void buffer_overflow();
diff --git a/src/example/assert_macro_test.c b/src/example/assert_macro_test.c
index 4b8c850..79e1b53 100644
--- a/src/example/assert_macro_test.c
+++ b/src/example/assert_macro_test.c
@@ -16,7 +16,7 @@
#include
#include
#include
-#include
+#include
extern const char* get_status_code_string(const unsigned int status_code);
extern unsigned int string_to_status_code(
diff --git a/src/example/assert_module_test.c b/src/example/assert_module_test.c
index dfa55f1..39eb539 100644
--- a/src/example/assert_module_test.c
+++ b/src/example/assert_module_test.c
@@ -16,7 +16,7 @@
#include
#include
#include
-#include
+#include
extern void increment_value(int * const value);
diff --git a/src/example/calculator.c b/src/example/calculator.c
index 83237fc..5e0b359 100644
--- a/src/example/calculator.c
+++ b/src/example/calculator.c
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-// A calculator example used to demonstrate the cmockery testing library.
+// A calculator example used to demonstrate the cmocka testing library.
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -49,7 +49,7 @@ extern void print_message(const char *format, ...);
extern int example_test_fprintf(FILE * const file, const char *format, ...);
-// Redirect assert to mock_assert() so assertions can be caught by cmockery.
+// Redirect assert to mock_assert() so assertions can be caught by cmocka.
#ifdef assert
#undef assert
#endif // assert
@@ -58,7 +58,7 @@ extern int example_test_fprintf(FILE * const file, const char *format, ...);
void mock_assert(const int result, const char* expression, const char *file,
const int line);
-/* Redirect calloc and free to test_calloc() and test_free() so cmockery can
+/* Redirect calloc and free to test_calloc() and test_free() so cmocka can
* check for memory leaks. */
#ifdef calloc
#undef calloc
diff --git a/src/example/calculator_test.c b/src/example/calculator_test.c
index 52ae2f2..58db5ea 100644
--- a/src/example/calculator_test.c
+++ b/src/example/calculator_test.c
@@ -16,7 +16,7 @@
#include
#include
#include
-#include "cmockery.h"
+#include "cmocka.h"
#include
#ifdef _WIN32
diff --git a/src/example/customer_database_test.c b/src/example/customer_database_test.c
index d8cc6ca..8a95874 100644
--- a/src/example/customer_database_test.c
+++ b/src/example/customer_database_test.c
@@ -16,7 +16,7 @@
#include
#include
#include
-#include
+#include
#include
extern DatabaseConnection* connect_to_customer_database();
diff --git a/src/example/key_value_test.c b/src/example/key_value_test.c
index 0ec632a..f2e6cf2 100644
--- a/src/example/key_value_test.c
+++ b/src/example/key_value_test.c
@@ -17,7 +17,7 @@
#include
#include
#include
-#include
+#include
#include "key_value.h"
diff --git a/src/example/product_database_test.c b/src/example/product_database_test.c
index 571d51a..abc02d6 100644
--- a/src/example/product_database_test.c
+++ b/src/example/product_database_test.c
@@ -16,7 +16,7 @@
#include
#include
#include
-#include
+#include
#include
extern DatabaseConnection* connect_to_product_database(void);
diff --git a/src/example/run_tests.c b/src/example/run_tests.c
index fe878be..5a5e5e4 100644
--- a/src/example/run_tests.c
+++ b/src/example/run_tests.c
@@ -16,7 +16,7 @@
#include
#include
#include
-#include
+#include
// A test case that does nothing and succeeds.
static void null_test_success(void **state) {
diff --git a/src/google/CMakeLists.txt b/src/google/CMakeLists.txt
deleted file mode 100644
index 0f22acf..0000000
--- a/src/google/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-project(cmockery-headers C)
-
-set(cmockery_HDRS
- cmockery.h
-)
-
-install(
- FILES
- ${cmockery_HDRS}
- DESTINATION
- ${INCLUDE_INSTALL_DIR}/google
- COMPONENT
- headers
-)
diff --git a/src/include/CMakeLists.txt b/src/include/CMakeLists.txt
new file mode 100644
index 0000000..9172633
--- /dev/null
+++ b/src/include/CMakeLists.txt
@@ -0,0 +1,14 @@
+project(cmocka-headers C)
+
+set(cmocka_HDRS
+ cmocka.h
+)
+
+install(
+ FILES
+ ${cmocka_HDRS}
+ DESTINATION
+ ${INCLUDE_INSTALL_DIR}
+ COMPONENT
+ headers
+)
diff --git a/src/google/cmockery.h b/src/include/cmocka.h
similarity index 99%
rename from src/google/cmockery.h
rename to src/include/cmocka.h
index 16316fd..7a52342 100755
--- a/src/google/cmockery.h
+++ b/src/include/cmocka.h
@@ -13,8 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef CMOCKERY_H_
-#define CMOCKERY_H_
+#ifndef CMOCKA_H_
+#define CMOCKA_H_
#ifdef _WIN32
#if _MSC_VER < 1500
#ifdef __cplusplus
@@ -528,4 +528,4 @@ void print_error(const char* const format, ...);
void vprint_message(const char* const format, va_list args);
void vprint_error(const char* const format, va_list args);
-#endif // CMOCKERY_H_
+#endif // CMOCKA_H_