1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

third_party: Add cmocka 1.1.1

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlet <abartlet@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Apr 10 11:38:13 CEST 2017 on sn-devel-144
This commit is contained in:
Andreas Schneider 2017-04-07 15:44:05 +02:00 committed by Andreas Schneider
parent 686ac6b171
commit 94b7672d48
7 changed files with 5785 additions and 9 deletions

View File

@ -3,14 +3,10 @@
import os
def configure(conf):
pkg_name = 'cmocka'
pkg_minversion = '1.0'
conf.CHECK_BUNDLED_SYSTEM_PKG(pkg_name, minversion=pkg_minversion)
return
def build(bld):
if bld.CONFIG_SET('HAVE_CMOCKA'):
bld.SAMBA_BINARY('test_krb5samba',
source='test_krb5_samba.c',
deps='krb5samba cmocka',
install=False)
bld.SAMBA_BINARY('test_krb5samba',
source='test_krb5_samba.c',
deps='krb5samba cmocka',
install=False)

3306
third_party/cmocka/cmocka.c vendored Normal file

File diff suppressed because it is too large Load Diff

2284
third_party/cmocka/cmocka.h vendored Normal file

File diff suppressed because it is too large Load Diff

163
third_party/cmocka/cmocka_private.h vendored Normal file
View File

@ -0,0 +1,163 @@
/*
* Copyright 2008 Google Inc.
*
* 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.
*/
#ifndef CMOCKA_PRIVATE_H_
#define CMOCKA_PRIVATE_H_
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdint.h>
#ifdef _WIN32
#include <windows.h>
# ifdef _MSC_VER
# include <stdio.h> /* _snprintf */
# undef inline
# define inline __inline
# ifndef va_copy
# define va_copy(dest, src) (dest = src)
# endif
# define strcasecmp _stricmp
# define strncasecmp _strnicmp
# if defined(HAVE__SNPRINTF_S)
# undef snprintf
# define snprintf(d, n, ...) _snprintf_s((d), (n), _TRUNCATE, __VA_ARGS__)
# else /* HAVE__SNPRINTF_S */
# if defined(HAVE__SNPRINTF)
# undef snprintf
# define snprintf _snprintf
# else /* HAVE__SNPRINTF */
# if !defined(HAVE_SNPRINTF)
# error "no snprintf compatible function found"
# endif /* HAVE_SNPRINTF */
# endif /* HAVE__SNPRINTF */
# endif /* HAVE__SNPRINTF_S */
# if defined(HAVE__VSNPRINTF_S)
# undef vsnprintf
# define vsnprintf(s, n, f, v) _vsnprintf_s((s), (n), _TRUNCATE, (f), (v))
# else /* HAVE__VSNPRINTF_S */
# if defined(HAVE__VSNPRINTF)
# undef vsnprintf
# define vsnprintf _vsnprintf
# else
# if !defined(HAVE_VSNPRINTF)
# error "No vsnprintf compatible function found"
# endif /* HAVE_VSNPRINTF */
# endif /* HAVE__VSNPRINTF */
# endif /* HAVE__VSNPRINTF_S */
# endif /* _MSC_VER */
/*
* Backwards compatibility with headers shipped with Visual Studio 2005 and
* earlier.
*/
WINBASEAPI BOOL WINAPI IsDebuggerPresent(VOID);
#ifndef PRIdS
# define PRIdS "Id"
#endif
#ifndef PRIu64
# define PRIu64 "I64u"
#endif
#ifndef PRIuMAX
# define PRIuMAX PRIu64
#endif
#ifndef PRIxMAX
#define PRIxMAX "I64x"
#endif
#ifndef PRIXMAX
#define PRIXMAX "I64X"
#endif
#else /* _WIN32 */
#ifndef __PRI64_PREFIX
# if __WORDSIZE == 64
# define __PRI64_PREFIX "l"
# else
# define __PRI64_PREFIX "ll"
# endif
#endif
#ifndef PRIdS
# define PRIdS "zd"
#endif
#ifndef PRIu64
# define PRIu64 __PRI64_PREFIX "u"
#endif
#ifndef PRIuMAX
# define PRIuMAX __PRI64_PREFIX "u"
#endif
#ifndef PRIxMAX
#define PRIxMAX __PRI64_PREFIX "x"
#endif
#ifndef PRIXMAX
#define PRIXMAX __PRI64_PREFIX "X"
#endif
#endif /* _WIN32 */
/** Free memory space */
#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
/** Zero a structure */
#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
/** Zero a structure given a pointer to the structure */
#define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
/** Get the size of an array */
#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
/** Overwrite the complete string with 'X' */
#define BURN_STRING(x) do { if ((x) != NULL) memset((x), 'X', strlen((x))); } while(0)
/**
* This is a hack to fix warnings. The idea is to use this everywhere that we
* get the "discarding const" warning by the compiler. That doesn't actually
* fix the real issue, but marks the place and you can search the code for
* discard_const.
*
* Please use this macro only when there is no other way to fix the warning.
* We should use this function in only in a very few places.
*
* Also, please call this via the discard_const_p() macro interface, as that
* makes the return type safe.
*/
#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
/**
* Type-safe version of discard_const
*/
#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
#endif /* CMOCKA_PRIVATE_H_ */

19
third_party/cmocka/wscript vendored Normal file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env python
import Options
def configure(conf):
conf.CHECK_FUNCS('longjmp siglongjmp')
if conf.CHECK_CMOCKA():
conf.define('USING_SYSTEM_CMOCKA', 1)
def build(bld):
if bld.CONFIG_SET('USING_SYSTEM_CMOCKA'):
return
bld.SAMBA_LIBRARY('cmocka',
source='cmocka.c',
deps='rt',
allow_warnings=True,
private_library=True)

2
third_party/wscript vendored
View File

@ -47,6 +47,7 @@ Unable to find Python module '%s'. Please install the system package or place a
def configure(conf):
for module, package in external_pkgs.items():
find_third_party_module(conf, module, package)
conf.RECURSE('cmocka')
conf.RECURSE('popt')
conf.RECURSE('zlib')
@ -69,5 +70,6 @@ def build(bld):
target='empty_file')
bld.INSTALL_FILES('${PYTHONARCHDIR}/samba/third_party', 'empty_file', destname='__init__.py')
bld.RECURSE('cmocka')
bld.RECURSE('zlib')
bld.RECURSE('popt')

View File

@ -143,6 +143,12 @@ def configure(conf):
else:
conf.define('USING_SYSTEM_POPT', 1)
if not conf.CHECK_CMOCKA():
raise Utils.WafError('cmocka development packages has not been found.\nIf third_party is installed, check that it is in the proper place.')
else:
conf.define('USING_SYSTEM_CMOCKA', 1)
conf.RECURSE('lib/ldb')
if not (Options.options.without_ad_dc):