From: Dmitry Kurochkin Date: Tue, 21 Jun 2011 23:44:03 +0000 (+0400) Subject: Fix make check and make distcheck. X-Git-Tag: take07~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d5d5493b580fb565ede89e4f5b9ef727403b7e40;p=thirdparty%2Fsquid.git Fix make check and make distcheck. Mostly makefile changes. New stub code added and some unneeded stub code removed. Fixed for UFS and COSS tests related to object destruction order. --- diff --git a/src/Makefile.am b/src/Makefile.am index 38693cf1ca..c7e2da4b71 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1048,6 +1048,7 @@ tests_testHttpReply_SOURCES=\ SquidString.h \ SquidTime.h \ String.cc \ + tests/stub_cache_cf.cc \ tests/stub_cache_manager.cc \ tests/stub_debug.cc \ tests/stub_HelperChildConfig.cc \ @@ -1056,7 +1057,8 @@ tests_testHttpReply_SOURCES=\ tests/testHttpReply.cc \ tests/testHttpReply.h \ tests/testMain.cc \ - time.cc + time.cc \ + wordlist.cc nodist_tests_testHttpReply_SOURCES=\ $(TESTSOURCES) tests_testHttpReply_LDFLAGS = $(LIBADD_DL) @@ -1148,10 +1150,12 @@ tests_testACLMaxUserIP_SOURCES= \ tests/stub_fd.cc \ tests/stub_HttpRequest.cc \ tests/stub_MemObject.cc \ + tests/stub_MemStore.cc \ tests/stub_mime.cc \ tests/stub_store.cc \ tests/stub_store_rebuild.cc \ tests/stub_store_swapout.cc \ + tests/stub_tools.cc \ tests/stub_cache_manager.cc \ tests/testACLMaxUserIP.cc \ tests/testACLMaxUserIP.h \ @@ -1182,6 +1186,7 @@ tests_testACLMaxUserIP_LDADD= \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ + $(DISK_OS_LIBS) \ $(REGEXLIB) \ $(SQUID_CPPUNIT_LIBS) \ $(SSLLIB) \ @@ -1363,6 +1368,7 @@ tests_testCacheManager_LDADD = \ icmp/libicmp.la icmp/libicmp-core.la \ log/liblog.la \ $(REPL_OBJS) \ + $(DISK_OS_LIBS) \ $(ADAPTATION_LIBS) \ $(ESI_LIBS) \ $(SSL_LIBS) \ @@ -1452,12 +1458,12 @@ tests_testDiskIO_SOURCES = \ tests/stub_HttpRequest.cc \ tests/stub_http.cc \ tests/stub_internal.cc \ + tests/stub_MemStore.cc \ tests/stub_mime.cc \ tests/stub_Port.cc \ tests/stub_store_client.cc \ tests/stub_store_rebuild.cc \ tests/stub_tools.cc \ - tests/stub_TypedMsgHdr.cc \ tests/stub_UdsOp.cc \ tests/testDiskIO.cc \ tests/testDiskIO.h \ @@ -1487,7 +1493,6 @@ tests_testDiskIO_LDADD = \ eui/libeui.la \ acl/libstate.la \ $(AUTH_LIBS) \ - base/libbase.la \ libsquid.la \ ip/libip.la \ fs/libfs.la \ @@ -1496,6 +1501,8 @@ tests_testDiskIO_LDADD = \ $(DISK_OS_LIBS) \ acl/libapi.la \ mgr/libmgr.la \ + ipc/libipc.la \ + base/libbase.la \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ @@ -1639,7 +1646,7 @@ tests_testEvent_SOURCES = \ time.cc \ tools.cc \ tunnel.cc \ - SwapDir.cc MemStore.cc \ + MemStore.cc \ url.cc \ URLScheme.cc \ urn.cc \ @@ -1675,6 +1682,7 @@ tests_testEvent_LDADD = \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ + $(DISK_OS_LIBS) \ $(REGEXLIB) \ $(SQUID_CPPUNIT_LIBS) \ $(SQUID_CPPUNIT_LA) \ @@ -1814,7 +1822,7 @@ tests_testEventLoop_SOURCES = \ time.cc \ tools.cc \ tunnel.cc \ - SwapDir.cc MemStore.cc \ + MemStore.cc \ url.cc \ URLScheme.cc \ urn.cc \ @@ -1850,6 +1858,7 @@ tests_testEventLoop_LDADD = \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ + $(DISK_OS_LIBS) \ $(REGEXLIB) \ $(SQUID_CPPUNIT_LIBS) \ $(SQUID_CPPUNIT_LA) \ @@ -1981,6 +1990,7 @@ tests_test_http_range_SOURCES = \ tests/test_http_range.cc \ tests/stub_ipc_Forwarder.cc \ tests/stub_main_cc.cc \ + tests/stub_MemStore.cc \ time.cc \ tools.cc \ tunnel.cc \ @@ -2193,6 +2203,7 @@ tests_testHttpRequest_LDADD = \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ + $(DISK_OS_LIBS) \ $(REGEXLIB) \ $(SQUID_CPPUNIT_LIBS) \ $(SQUID_CPPUNIT_LA) \ @@ -2274,13 +2285,13 @@ tests_testStore_SOURCES= \ tests/stub_HttpReply.cc \ tests/stub_HttpRequest.cc \ tests/stub_MemObject.cc \ + tests/stub_MemStore.cc \ tests/stub_mime.cc \ tests/stub_Port.cc \ tests/stub_store_client.cc \ tests/stub_store_rebuild.cc \ tests/stub_store_swapout.cc \ tests/stub_tools.cc \ - tests/stub_TypedMsgHdr.cc \ tests/stub_UdsOp.cc \ tests/testMain.cc \ tests/testStore.cc \ @@ -2318,8 +2329,8 @@ tests_testStore_LDADD= \ libsquid.la \ ip/libip.la \ fs/libfs.la \ - ipc/libipc.la \ mgr/libmgr.la \ + ipc/libipc.la \ anyp/libanyp.la \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ @@ -2341,14 +2352,17 @@ tests_testStore_DEPENDENCIES = \ tests_testString_SOURCES = \ ClientInfo.h \ mem.cc \ + MemBuf.cc \ String.cc \ tests/testMain.cc \ tests/testString.cc \ tests/testString.h \ + tests/stub_cache_cf.cc \ tests/stub_cache_manager.cc \ tests/stub_debug.cc \ tests/stub_HelperChildConfig.cc \ - time.cc + time.cc \ + wordlist.cc nodist_tests_testString_SOURCES = \ $(TESTSOURCES) tests_testString_LDADD = \ @@ -2390,8 +2404,8 @@ tests_testUfs_SOURCES = \ tests/testUfs.h \ tests/stub_cache_manager.cc \ tests/stub_HelperChildConfig.cc \ + tests/stub_MemStore.cc \ tests/stub_Port.cc \ - tests/stub_TypedMsgHdr.cc \ tests/stub_UdsOp.cc \ tests/stub_internal.cc \ tests/stub_CommIO.cc \ @@ -2490,16 +2504,16 @@ tests_testUfs_LDADD = \ acl/libstate.la \ $(AUTH_LIBS) \ acl/libapi.la \ - base/libbase.la \ libsquid.la \ ip/libip.la \ fs/libfs.la \ - ipc/libipc.la \ mgr/libmgr.la \ $(REPL_OBJS) \ $(DISK_LIBS) \ $(DISK_OS_LIBS) \ acl/libapi.la \ + ipc/libipc.la \ + base/libbase.la \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ @@ -2513,26 +2527,92 @@ tests_testUfs_DEPENDENCIES = \ $(SWAP_TEST_DS) tests_testRock_SOURCES = \ + cbdata.cc \ + ConfigOption.cc \ + ConfigParser.cc \ + disk.cc \ + ETag.cc \ + event.cc \ + fd.cc \ + HttpHdrCc.cc \ + HttpHdrContRange.cc \ + HttpHdrRange.cc \ + HttpHdrSc.cc \ + HttpHdrScTarget.cc \ + HttpHeader.cc \ + HttpHeaderTools.cc \ + HttpMsg.cc \ + HttpRequestMethod.cc \ + int.cc \ + mem.cc \ + MemBuf.cc \ + MemObject.cc \ + mem_node.cc \ + Packer.cc \ + Parsing.cc \ + StatHist.cc \ + stmem.cc \ + store.cc \ + StoreIOState.cc \ + StoreMeta.cc \ + StoreMetaMD5.cc \ + StoreMetaSTD.cc \ + StoreMetaSTDLFS.cc \ + StoreMetaURL.cc \ + StoreMetaUnpacker.cc \ + StoreMetaVary.cc \ + store_dir.cc \ + store_io.cc \ + store_key_md5.cc \ + store_swapmeta.cc \ + store_swapout.cc \ + String.cc \ + SwapDir.cc \ tests/testRock.cc \ tests/testMain.cc \ tests/testRock.h \ + tests/stub_access_log.cc \ + tests/stub_cache_cf.cc \ tests/stub_cache_manager.cc \ + tests/stub_comm.cc \ + tests/stub_CommIO.cc \ + tests/stub_debug.cc \ + tests/stub_errorpage.cc \ tests/stub_HelperChildConfig.cc \ + tests/stub_http.cc \ + tests/stub_HttpReply.cc \ + tests/stub_HttpRequest.cc \ + tests/stub_MemStore.cc \ + tests/stub_mime.cc \ tests/stub_Port.cc \ - tests/stub_TypedMsgHdr.cc \ + tests/stub_store_client.cc \ + tests/stub_tools.cc \ tests/stub_UdsOp.cc \ - $(SWAP_TEST_SOURCES) + time.cc \ + url.cc \ + URLScheme.cc \ + wordlist.cc nodist_tests_testRock_SOURCES = \ swap_log_op.cc \ - $(SWAP_TEST_GEN_SOURCES) \ SquidMath.cc \ - SquidMath.h + SquidMath.h \ + $(TESTSOURCES) tests_testRock_LDADD = \ + anyp/libanyp.la \ + libsquid.la \ + ip/libip.la \ + $(AUTH_LIBS) \ $(COMMON_LIBS) \ $(REPL_OBJS) \ $(DISK_LIBS) \ $(DISK_OS_LIBS) \ + acl/libacls.la \ acl/libapi.la \ + acl/libstate.la \ + eui/libeui.la \ + mgr/libmgr.la \ + ipc/libipc.la \ + base/libbase.la \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ @@ -2599,7 +2679,6 @@ tests_testCoss_SOURCES = \ cbdata.cc \ String.cc \ tests/stub_comm.cc \ - tests/stub_debug.cc \ tests/stub_client_side_request.cc \ tests/stub_http.cc \ mem_node.cc \ @@ -2623,8 +2702,11 @@ tests_testCoss_SOURCES = \ tests/stub_HttpRequest.cc \ tests/stub_access_log.cc \ refresh.cc \ + tests/stub_MemStore.cc \ + tests/stub_Port.cc \ tests/stub_store_client.cc \ tests/stub_tools.cc \ + tests/stub_UdsOp.cc \ tests/testStoreSupport.cc \ tests/testStoreSupport.h \ time.cc \ @@ -2639,6 +2721,7 @@ nodist_tests_testCoss_SOURCES = \ $(TESTSOURCES) \ $(DISKIO_GEN_SOURCE) tests_testCoss_LDADD = \ + anyp/libanyp.la \ libsquid.la \ $(REGEXLIB) \ $(AUTH_ACL_LIBS) \ @@ -2648,16 +2731,16 @@ tests_testCoss_LDADD = \ acl/libstate.la \ $(AUTH_LIBS) \ acl/libapi.la \ - base/libbase.la \ libsquid.la \ ip/libip.la \ fs/libfs.la \ - ipc/libipc.la \ mgr/libmgr.la \ $(REPL_OBJS) \ $(DISK_LIBS) \ $(DISK_OS_LIBS) \ acl/libapi.la \ + ipc/libipc.la \ + base/libbase.la \ $(top_builddir)/lib/libmisccontainers.la \ $(top_builddir)/lib/libmiscencoding.la \ $(top_builddir)/lib/libmiscutil.la \ @@ -2946,6 +3029,7 @@ tests_testURL_LDADD = \ icmp/libicmp.la icmp/libicmp-core.la \ comm/libcomm.la \ log/liblog.la \ + $(DISK_OS_LIBS) \ $(REGEXLIB) \ $(REPL_OBJS) \ $(ADAPTATION_LIBS) \ diff --git a/src/ipc/Queue.h b/src/ipc/Queue.h index f87259c064..7d5fdf2086 100644 --- a/src/ipc/Queue.h +++ b/src/ipc/Queue.h @@ -7,6 +7,7 @@ #define SQUID_IPC_QUEUE_H #include "Array.h" +#include "Debug.h" #include "base/InstanceId.h" #include "ipc/AtomicWord.h" #include "ipc/mem/Pointer.h" diff --git a/src/tests/TestSwapDir.cc b/src/tests/TestSwapDir.cc index 85b3fdc1a3..0394a8ca41 100644 --- a/src/tests/TestSwapDir.cc +++ b/src/tests/TestSwapDir.cc @@ -9,6 +9,18 @@ TestSwapDir::maxSize() const return 3; } +uint64_t +TestSwapDir::currentSize() const +{ + return 2; +} + +uint64_t +TestSwapDir::currentCount() const +{ + return 2; +} + void TestSwapDir::stat(StoreEntry &) const { diff --git a/src/tests/TestSwapDir.h b/src/tests/TestSwapDir.h index 35b049c419..0908d1d336 100644 --- a/src/tests/TestSwapDir.h +++ b/src/tests/TestSwapDir.h @@ -13,7 +13,10 @@ public: bool statsCalled; virtual uint64_t maxSize() const; + virtual uint64_t currentSize() const; + virtual uint64_t currentCount() const; virtual void stat(StoreEntry &) const; /* output stats to the provided store entry */ + virtual void swappedOut(const StoreEntry &e) {} virtual void reconfigure(int, char*); virtual void init(); diff --git a/src/tests/stub_HttpReply.cc b/src/tests/stub_HttpReply.cc index 87a048ffb6..3bc7b88da9 100644 --- a/src/tests/stub_HttpReply.cc +++ b/src/tests/stub_HttpReply.cc @@ -122,3 +122,10 @@ HttpReply::inheritProperties(const HttpMsg *aMsg) fatal("Not implemented"); return false; } + +int64_t +HttpReply::bodySize(const HttpRequestMethod&) const +{ + fatal("Not implemented"); + return 0; +} diff --git a/src/tests/stub_HttpRequest.cc b/src/tests/stub_HttpRequest.cc index 51b97f7805..cc16b0cf76 100644 --- a/src/tests/stub_HttpRequest.cc +++ b/src/tests/stub_HttpRequest.cc @@ -108,6 +108,13 @@ HttpRequest::inheritProperties(const HttpMsg *aMsg) return false; } +int64_t +HttpRequest::getRangeOffsetLimit() +{ + fatal("Not implemented"); + return 0; +} + /* * DO NOT MODIFY: * arch-tag: dd894aa8-63cc-4543-92d9-1079a18bee11 diff --git a/src/tests/stub_MemObject.cc b/src/tests/stub_MemObject.cc index c3dc018308..c2620b45c5 100644 --- a/src/tests/stub_MemObject.cc +++ b/src/tests/stub_MemObject.cc @@ -179,3 +179,22 @@ MemObject::isContiguous() const fatal ("MemObject.cc required."); return false; } + +int64_t +MemObject::expectedReplySize() const +{ + fatal ("MemObject.cc required."); + return 0; +} + +void +MemObject::resetUrls(char const*, char const*) +{ + fatal ("MemObject.cc required."); +} + +void +MemObject::markEndOfReplyHeaders() +{ + fatal ("MemObject.cc required."); +} diff --git a/src/tests/stub_MemStore.cc b/src/tests/stub_MemStore.cc new file mode 100644 index 0000000000..67de39a5ec --- /dev/null +++ b/src/tests/stub_MemStore.cc @@ -0,0 +1,76 @@ +/* + * $Id$ + * + * DEBUG: section 84 Helper process maintenance + * + */ + +#include "config.h" +#include "MemStore.h" + +#define STUB_API "MemStore.cc" +#include "tests/STUB.h" + +MemStore::MemStore() STUB +MemStore::~MemStore() STUB +void MemStore::considerKeeping(StoreEntry &) STUB +void MemStore::reference(StoreEntry &) STUB +void MemStore::maintain() STUB +void MemStore::cleanReadable(const sfileno) STUB +void MemStore::get(String const, STOREGETCLIENT, void *) STUB +void MemStore::init() STUB +void MemStore::stat(StoreEntry &) const STUB + +int MemStore::callback() +{ + STUB + return 0; +} + +StoreEntry *MemStore::get(const cache_key *) +{ + STUB + return NULL; +} + +uint64_t MemStore::maxSize() const +{ + STUB + return 0; +} + +uint64_t MemStore::minSize() const +{ + STUB + return 0; +} + +uint64_t MemStore::currentSize() const +{ + STUB + return 0; +} + +uint64_t MemStore::currentCount() const +{ + STUB + return 0; +} + +int64_t MemStore::maxObjectSize() const +{ + STUB + return 0; +} + +StoreSearch *MemStore::search(String const, HttpRequest *) +{ + STUB + return NULL; +} + +bool MemStore::dereference(StoreEntry &) +{ + STUB + return false; +} diff --git a/src/tests/stub_Port.cc b/src/tests/stub_Port.cc index 478ce74443..4ac50e6259 100644 --- a/src/tests/stub_Port.cc +++ b/src/tests/stub_Port.cc @@ -1,4 +1,14 @@ #include "config.h" #include "ipc/Port.h" +#define STUB_API "ipc/Port.cc" +#include "tests/STUB.h" + const char Ipc::coordinatorAddr[] = ""; +const char Ipc::strandAddrPfx[] = ""; + +String Ipc::Port::MakeAddr(char const*, int) +{ + STUB + return ""; +} diff --git a/src/tests/stub_TypedMsgHdr.cc b/src/tests/stub_TypedMsgHdr.cc deleted file mode 100644 index 52fc5c956d..0000000000 --- a/src/tests/stub_TypedMsgHdr.cc +++ /dev/null @@ -1,44 +0,0 @@ -#include "config.h" -#include "fatal.h" -#include "ipc/TypedMsgHdr.h" - -Ipc::TypedMsgHdr::TypedMsgHdr() -{ - fatal("Not implemented"); -} - -void -Ipc::TypedMsgHdr::getFixed(void *raw, size_t size) const -{ - fatal("Not implemented"); -} - -void -Ipc::TypedMsgHdr::putFixed(const void *raw, size_t size) -{ - fatal("Not implemented"); -} - -void -Ipc::TypedMsgHdr::getString(String &size) const -{ - fatal("Not implemented"); -} - -void -Ipc::TypedMsgHdr::putString(const String & size) -{ - fatal("Not implemented"); -} - -void -Ipc::TypedMsgHdr::checkType(int destType) const -{ - fatal("Not implemented"); -} - -void -Ipc::TypedMsgHdr::setType(int aType) -{ - fatal("Not implemented"); -} diff --git a/src/tests/stub_cache_cf.cc b/src/tests/stub_cache_cf.cc index 9c3e7fb7ca..5407b32b91 100644 --- a/src/tests/stub_cache_cf.cc +++ b/src/tests/stub_cache_cf.cc @@ -115,6 +115,17 @@ dump_acl_access(StoreEntry * entry, const char *name, acl_access * head) fatal("not implemented 11"); } +YesNoNone::YesNoNone() +{ + /* ignore this for testing */ +} + +YesNoNone::operator void*() const +{ + /* ignore this for testing */ + return NULL; +} + /* * DO NOT MODIFY: * arch-tag: 9bbc3b5f-8d7b-4fdc-af59-0b524a785307 diff --git a/src/tests/stub_store.cc b/src/tests/stub_store.cc index 8a186e4bff..77c9f1006c 100644 --- a/src/tests/stub_store.cc +++ b/src/tests/stub_store.cc @@ -17,6 +17,7 @@ bool StoreEntry::checkDeferRead(int fd) const STUB_RETVAL(false) const char *StoreEntry::getMD5Text() const STUB_RETVAL(NULL) StoreEntry::StoreEntry() STUB StoreEntry::StoreEntry(const char *url, const char *log_url) STUB +StoreEntry::~StoreEntry() STUB HttpReply const *StoreEntry::getReply() const STUB_RETVAL(NULL) void StoreEntry::write(StoreIOBuffer) STUB bool StoreEntry::isAccepting() const STUB_RETVAL(false) @@ -104,6 +105,12 @@ void Store::diskFull() STUB void Store::sync() STUB void Store::unlink(StoreEntry &) STUB +std::ostream &operator <<(std::ostream &os, const StoreEntry &) +{ + STUB + return os; +} + SQUIDCEXTERN size_t storeEntryInUse() STUB_RETVAL(0) SQUIDCEXTERN const char *storeEntryFlags(const StoreEntry *) STUB_RETVAL(NULL) void storeEntryReplaceObject(StoreEntry *, HttpReply *) STUB diff --git a/src/tests/stub_store_rebuild.cc b/src/tests/stub_store_rebuild.cc index 983e00907d..ba9ad4f6ef 100644 --- a/src/tests/stub_store_rebuild.cc +++ b/src/tests/stub_store_rebuild.cc @@ -46,8 +46,7 @@ storeRebuildComplete(struct _store_rebuild_data *dc) {} bool -storeRebuildLoadEntry(MemBuf &buf, StoreEntry &e, cache_key *key, - struct _store_rebuild_data &counts, uint64_t expectedSize) +storeRebuildLoadEntry(int, int, MemBuf&, _store_rebuild_data&) { return false; } @@ -58,3 +57,9 @@ storeRebuildKeepEntry(const StoreEntry &tmpe, const cache_key *key, { return false; } + +bool +storeRebuildParseEntry(MemBuf &, StoreEntry &, cache_key *, struct _store_rebuild_data &, uint64_t) +{ + return false; +} diff --git a/src/tests/stub_tools.cc b/src/tests/stub_tools.cc index 95537ed940..d9d20d61cb 100644 --- a/src/tests/stub_tools.cc +++ b/src/tests/stub_tools.cc @@ -54,3 +54,31 @@ xmemset(void* dst, int val, size_t sz) assert(dst); return memset(dst, val, sz); } + +bool +IamWorkerProcess() +{ + fprintf(stderr, "Not implemented"); + return true; +} + +bool +IamDiskProcess() +{ + fprintf(stderr, "Not implemented"); + return false; +} + +bool +IamMasterProcess() +{ + fprintf(stderr, "Not implemented"); + return false; +} + +bool +UsingSmp() +{ + fprintf(stderr, "Not implemented"); + return false; +} diff --git a/src/tests/testCoss.cc b/src/tests/testCoss.cc index 3e1b07a46d..1296441066 100644 --- a/src/tests/testCoss.cc +++ b/src/tests/testCoss.cc @@ -80,9 +80,7 @@ testCoss::testCossCreate() if (0 > system ("rm -rf " TESTDIR)) throw std::runtime_error("Failed to clean test work directory"); - StorePointer aRoot (new StoreController); - - Store::Root(aRoot); + Store::Root(new StoreController); SwapDirPointer aStore (new CossSwapDir()); @@ -111,10 +109,10 @@ testCoss::testCossCreate() /* TODO: check the size */ - free_cachedir(&Config.cacheSwap); - Store::Root(NULL); + free_cachedir(&Config.cacheSwap); + /* todo: here we should test a dirty rebuild */ // safe_free(Config.replPolicy->type); @@ -146,9 +144,7 @@ testCoss::testCossSearch() if (0 > system ("rm -rf " TESTDIR)) throw std::runtime_error("Failed to clean test work directory"); - StorePointer aRoot (new StoreController); - - Store::Root(aRoot); + Store::Root(new StoreController); SwapDirPointer aStore (new CossSwapDir()); @@ -257,10 +253,10 @@ testCoss::testCossSearch() CPPUNIT_ASSERT(search->isDone() == true); CPPUNIT_ASSERT(search->currentItem() == NULL); - free_cachedir(&Config.cacheSwap); - Store::Root(NULL); + free_cachedir(&Config.cacheSwap); + /* todo: here we should test a dirty rebuild */ //TODO: do this once, or each time. safe_free(Config.replPolicy->type); @@ -280,8 +276,7 @@ testCoss::testDefaultEngine() if (0 > system ("rm -rf " TESTDIR)) throw std::runtime_error("Failed to clean test work directory"); - StorePointer aRoot (new StoreController); - Store::Root(aRoot); + Store::Root(new StoreController); SwapDirPointer aStore (new CossSwapDir()); addSwapDir(aStore); commonInit(); @@ -294,8 +289,8 @@ testCoss::testDefaultEngine() safe_free(config_line); CPPUNIT_ASSERT(aStore->io != NULL); - free_cachedir(&Config.cacheSwap); Store::Root(NULL); + free_cachedir(&Config.cacheSwap); if (0 > system ("rm -rf " TESTDIR)) throw std::runtime_error("Failed to clean test work directory"); } diff --git a/src/tests/testStore.cc b/src/tests/testStore.cc index 6e76cf159c..0382776fe6 100644 --- a/src/tests/testStore.cc +++ b/src/tests/testStore.cc @@ -39,6 +39,24 @@ TestStore::minSize() const return 1; } +uint64_t +TestStore::currentSize() const +{ + return 2; +} + +uint64_t +TestStore::currentCount() const +{ + return 2; +} + +int64_t +TestStore::maxObjectSize() const +{ + return 1; +} + void TestStore::stat(StoreEntry &) const { diff --git a/src/tests/testStore.h b/src/tests/testStore.h index a0c65fa476..9a60e75347 100644 --- a/src/tests/testStore.h +++ b/src/tests/testStore.h @@ -59,6 +59,12 @@ public: virtual uint64_t minSize() const; + virtual uint64_t currentSize() const; + + virtual uint64_t currentCount() const; + + virtual int64_t maxObjectSize() const; + virtual void stat(StoreEntry &) const; /* output stats to the provided store entry */ virtual void reference(StoreEntry &) {} /* Reference this object */ diff --git a/src/tests/testUfs.cc b/src/tests/testUfs.cc index 8b5b072853..654b22c5c4 100644 --- a/src/tests/testUfs.cc +++ b/src/tests/testUfs.cc @@ -87,9 +87,7 @@ testUfs::testUfsSearch() if (0 > system ("rm -rf " TESTDIR)) throw std::runtime_error("Failed to clean test work directory"); - StorePointer aRoot (new StoreController); - - Store::Root(aRoot); + Store::Root(new StoreController); SwapDirPointer aStore (new UFSSwapDir("ufs", "Blocking")); @@ -205,11 +203,12 @@ testUfs::testUfsSearch() CPPUNIT_ASSERT(search->isDone() == true); CPPUNIT_ASSERT(search->currentItem() == NULL); + Store::Root(NULL); + free_cachedir(&Config.cacheSwap); /* todo: here we should test a dirty rebuild */ - Store::Root(NULL); safe_free(Config.replPolicy->type); delete Config.replPolicy; @@ -232,8 +231,7 @@ testUfs::testUfsDefaultEngine() // objects such as "StorePointer aRoot" from being called. CPPUNIT_ASSERT(!store_table); // or StoreHashIndex ctor will abort below - StorePointer aRoot (new StoreController); - Store::Root(aRoot); + Store::Root(new StoreController); SwapDirPointer aStore (new UFSSwapDir("ufs", "Blocking")); addSwapDir(aStore); commonInit(); @@ -249,8 +247,8 @@ testUfs::testUfsDefaultEngine() safe_free(config_line); CPPUNIT_ASSERT(aStore->IO->io != NULL); - free_cachedir(&Config.cacheSwap); Store::Root(NULL); + free_cachedir(&Config.cacheSwap); safe_free(Config.replPolicy->type); delete Config.replPolicy;