Merge pull request #1181 from rgerhards/i-1180

ensure assert() is activated in dev environment
This commit is contained in:
Rainer Gerhards 2016-10-09 12:41:20 +02:00
commit 622ae3cf1b
10 changed files with 70 additions and 41 deletions

View File

@ -75,7 +75,8 @@ matrix:
env: BUILD_FROM_TARBALL="YES", GROK="YES", KAFKA="YES", CHECK="YES", CFLAGS="-g -O2 -W -Wall -Wformat-security -Wshadow -Wcast-align -Wpointer-arith -Wmissing-format-attribute", RS_TESTBENCH_VALGRIND_EXTRA_OPTS="--suppressions=travis/trusty.supp --gen-suppressions=all"
dist: trusty
- compiler: "clang"
env: CHECK="YES", ESTEST="YES", CFLAGS="-g -O1 -fsanitize=address -fno-color-diagnostics"
# we run this test without assert() enabled, so that we get "production timing"
env: CHECK="YES", ESTEST="YES", CFLAGS="-g -O1 -fsanitize=address -fno-color-diagnostics", CONFIGURE_FLAGS="--disable-debug"
- compiler: "clang"
dist: trusty
env: AD_PPA="v8-devel", CHECK="YES", CFLAGS="-g -O1 -fsanitize=address -fno-color-diagnostics"

View File

@ -19,8 +19,17 @@ Version 8.23.0 [v8-stable] 2016-11-15
Thanks to Chris Pilkington for the patch.
- bugfix external module perl skeleton: did not work properly
Thanks to github user Igorjan666 for the patch.
- build environment: --enable-debug now defaults to new "auto" mode
previously, DEBUG mode (and thus assert() macros) was disabled by default
and explicitly needed to be enabled by providing the --enable-debug
./configure switch. Now, a new --enable-debug=auto mode has been added
and made the default. It enables DEBUG mode if we build from git and only
disables it when a release build is done (from the release tarball). This
aims at better error checking during testbench runs and developer testing.
- testbench improvements
* imfile ReopenOnTruncate option is now being tested
* the CI environment now runs most tests in debug mode, but some in
release mode to cover potential release-mode races
------------------------------------------------------------------------------
Version 8.22.0 [v8-stable] 2016-10-04
- ompgsql: add template support

View File

@ -246,7 +246,7 @@ batchState2String(const batch_state_t state)
* because that would provide little to no benefit but complicate things
* a lot. So we simply return the system time.
*/
static inline time_t
static time_t
getActNow(action_t * const pThis)
{
assert(pThis != NULL);
@ -667,7 +667,7 @@ static void actionRetry(action_t * const pThis, wti_t * const pWti)
* CPU time. TODO: maybe a config option for that?
* rgerhards, 2007-08-02
*/
static inline void
static void
actionSuspend(action_t * const pThis, wti_t * const pWti)
{
time_t ttNow;
@ -871,7 +871,7 @@ finalize_it:
* depending on its current state.
* rgerhards, 2009-05-07
*/
static inline rsRetVal
static rsRetVal
actionPrepare(action_t *__restrict__ const pThis, wti_t *__restrict__ const pWti)
{
DEFiRet;
@ -1923,7 +1923,7 @@ resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unus
/* initialize (current) config variables.
* Used at program start and when a new scope is created.
*/
static inline void
static void
initConfigVariables(void)
{
cs.bActionWriteAllMarkMsgs = 1;

View File

@ -79,6 +79,10 @@ case "${host}" in
;;
esac
# Running from git source?
in_git_src=no
AS_IF([test -d "$srcdir"/.git && ! test -f "$srcdir"/.tarball-version], [in_git_src=yes])
AC_DEFINE_UNQUOTED([HOSTENV], "$host", [the host environment, can be queried via a system variable])
# Checks for libraries.
@ -453,14 +457,23 @@ AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_sy
# debug
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],[Enable debug mode @<:@default=no@:>@])],
[AS_HELP_STRING([--enable-debug],[Enable debug mode @<:@default=auto@:>@])],
[case "${enableval}" in
yes) enable_debug="yes" ;;
no) enable_debug="no" ;;
yes) enable_debug="yes" ;;
no) enable_debug="no" ;;
auto) enable_debug="auto" ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
esac],
[enable_debug="no"]
[enable_debug="auto"]
)
if test "$enable_debug" = "auto"; then
if test "x$in_git_src" = "xyes"; then
enable_debug="yes"
else
enable_debug="no"
fi
AC_MSG_NOTICE([enable-debug in auto mode, enable-debug is set to ${enable_debug}])
fi
if test "$enable_debug" = "yes"; then
AC_DEFINE(DEBUG, 1, [Defined if debug mode is enabled (its easier to check).])
fi
@ -1777,10 +1790,6 @@ AC_ARG_ENABLE(distcheck-workaround,
AM_CONDITIONAL(ENABLE_DISTCHECK_WORKAROUND, test x$enable_distcheck_workaround = xyes)
# Running from git source?
in_git_src=no
AS_IF([test -d "$srcdir"/.git && ! test -f "$srcdir"/.tarball-version], [in_git_src=yes])
if test "x$in_git_src" = "xyes"; then
AC_MSG_NOTICE([Running from git source])

View File

@ -210,7 +210,8 @@ static void dbgFuncDBPrintAll(void)
/* find a mutex inside the FuncDB mutex table. Returns NULL if not found. Only mutexes from the same thread
* are found.
*/
static inline dbgFuncDBmutInfoEntry_t *dbgFuncDBGetMutexInfo(dbgFuncDB_t *pFuncDB, pthread_mutex_t *pmut)
static dbgFuncDBmutInfoEntry_t *
dbgFuncDBGetMutexInfo(dbgFuncDB_t *pFuncDB, pthread_mutex_t *pmut)
{
int i;
int iFound = -1;
@ -249,7 +250,8 @@ dbgFuncDBPrintActiveMutexes(dbgFuncDB_t *pFuncDB, const char *pszHdrText, pthrea
/* find a free mutex info spot in FuncDB. NULL is returned if table is full.
*/
static inline dbgFuncDBmutInfoEntry_t *dbgFuncDBFindFreeMutexInfo(dbgFuncDB_t *pFuncDB)
static dbgFuncDBmutInfoEntry_t *
dbgFuncDBFindFreeMutexInfo(dbgFuncDB_t *pFuncDB)
{
int i;
int iFound = -1;
@ -271,7 +273,8 @@ static inline dbgFuncDBmutInfoEntry_t *dbgFuncDBFindFreeMutexInfo(dbgFuncDB_t *p
/* add a mutex lock to the FuncDB. If the size is exhausted, info is discarded.
*/
static inline void dbgFuncDBAddMutexLock(dbgFuncDB_t *pFuncDB, pthread_mutex_t *pmut, int lockLn)
static void
dbgFuncDBAddMutexLock(dbgFuncDB_t *pFuncDB, pthread_mutex_t *pmut, int lockLn)
{
dbgFuncDBmutInfoEntry_t *pMutInfo;
@ -285,7 +288,8 @@ static inline void dbgFuncDBAddMutexLock(dbgFuncDB_t *pFuncDB, pthread_mutex_t *
/* remove a locked mutex from the FuncDB (unlock case!).
*/
static inline void dbgFuncDBRemoveMutexLock(dbgFuncDB_t *pFuncDB, pthread_mutex_t *pmut)
static void
dbgFuncDBRemoveMutexLock(dbgFuncDB_t *pFuncDB, pthread_mutex_t *pmut)
{
dbgFuncDBmutInfoEntry_t *pMutInfo;
@ -450,7 +454,8 @@ static dbgMutLog_t *dbgMutLogFindHolder(pthread_mutex_t *pmut)
}
/* report wait on a mutex and add it to the mutex log */
static inline void dbgMutexPreLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB, int ln)
static void
dbgMutexPreLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB, int ln)
{
dbgMutLog_t *pHolder;
char pszBuf[128];
@ -476,7 +481,8 @@ static inline void dbgMutexPreLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncD
/* report aquired mutex */
static inline void dbgMutexLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB, int lockLn)
static void
dbgMutexLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB, int lockLn)
{
dbgMutLog_t *pLog;
@ -498,7 +504,8 @@ static inline void dbgMutexLockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB,
/* if we unlock, we just remove the lock aquired entry from the log list */
static inline void dbgMutexUnlockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB, int unlockLn)
static void
dbgMutexUnlockLog(pthread_mutex_t *pmut, dbgFuncDB_t *pFuncDB, int unlockLn)
{
dbgMutLog_t *pLog;
@ -663,7 +670,8 @@ static dbgThrdInfo_t *dbgGetThrdInfo(void)
/* find a specific thread ID. It must be present, else something is wrong
*/
static inline dbgThrdInfo_t *dbgFindThrd(pthread_t thrd)
static dbgThrdInfo_t *
dbgFindThrd(pthread_t thrd)
{
dbgThrdInfo_t *pThrd;

View File

@ -786,7 +786,8 @@ uchar *propIDToName(propid_t propID)
* a binary 0 on all machines [but today almost always...]).
* rgerhards, 2008-10-06
*/
static inline rsRetVal msgBaseConstruct(msg_t **ppThis)
static rsRetVal
msgBaseConstruct(msg_t **ppThis)
{
DEFiRet;
msg_t *pM;
@ -1488,7 +1489,7 @@ finalize_it:
* IMPORTANT: A locked message object must be provided, else a crash will occur.
* rgerhards, 2005-10-19
*/
static inline rsRetVal
static rsRetVal
aquireProgramName(msg_t * const pM)
{
int i;

View File

@ -179,7 +179,7 @@ static inline toDeleteLst_t *tdlPeek(qqueue_t *pQueue)
* element itself is destroyed. Must not be called when the list
* is empty.
*/
static inline rsRetVal tdlPop(qqueue_t *pQueue)
static rsRetVal tdlPop(qqueue_t *pQueue)
{
toDeleteLst_t *pRemove;
DEFiRet;
@ -199,7 +199,8 @@ static inline rsRetVal tdlPop(qqueue_t *pQueue)
* structure, populates it with the values provided and links the new
* element into the correct place inside the list.
*/
static inline rsRetVal tdlAdd(qqueue_t *pQueue, qDeqID deqID, int nElemDeq)
static rsRetVal
tdlAdd(qqueue_t *pQueue, qDeqID deqID, int nElemDeq)
{
toDeleteLst_t *pNew;
toDeleteLst_t *pPrev;
@ -234,7 +235,7 @@ finalize_it:
/* methods */
static inline const char *
static const char *
getQueueTypeName(queueType_t t)
{
const char *r;
@ -323,7 +324,7 @@ getLogicalQueueSize(qqueue_t *pThis)
* This functions works "around" the regular deque mechanism, because it is only used to
* clean up (in cases where message loss is acceptable).
*/
static inline void queueDrain(qqueue_t *pThis)
static void queueDrain(qqueue_t *pThis)
{
msg_t *pMsg;
ASSERT(pThis != NULL);
@ -349,7 +350,7 @@ static inline void queueDrain(qqueue_t *pThis)
* this point in time. The mutex must be locked when
* ths function is called. -- rgerhards, 2008-01-25
*/
static inline rsRetVal
static rsRetVal
qqueueAdviseMaxWorkers(qqueue_t *pThis)
{
DEFiRet;
@ -706,7 +707,7 @@ static rsRetVal qDelLinkedList(qqueue_t *pThis)
* states, which can trigger different processing in the higher layers.
* rgerhards, 2011-05-03
*/
static inline rsRetVal
static rsRetVal
queueSwitchToEmergencyMode(qqueue_t *pThis, rsRetVal initiatingError)
{
pThis->iQueueSize = 0;
@ -1112,7 +1113,7 @@ qqueueDeq(qqueue_t *pThis, msg_t **ppMsg)
* and DA queue to try complete processing.
* rgerhards, 2009-10-14
*/
static inline rsRetVal
static rsRetVal
tryShutdownWorkersWithinQueueTimeout(qqueue_t *pThis)
{
struct timespec tTimeout;
@ -1496,7 +1497,7 @@ finalize_it:
/* Finally remove n elements from the queue store.
*/
static inline rsRetVal
static rsRetVal
DoDeleteBatchFromQStore(qqueue_t *pThis, int nElem)
{
int i;
@ -1554,7 +1555,7 @@ DoDeleteBatchFromQStore(qqueue_t *pThis, int nElem)
/* remove messages from the physical queue store that are fully processed. This is
* controlled via the to-delete list.
*/
static inline rsRetVal
static rsRetVal
DeleteBatchFromQStore(qqueue_t *pThis, batch_t *pBatch)
{
toDeleteLst_t *pTdl;
@ -1594,7 +1595,7 @@ finalize_it:
* processed are enqueued again. The new enqueue is necessary because we have a
* rgerhards, 2009-05-13
*/
static inline rsRetVal
static rsRetVal
DeleteProcessedBatch(qqueue_t *pThis, batch_t *pBatch)
{
int i;
@ -1641,7 +1642,7 @@ DeleteProcessedBatch(qqueue_t *pThis, batch_t *pBatch)
* This must only be called when the queue mutex is LOOKED, otherwise serious
* malfunction will happen.
*/
static inline rsRetVal
static rsRetVal
DequeueConsumableElements(qqueue_t *pThis, wti_t *pWti, int *piRemainingQueueSize, int *const pSkippedMsgs)
{
int nDequeued;
@ -1885,7 +1886,7 @@ RateLimiter(qqueue_t *pThis)
* cancelled, else it will leave back an inconsistent state.
* rgerhards, 2009-05-20
*/
static inline rsRetVal
static rsRetVal
DequeueForConsumer(qqueue_t *pThis, wti_t *pWti, int *const pSkippedMsgs)
{
DEFiRet;
@ -2577,7 +2578,7 @@ finalize_it:
* depending on the queue configuration (e.g. store on remote machine).
* rgerhards, 2009-05-26
*/
static inline rsRetVal
static rsRetVal
DoSaveOnShutdown(qqueue_t *pThis)
{
struct timespec tTimeout;
@ -2767,7 +2768,7 @@ finalize_it:
* Note that the queue mutex MUST already be locked when this function is called.
* rgerhards, 2009-06-16
*/
static inline rsRetVal
static rsRetVal
doEnqSingleObj(qqueue_t *pThis, flowControl_t flowCtlType, msg_t *pMsg)
{
DEFiRet;

View File

@ -61,7 +61,7 @@ pthread_key_t thrd_wti_key;
/* get the header for debug messages
* The caller must NOT free or otherwise modify the returned string!
*/
static inline uchar *
static uchar *
wtiGetDbgHdr(wti_t *pThis)
{
ISOBJ_TYPE_assert(pThis, wti);
@ -282,7 +282,7 @@ wtiWorkerCancelCleanup(void *arg)
* re-tested by the caller, so it is OK to NOT do it here.
* rgerhards, 2009-05-20
*/
static inline void
static void
doIdleProcessing(wti_t *pThis, wtp_t *pWtp, int *pbInactivityTOOccured)
{
struct timespec t;

View File

@ -69,7 +69,7 @@ DEFobjCurrIf(glbl)
/* get the header for debug messages
* The caller must NOT free or otherwise modify the returned string!
*/
static inline uchar *
static uchar *
wtpGetDbgHdr(wtp_t *pThis)
{
ISOBJ_TYPE_assert(pThis, wtp);

View File

@ -38,7 +38,7 @@ if [ "x$ESTEST" == "xYES" ]; then export ES_TEST_CONFIGURE_OPT="--enable-elastic
if [ "$CC" == "clang" ] && [ "$DISTRIB_CODENAME" == "trusty" ]; then export CC="clang-3.6"; fi
$CC -v
env
export CONFIG_FLAGS="--prefix=/opt/rsyslog --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-dependency-tracking --enable-silent-rules --libdir=/usr/lib64 --docdir=/usr/share/doc/rsyslog --disable-generate-man-pages --enable-testbench --enable-imdiag --enable-imfile --enable-impstats --enable-imptcp --enable-mmanon --enable-mmaudit --enable-mmfields --enable-mmjsonparse --enable-mmpstrucdata --enable-mmsequence --enable-mmutf8fix --enable-mail --enable-omprog --enable-omruleset --enable-omstdout --enable-omuxsock --enable-pmaixforwardedfrom --enable-pmciscoios --enable-pmcisconames --enable-pmlastmsg --enable-pmsnare --enable-libgcrypt --enable-mmnormalize --disable-omudpspoof --enable-relp --disable-snmp --disable-mmsnmptrapd --enable-gnutls --enable-mysql --enable-mysql-tests --enable-usertools --enable-gt-ksi --enable-libdbi --enable-pgsql --enable-omhttpfs --enable-elasticsearch --enable-valgrind --enable-ommongodb --enable-omamqp1 --enable-omrelp-default-port=13515 $JOURNAL_OPT $HIREDIS_OPT $ENABLE_KAFKA $NO_VALGRIND $GROK $ES_TEST_CONFIGURE_OPT"
export CONFIG_FLAGS="--prefix=/opt/rsyslog --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --disable-dependency-tracking --enable-silent-rules --libdir=/usr/lib64 --docdir=/usr/share/doc/rsyslog --disable-generate-man-pages --enable-testbench --enable-imdiag --enable-imfile --enable-impstats --enable-imptcp --enable-mmanon --enable-mmaudit --enable-mmfields --enable-mmjsonparse --enable-mmpstrucdata --enable-mmsequence --enable-mmutf8fix --enable-mail --enable-omprog --enable-omruleset --enable-omstdout --enable-omuxsock --enable-pmaixforwardedfrom --enable-pmciscoios --enable-pmcisconames --enable-pmlastmsg --enable-pmsnare --enable-libgcrypt --enable-mmnormalize --disable-omudpspoof --enable-relp --disable-snmp --disable-mmsnmptrapd --enable-gnutls --enable-mysql --enable-mysql-tests --enable-usertools --enable-gt-ksi --enable-libdbi --enable-pgsql --enable-omhttpfs --enable-elasticsearch --enable-valgrind --enable-ommongodb --enable-omamqp1 --enable-omrelp-default-port=13515 $JOURNAL_OPT $HIREDIS_OPT $ENABLE_KAFKA $NO_VALGRIND $GROK $ES_TEST_CONFIGURE_OPT $CONFIGURE_FLAGS"
./configure $CONFIG_FLAGS
export USE_AUTO_DEBUG="off" # set to "on" to enable this for travis
make -j