From: Amos Jeffries Date: Thu, 1 Nov 2012 10:31:28 +0000 (+1300) Subject: Portability: Move testRefCount to src/ X-Git-Tag: SQUID_3_4_0_1~534 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e35d7a779c709e19a2608bfefec75074b435333d;p=thirdparty%2Fsquid.git Portability: Move testRefCount to src/ It seems the automake dependencies on stub_*.o are still not working well and ICC requires several stubs in order to link libbase.la. This also adds new stubs for MemBuf.h and cbdata.h APIs. --- diff --git a/src/Makefile.am b/src/Makefile.am index 6da7b724e9..6db06c5364 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3210,6 +3210,20 @@ tests_testUfs_LDFLAGS = $(LIBADD_DL) tests_testUfs_DEPENDENCIES = \ $(SWAP_TEST_DS) +check_PROGRAMS += testRefCount +testRefCount_SOURCES= \ + base/Lock.h \ + base/RefCount.h \ + tests/stub_cbdata.cc \ + tests/stub_debug.cc \ + tests/stub_MemBuf.cc \ + tests/testRefCount.cc +testRefCount_LDADD = \ + base/libbase.la \ + $(top_builddir)/lib/libmiscutil.la \ + $(COMPAT_LIB) \ + $(XTRA_LIBS) + tests_testRock_SOURCES = \ cbdata.cc \ CacheDigest.h \ diff --git a/src/base/Makefile.am b/src/base/Makefile.am index 38e4f3b143..f774d22f30 100644 --- a/src/base/Makefile.am +++ b/src/base/Makefile.am @@ -1,4 +1,3 @@ - include $(top_srcdir)/src/Common.am include $(top_srcdir)/src/TestHeaders.am @@ -23,17 +22,3 @@ libbase_la_SOURCES = \ TextException.cc \ TextException.h \ StringArea.h - -check_PROGRAMS += testRefCount - -testRefCount_SOURCES= \ - Lock.h \ - RefCount.h \ - testRefCount.cc - -testRefCount_LDADD = \ - libbase.la \ - $(top_builddir)/lib/libmiscutil.la \ - $(COMPAT_LIB) \ - $(XTRA_LIBS) - diff --git a/src/tests/stub_MemBuf.cc b/src/tests/stub_MemBuf.cc new file mode 100644 index 0000000000..521fe324af --- /dev/null +++ b/src/tests/stub_MemBuf.cc @@ -0,0 +1,28 @@ +#include "squid.h" +#include "MemBuf.h" + +#define STUB_API "MemBuf.cc" +#include "tests/STUB.h" + +mb_size_t MemBuf::spaceSize() const STUB_RETVAL(0) +mb_size_t MemBuf::potentialSpaceSize() const STUB_RETVAL(0) +void MemBuf::consume(mb_size_t sz) STUB +void MemBuf::append(const char *c, mb_size_t sz) STUB +void MemBuf::appended(mb_size_t sz) STUB +void MemBuf::truncate(mb_size_t sz) STUB +void MemBuf::terminate() STUB +void MemBuf::init(mb_size_t szInit, mb_size_t szMax) STUB +void MemBuf::init() STUB +void MemBuf::clean() STUB +void MemBuf::reset() STUB +int MemBuf::isNull() STUB_RETVAL(1) +void MemBuf::Printf(const char *fmt,...) STUB +void MemBuf::vPrintf(const char *fmt, va_list ap) STUB +FREE *MemBuf::freeFunc() STUB_RETVAL(NULL) + +#if !_USE_INLINE_ +#include "MemBuf.cci" +#endif + +void memBufReport(MemBuf * mb) STUB +void packerToMemInit(Packer * p, MemBuf * mb) STUB diff --git a/src/tests/stub_cbdata.cc b/src/tests/stub_cbdata.cc new file mode 100644 index 0000000000..c4eaec13db --- /dev/null +++ b/src/tests/stub_cbdata.cc @@ -0,0 +1,24 @@ +#include "squid.h" +#include "cbdata.h" + +#define STUB_API "cbdata.cc" +#include "tests/STUB.h" + +void cbdataRegisterWithCacheManager(void) STUB + +#if USE_CBDATA_DEBUG +void *cbdataInternalAllocDbg(cbdata_type type, const char *, int) STUB_RETVAL(NULL) +void *cbdataInternalFreeDbg(void *p, const char *, int) STUB_RETVAL(NULL) +void cbdataInternalLockDbg(const void *p, const char *, int) STUB +void cbdataInternalUnlockDbg(const void *p, const char *, int) STUB +int cbdataInternalReferenceDoneValidDbg(void **p, void **tp, const char *, int) STUB_RETVAL(0) +#else +void *cbdataInternalAlloc(cbdata_type type) STUB_RETVAL(NULL) +void *cbdataInternalFree(void *p) STUB_RETVAL(NULL) +void cbdataInternalLock(const void *p) STUB +void cbdataInternalUnlock(const void *p) STUB +int cbdataInternalReferenceDoneValid(void **p, void **tp) STUB_RETVAL(0) +#endif + +int cbdataReferenceValid(const void *p) STUB_RETVAL(0) +cbdata_type cbdataInternalAddType(cbdata_type type, const char *label, int size, FREE * free_func) STUB_RETVAL(CBDATA_UNKNOWN) diff --git a/src/base/testRefCount.cc b/src/tests/testRefCount.cc similarity index 100% rename from src/base/testRefCount.cc rename to src/tests/testRefCount.cc