Skip to content

Commit

Permalink
HPCC-33413 Rationalize existing _TESTING code
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Feb 11, 2025
1 parent 4aadad7 commit 1358662
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 19 deletions.
2 changes: 0 additions & 2 deletions system/include/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#ifndef _PLATFORM_H_
#define _PLATFORM_H_

#define _TESTING // this should remain set for the near future

// **** Architecture detection ****
// Ref: http://sourceforge.net/p/predef/wiki/Architectures/
// Following GNU, ARMCC, ICC and MSVS macros only
Expand Down
10 changes: 3 additions & 7 deletions system/jlib/jiface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@ __declspec(noreturn) void jlib_decl raiseAssertCore(const char *assertion, const
#undef assert
#undef assertex

#if defined(_DEBUG)||defined(_TESTING)
#define assertex(p) (likely(p) ? ((void) 0) : (( (void) raiseAssertException(#p, __FILE__, __LINE__))))
#define verifyex(p) (likely(p) ? ((void) 0) : (( (void) raiseAssertException(#p, __FILE__, __LINE__))))
#else
#define assertex(p)
#define verifyex(p) ((void) (p))
#endif
// NB: assertex should be a NOP in release really, but changing now may have undesirable side-effects
#define assertex(p) (likely(p) ? ((void) 0) : (( (void) raiseAssertException(#p, __FILE__, __LINE__))))
#define verifyex(p) (likely(p) ? ((void) 0) : (( (void) raiseAssertException(#p, __FILE__, __LINE__))))

#ifdef _DEBUG
#define dbgassertex(x) assertex(x) //Use for asserts that are highly unlikely to occur, and would likely to be reproduced in debug mode.
Expand Down
3 changes: 1 addition & 2 deletions system/jlib/jsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,8 @@
//#define EPOLLTRACE
#endif

#ifdef _TESTING
// comment out this definition to suppress all low-level jsocket error logging
#define _TRACE
#endif

#ifdef _TRACE
#define LOGERR(err,ref,info) LogErr(err,ref,info,__LINE__,NULL)
Expand Down
2 changes: 0 additions & 2 deletions thorlcr/graph/thgraphslave.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,13 @@ class CEdgeProgress
inline void dataLinkIncrement() { dataLinkIncrement(1); }
inline void dataLinkIncrement(rowcount_t v)
{
#ifdef _TESTING
assertex(hasStarted());
#ifdef OUTPUT_RECORDSIZE
if (count==THORDATALINK_STARTED)
{
size32_t rsz = parent.queryRowMetaData(this)->getMinRecordSize();
parent.ActPrintLog("Record size %s= %d", parent.queryRowMetaData(this)->isVariableSize()?"(min) ":"",rsz);
}
#endif
#endif
icount += v;
count += v;
Expand Down
11 changes: 6 additions & 5 deletions thorlcr/msort/tsorta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ void CThorKeyArray::createSortedPartition(unsigned pn)
keys.swap(newrows);
}

#define VALIDATE_KEY_BOUNDARIES
int CThorKeyArray::binchopPartition(const void * row,bool lt)
{
int n = (int)ordinality();
Expand All @@ -349,7 +350,7 @@ int CThorKeyArray::binchopPartition(const void * row,bool lt)
int a = 0;
int b = n;
int cmp = 0;
#ifdef _TESTING
#ifdef VALIDATE_KEY_BOUNDARIES
try {
#endif
while (a<b)
Expand All @@ -362,7 +363,7 @@ try {
{
if (cmp==0)
{
#ifdef _TESTING
#ifdef VALIDATE_KEY_BOUNDARIES
a = m;
while ((a<n)&&(keyCompare(m,a)==0))
a++;
Expand All @@ -371,7 +372,7 @@ try {
#endif
while ((m>0)&&(keyCompare(m-1,m)==0))
m--;
#ifdef _TESTING
#ifdef VALIDATE_KEY_BOUNDARIES
if (m>0)
assertex(keyRowCompare((unsigned)m-1,row)<0);
#endif
Expand All @@ -382,7 +383,7 @@ try {
a = m+1;
}
}
#ifdef _TESTING
#ifdef VALIDATE_KEY_BOUNDARIES
if (lt)
{
if (a<n)
Expand Down Expand Up @@ -417,7 +418,7 @@ catch (IException *e)
DBGLOG("a=%d, b=%d, cmp=%d",a,b,cmp);
throw;
}
#endif
#endif // VALIDATE_KEY_BOUNDARIES
while (lt&&a&&(keyRowCompare((unsigned)a-1,row)==0))
a--;
return a-1;
Expand Down
1 change: 0 additions & 1 deletion thorlcr/thorutil/thmem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#include "thmem.hpp"

#ifdef _DEBUG
//#define _TESTING
#define ASSERTEX(c) assertex(c)
#else
#define ASSERTEX(c)
Expand Down

0 comments on commit 1358662

Please sign in to comment.