From: Amos Jeffries Date: Sat, 7 Jan 2012 10:15:40 +0000 (-0700) Subject: Cleanup: update most of the existing stub files to use the STUB.h framework X-Git-Tag: BumpSslServerFirst.take05~12^2~89 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=081edc2de252e852d0a8e02891fb36d7919a92ef;p=thirdparty%2Fsquid.git Cleanup: update most of the existing stub files to use the STUB.h framework There are still several sections to be done. Including adding library API stubs. However these are the ones which can be done immediately without breaking or re-writing existing unit tests. --- diff --git a/src/Makefile.am b/src/Makefile.am index 9e8e299ccc..0a2b397eb2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1091,6 +1091,7 @@ tests_testHttpReply_SOURCES=\ tests/stub_StatHist.cc \ tests/stub_store.cc \ tests/stub_store_stats.cc \ + tests/stub_tools.cc \ tests/testHttpReply.cc \ tests/testHttpReply.h \ tests/testMain.cc \ @@ -2186,6 +2187,7 @@ tests_testHttpParser_SOURCES = \ tests/stub_debug.cc \ tests/stub_event.cc \ tests/stub_HelperChildConfig.cc \ + tests/stub_tools.cc \ tests/testHttpParser.cc \ tests/testHttpParser.h \ tests/testMain.cc \ @@ -2426,6 +2428,7 @@ tests_testStore_SOURCES= \ mem.cc \ mem_node.cc \ MemBuf.cc \ + MemObject.cc \ Packer.cc \ Parsing.cc \ RemovalPolicy.cc \ @@ -2470,7 +2473,6 @@ tests_testStore_SOURCES= \ tests/stub_HttpReply.cc \ tests/stub_HttpRequest.cc \ tests/stub_libcomm.cc \ - tests/stub_MemObject.cc \ tests/stub_MemStore.cc \ tests/stub_mime.cc \ tests/stub_Port.cc \ @@ -2548,6 +2550,7 @@ tests_testString_SOURCES = \ tests/stub_cache_manager.cc \ tests/stub_debug.cc \ tests/stub_HelperChildConfig.cc \ + tests/stub_tools.cc \ time.cc \ wordlist.cc nodist_tests_testString_SOURCES = \ @@ -2811,7 +2814,6 @@ tests_testRock_SOURCES = \ tests/stub_store_rebuild.cc \ tests/stub_store_stats.cc \ tests/stub_tools.cc \ - tests/stub_UdsOp.cc \ time.cc \ url.cc \ URLScheme.cc \ @@ -2852,7 +2854,7 @@ tests_testRock_LDADD = \ $(SSLLIB) \ $(COMPAT_LIB) \ $(XTRA_LIBS) -tests_testRock_LDFLAGS = $(LIBADD_DL) +tests_testRock_LDFLAGS = $(INCLUDES) $(LIBADD_DL) tests_testRock_DEPENDENCIES = \ $(SWAP_TEST_DS) @@ -3330,6 +3332,7 @@ tests_testConfigParser_SOURCES = \ tests/stub_cache_manager.cc \ tests/stub_debug.cc \ tests/stub_HelperChildConfig.cc \ + tests/stub_tools.cc \ time.cc \ wordlist.cc nodist_tests_testConfigParser_SOURCES = \ diff --git a/src/ip/Makefile.am b/src/ip/Makefile.am index 17b8823e19..52dcd01028 100644 --- a/src/ip/Makefile.am +++ b/src/ip/Makefile.am @@ -24,8 +24,8 @@ testIpAddress_SOURCES= \ testAddress.h nodist_testIpAddress_SOURCES= \ $(top_srcdir)/src/tests/stub_debug.cc \ - $(top_srcdir)/src/tests/testMain.cc \ - $(top_srcdir)/test-suite/test_tools.cc + $(top_srcdir)/src/tests/stub_tools.cc \ + $(top_srcdir)/src/tests/testMain.cc testIpAddress_LDADD= \ libip.la \ $(XTRA_LIBS) \ diff --git a/src/tests/STUB.h b/src/tests/STUB.h index c669c765ce..67c433b9c7 100644 --- a/src/tests/STUB.h +++ b/src/tests/STUB.h @@ -1,5 +1,4 @@ #ifndef STUB -#include "fatal.h" /** \group STUB * @@ -17,27 +16,35 @@ * #define STUB_API "foo/libexample.la" * #include "tests/STUB.h" */ +#include + +// Internal Special: the STUB framework requires this function +#define stub_fatal(m) { std::cerr<<"FATAL: "<<(m)<<" for use of "<<__FUNCTION__<<"\n"; exit(1); } /// macro to stub a void function. -#define STUB { fatal(STUB_API " required"); } +#define STUB { stub_fatal(STUB_API " required"); } + +/// macro to stub a void function without a fatal message +/// Intended for registration pattern APIs where the function result does not matter to the test +#define STUB_NOP { std::cerr<<"SKIP: "<hdr_sz : 0); - - /* We don't separate out mime headers yet, so ensure that the first - * write is at offset 0 - where they start - */ - assert (data_hdr.endOffset() || writeBuffer.offset == 0); - - assert (data_hdr.write (writeBuffer)); - callback (callbackData, writeBuffer); - PROF_stop(MemObject_write); -} - -void -MemObject::replaceHttpReply(HttpReply *newrep) -{ - fatal ("Not implemented"); -} - -int64_t -MemObject::lowestMemReaderOffset() const -{ - fatal ("Not implemented"); - return 0; -} - -void -MemObject::kickReads() -{ - fatal ("Not implemented"); -} - -int64_t -MemObject::objectBytesOnDisk() const -{ - fatal ("MemObject.cc required."); - return 0; -} - -bool -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."); -} - -size_t -MemObject::inUseCount() -{ - fatal ("MemObject.cc required."); - return 0; -} +void MemObject::unlinkRequest() STUB +void MemObject::write(StoreIOBuffer writeBuffer, STMCB *callback, void *callbackData) STUB +void MemObject::replaceHttpReply(HttpReply *newrep) STUB +int64_t MemObject::lowestMemReaderOffset() const STUB_RETVAL(0) +void MemObject::kickReads() STUB +int64_t MemObject::objectBytesOnDisk() const STUB_RETVAL(0) +bool MemObject::isContiguous() const STUB_RETVAL(false) +int64_t MemObject::expectedReplySize() const STUB_RETVAL(0) +void MemObject::resetUrls(char const*, char const*) STUB +void MemObject::markEndOfReplyHeaders() STUB +size_t MemObject::inUseCount() STUB_RETVAL(0) diff --git a/src/tests/stub_UdsOp.cc b/src/tests/stub_UdsOp.cc index 7e19dd0200..f78dc820cb 100644 --- a/src/tests/stub_UdsOp.cc +++ b/src/tests/stub_UdsOp.cc @@ -1,7 +1,7 @@ #include "config.h" #include "ipc/UdsOp.h" -void Ipc::SendMessage(const String& toAddress, const TypedMsgHdr& message) -{ - fatal ("Not implemented"); -} +#define STUB_API "UdsOp.cc" +#include "tests/STUB.h" + +void Ipc::SendMessage(const String& toAddress, const TypedMsgHdr& message) STUB diff --git a/src/tests/stub_access_log.cc b/src/tests/stub_access_log.cc index ff80596c8a..2c8afff80f 100644 --- a/src/tests/stub_access_log.cc +++ b/src/tests/stub_access_log.cc @@ -1,45 +1,10 @@ -/* - * $Id$ - * - * DEBUG: section 28 Access Control - * AUTHOR: Robert Collins - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - #include "squid.h" #include "HierarchyLogEntry.h" +#define STUB_API "access.log.cc" +#include "tests/STUB.h" -HierarchyLogEntry::HierarchyLogEntry() -{ - fatal("Not implemented."); -} +HierarchyLogEntry::HierarchyLogEntry() STUB ping_data::ping_data() : n_sent(0), diff --git a/src/tests/stub_cache_cf.cc b/src/tests/stub_cache_cf.cc index 39b59995a0..31a91ca52c 100644 --- a/src/tests/stub_cache_cf.cc +++ b/src/tests/stub_cache_cf.cc @@ -36,28 +36,14 @@ #include "ConfigParser.h" #include "wordlist.h" -void -self_destruct(void) -{ - /* fatalf("Bungled %s line %d: %s", - cfg_filename, config_lineno, config_input_line);*/ - fatalf("bungled line"); -} - -void -parse_int(int *var) -{ - fatal("not implemented 1"); -} - -void -parse_onoff(int *var) -{ - fatal("not implemented 2"); -} - -void -parse_eol(char *volatile *var) +#define STUB_API "cache_cf.cc" +#include "tests/STUB.h" + +void self_destruct(void) STUB +void parse_int(int *var) STUB +void parse_onoff(int *var) STUB +void parse_eol(char *volatile *var) STUB +#if 0 { unsigned char *token = (unsigned char *) strtok(NULL, null_string); safe_free(*var); @@ -73,9 +59,10 @@ parse_eol(char *volatile *var) *var = xstrdup((char *) token); } +#endif -void -parse_wordlist(wordlist ** list) +void parse_wordlist(wordlist ** list) STUB +#if 0 { char *token; char *t = strtok(NULL, ""); @@ -83,45 +70,11 @@ parse_wordlist(wordlist ** list) while ((token = strwordtok(NULL, &t))) wordlistAdd(list, token); } - -void -requirePathnameExists(const char *name, const char *path) -{ - /* tee-hee. ignore this for testing */ -} - -void -parse_time_t(time_t * var) -{ - fatal("not implemented 6"); -} - -char * -strtokFile(void) -{ - fatal("not implemented 9"); - return NULL; -} - -void -ConfigParser::ParseUShort(unsigned short *var) -{ - fatal("not implemented 10"); -} - -void -dump_acl_access(StoreEntry * entry, const char *name, acl_access * head) -{ - fatal("not implemented 11"); -} - -YesNoNone::operator void*() const -{ - /* ignore this for testing */ - return NULL; -} - -/* - * DO NOT MODIFY: - * arch-tag: 9bbc3b5f-8d7b-4fdc-af59-0b524a785307 - */ +#endif + +void requirePathnameExists(const char *name, const char *path) STUB_NOP +void parse_time_t(time_t * var) STUB +char * strtokFile(void) STUB_RETVAL(NULL) +void ConfigParser::ParseUShort(unsigned short *var) STUB +void dump_acl_access(StoreEntry * entry, const char *name, acl_access * head) STUB +YesNoNone::operator void*() const { STUB_NOP; return NULL; } diff --git a/src/tests/stub_cache_manager.cc b/src/tests/stub_cache_manager.cc index 07a7bd211a..b286d67dc9 100644 --- a/src/tests/stub_cache_manager.cc +++ b/src/tests/stub_cache_manager.cc @@ -1,68 +1,16 @@ -/* - * AUTHOR: Francesco Chemolli - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - #include "squid.h" #include "CacheManager.h" #include "mgr/Registration.h" -Mgr::Action::Pointer -CacheManager::createNamedAction(char const* action) -{ - fatal("Not implemented"); - return NULL; -} +#define STUB_API "cache_manager.cc" +#include "tests/STUB.h" -void -CacheManager::Start(const Comm::ConnectionPointer &conn, HttpRequest * request, StoreEntry * entry) -{ - return; +Mgr::Action::Pointer CacheManager::createNamedAction(char const* action) STUB_RETVAL(NULL) +void CacheManager::Start(const Comm::ConnectionPointer &conn, HttpRequest * request, StoreEntry * entry) { +std::cerr << HERE << "\n"; +STUB } - CacheManager* CacheManager::instance=0; - -CacheManager* -CacheManager::GetInstance() -{ - fatal("Not implemented"); - return instance; -} - -void -Mgr::RegisterAction(char const*, char const*, OBJH, int, int) -{ -} - -void -Mgr::RegisterAction(char const * action, char const * desc, - Mgr::ClassActionCreationHandler *handler, - int pw_req_flag, int atomic) -{ -} +CacheManager* CacheManager::GetInstance() STUB_RETVAL(instance) +void Mgr::RegisterAction(char const*, char const*, OBJH, int, int) {} +void Mgr::RegisterAction(char const *, char const *, Mgr::ClassActionCreationHandler *, int, int) {} diff --git a/src/tests/stub_client_db.cc b/src/tests/stub_client_db.cc index c2359e84f2..9425c9e2dd 100644 --- a/src/tests/stub_client_db.cc +++ b/src/tests/stub_client_db.cc @@ -2,67 +2,18 @@ /* because the clientdb API is defined in protos.h still */ #include "protos.h" -void -clientdbInit(void) -{ - fatal("client_db.cc required"); -} - -void -clientdbUpdate(const Ip::Address &, log_type, AnyP::ProtocolType, size_t) -{ - fatal("client_db.cc required"); -} - -int -clientdbCutoffDenied(const Ip::Address &) -{ - fatal("client_db.cc required"); - return -1; -} - -void -clientdbDump(StoreEntry *) -{ - fatal("client_db.cc required"); -} - -void -clientdbFreeMemory(void) -{ - fatal("client_db.cc required"); -} - -int -clientdbEstablished(const Ip::Address &, int) -{ - fatal("client_db.cc required"); - return -1; -} - +#define STUB_API "client_db.cc" +#include "tests/STUB.h" + +void clientdbInit(void) STUB +void clientdbUpdate(const Ip::Address &, log_type, AnyP::ProtocolType, size_t) STUB +int clientdbCutoffDenied(const Ip::Address &) STUB_RETVAL(-1) +void clientdbDump(StoreEntry *) STUB +void clientdbFreeMemory(void) STUB +int clientdbEstablished(const Ip::Address &, int) STUB_RETVAL(-1) #if USE_DELAY_POOLS -void -clientdbSetWriteLimiter(ClientInfo * info, const int writeSpeedLimit,const double initialBurst,const double highWatermark) -{ - fatal("client_db.cc required"); -} - -ClientInfo * -clientdbGetInfo(const Ip::Address &addr) -{ - fatal("client_db.cc required"); - return NULL; -} +void clientdbSetWriteLimiter(ClientInfo * info, const int writeSpeedLimit,const double initialBurst,const double highWatermark) STUB +ClientInfo *clientdbGetInfo(const Ip::Address &addr) STUB_RETVAL(NULL) #endif - -void -clientOpenListenSockets(void) -{ - fatal("client_db.cc required"); -} - -void -clientHttpConnectionsClose(void) -{ - fatal("client_db.cc required"); -} +void clientOpenListenSockets(void) STUB +void clientHttpConnectionsClose(void) STUB diff --git a/src/tests/stub_comm.cc b/src/tests/stub_comm.cc index 25b90c364f..5c4747f75e 100644 --- a/src/tests/stub_comm.cc +++ b/src/tests/stub_comm.cc @@ -32,140 +32,36 @@ * */ -#include "squid.h" +#include "config.h" #include "comm.h" #include "comm/Connection.h" #include "comm/Loops.h" -#include "CommRead.h" #include "fde.h" -DeferredReadManager::~DeferredReadManager() -{ - /* no networked tests yet */ -} - -DeferredRead::DeferredRead (DeferrableRead *, void *, CommRead const &) -{ - fatal ("Not implemented"); -} - -void -DeferredReadManager::delayRead(DeferredRead const &aRead) -{ - fatal ("Not implemented"); -} - -void -DeferredReadManager::kickReads(int const count) -{ - fatal ("Not implemented"); -} - -void -comm_read(const Comm::ConnectionPointer &conn, char *buf, int size, IOCB *handler, void *handler_data) -{ - fatal ("Not implemented"); -} +#define STUB_API "comm.cc" +#include "tests/STUB.h" -void -comm_read(const Comm::ConnectionPointer &conn, char*, int, AsyncCall::Pointer &callback) -{ - fatal ("Not implemented"); -} +void comm_read(const Comm::ConnectionPointer &conn, char *buf, int size, IOCB *handler, void *handler_data) STUB +void comm_read(const Comm::ConnectionPointer &conn, char*, int, AsyncCall::Pointer &callback) STUB /* should be in stub_CommRead */ #include "CommRead.h" -CommRead::CommRead(const Comm::ConnectionPointer &, char *buf, int len, AsyncCall::Pointer &callback) -{ - fatal ("Not implemented"); -} - -CommRead::CommRead () -{ - fatal ("Not implemented"); -} - -void -commSetCloseOnExec(int fd) -{ - /* for tests... ignore */ -} - -#if 0 -void -Comm::SetSelect(int fd, unsigned int type, PF * handler, void *client_data, time_t timeout) -{ - /* all test code runs synchronously at the moment */ -} - -void -Comm::QuickPollRequired() -{ - /* for tests ... ignore */ -} -#endif - -int -ignoreErrno(int ierrno) -{ - fatal ("Not implemented"); - return -1; -} - -void -commUnsetFdTimeout(int fd) -{ - fatal ("Not implemented"); -} - -int -commSetNonBlocking(int fd) -{ - fatal ("Not implemented"); - return COMM_ERROR; -} - -int -commUnsetNonBlocking(int fd) -{ - fatal ("Not implemented"); - return -1; -} - -void -comm_init(void) -{ - fd_table =(fde *) xcalloc(Squid_MaxFD, sizeof(fde)); - - /* Keep a few file descriptors free so that we don't run out of FD's - * after accepting a client but before it opens a socket or a file. - * Since Squid_MaxFD can be as high as several thousand, don't waste them */ - RESERVED_FD = min(100, Squid_MaxFD / 4); -} - -/* MinGW needs also a stub of _comm_close() */ -void -_comm_close(int fd, char const *file, int line) -{ - fatal ("Not implemented"); -} - -int -commSetTimeout(int fd, int timeout, AsyncCall::Pointer& callback) -{ - fatal ("Not implemented"); - return -1; -} - -int -comm_open_uds(int sock_type, int proto, struct sockaddr_un* addr, int flags) -{ - fatal ("Not implemented"); - return -1; -} - -void -comm_write(int fd, const char *buf, int size, AsyncCall::Pointer &callback, FREE * free_func) -{ - fatal ("Not implemented"); -} +CommRead::CommRead(const Comm::ConnectionPointer &, char *buf, int len, AsyncCall::Pointer &callback) STUB +CommRead::CommRead() STUB +DeferredReadManager::~DeferredReadManager() STUB +DeferredRead::DeferredRead(DeferrableRead *, void *, CommRead const &) STUB +void DeferredReadManager::delayRead(DeferredRead const &aRead) STUB +void DeferredReadManager::kickReads(int const count) STUB + +void commSetCloseOnExec(int fd) STUB_NOP +int ignoreErrno(int ierrno) STUB_RETVAL(-1) + +void commUnsetFdTimeout(int fd) STUB +int commSetNonBlocking(int fd) STUB_RETVAL(COMM_ERROR) +int commUnsetNonBlocking(int fd) STUB_RETVAL(-1) + +// MinGW needs also a stub of _comm_close() +void _comm_close(int fd, char const *file, int line) STUB +int commSetTimeout(int fd, int timeout, AsyncCall::Pointer& callback) STUB_RETVAL(-1) +int comm_open_uds(int sock_type, int proto, struct sockaddr_un* addr, int flags) STUB_RETVAL(-1) +void comm_write(int fd, const char *buf, int size, AsyncCall::Pointer &callback, FREE * free_func) STUB diff --git a/src/tests/stub_errorpage.cc b/src/tests/stub_errorpage.cc index 2c8eb8164f..831bdf3b16 100644 --- a/src/tests/stub_errorpage.cc +++ b/src/tests/stub_errorpage.cc @@ -1,80 +1,12 @@ -/* - * $Id$ - * - * DEBUG: section 28 Access Control - * AUTHOR: Robert Collins - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - #include "config.h" #include "errorpage.h" -err_type -errorReservePageId(const char *page_name) -{ - fatal("Not implemented"); - return err_type(); -} - -void -errorAppendEntry(StoreEntry * entry, ErrorState * err) -{ - fatal("Not implemented"); -} - -bool -strHdrAcptLangGetItem(const String &hdr, char *lang, int langLen, size_t &pos) -{ - fatal("Not implemented"); - return false; -} - -bool -TemplateFile::loadDefault() -{ - fatal("Not implemented"); - return false; -} - -TemplateFile::TemplateFile(char const*) -{ - fatal("Not implemented"); -} - -bool -TemplateFile::loadFor(HttpRequest*) -{ - fatal("Not implemented"); - return false; -} +#define STUB_API "errorpage.cc" +#include "tests/STUB.h" -/* - * DO NOT MODIFY: - * arch-tag: e4c72cfd-0b31-4497-90e6-0e3cda3b92b4 - */ +err_type errorReservePageId(const char *page_name) STUB_RETVAL(err_type()) +void errorAppendEntry(StoreEntry * entry, ErrorState * err) STUB +bool strHdrAcptLangGetItem(const String &hdr, char *lang, int langLen, size_t &pos) STUB_RETVAL(false) +bool TemplateFile::loadDefault() STUB_RETVAL(false) +TemplateFile::TemplateFile(char const*) STUB +bool TemplateFile::loadFor(HttpRequest*) STUB_RETVAL(false) diff --git a/src/tests/stub_fd.cc b/src/tests/stub_fd.cc index bace6c07bf..85e60a648c 100644 --- a/src/tests/stub_fd.cc +++ b/src/tests/stub_fd.cc @@ -1,67 +1,11 @@ -/* - * $Id$ - * - * DEBUG: section 84 Helper process maintenance - * AUTHOR: Robert Collins - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - #include "config.h" #include "fde.h" -int -fdNFree(void) -{ - fatal ("Not Implemented"); - return -1; -} - -void -fd_open(int fd, unsigned int type, const char *desc) -{ - fatal ("Not Implemented"); -} - -void -fd_close(int fd) -{ - fatal ("Not Implemented"); -} - -void -fd_bytes(int fd, int len, unsigned int type) -{ - fatal ("Not Implemented"); -} +#define STUB_API "fd.cc" +#include "tests/STUB.h" -void -fd_note(int fd, const char *s) -{ - fatal ("Not Implemented"); -} +int fdNFree(void) STUB_RETVAL(-1) +void fd_open(int fd, unsigned int type, const char *desc) STUB +void fd_close(int fd) STUB +void fd_bytes(int fd, int len, unsigned int type) STUB +void fd_note(int fd, const char *s) STUB diff --git a/src/tests/stub_helper.cc b/src/tests/stub_helper.cc index b526262bb3..f2a8de5a1d 100644 --- a/src/tests/stub_helper.cc +++ b/src/tests/stub_helper.cc @@ -1,118 +1,21 @@ -/* - * $Id$ - * - * DEBUG: section 84 Helper process maintenance - * AUTHOR: Robert Collins - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - -#include "squid.h" +#include "config.h" #include "helper.h" -void -helperSubmit(helper * hlp, const char *buf, HLPCB * callback, void *data) -{ - fatal("Not implemented"); -} - -void -helperStatefulSubmit(statefulhelper * hlp, const char *buf, HLPSCB * callback, void *data, helper_stateful_server * lastserver) -{ - fatal("Not implemented"); -} - -helper::~helper() -{ - fatal("Not implemented"); -} +#define STUB_API "helper.cc" +#include "tests/STUB.h" +void helperSubmit(helper * hlp, const char *buf, HLPCB * callback, void *data) STUB +void helperStatefulSubmit(statefulhelper * hlp, const char *buf, HLPSCB * callback, void *data, helper_stateful_server * lastserver) STUB +helper::~helper() STUB CBDATA_CLASS_INIT(helper); -void -helperStats(StoreEntry * sentry, helper * hlp, const char *label) -{ - fatal("Not implemented"); -} - -void -helperStatefulStats(StoreEntry * sentry, statefulhelper * hlp, const char *label) -{ - fatal("Not implemented"); -} - -void -helperShutdown(helper * hlp) -{ - fatal("Not implemented"); -} - -void -helperStatefulShutdown(statefulhelper * hlp) -{ - fatal("Not implemented"); -} - -void -helperOpenServers(helper * hlp) -{ - debugs(84,4,"Not implemented"); -} - -void -helperStatefulOpenServers(statefulhelper * hlp) -{ - debugs(84,4,"Not implemented"); -} - -void * -helperStatefulServerGetData(helper_stateful_server * srv) -{ - fatal("Not implemented"); - return NULL; -} - -helper_stateful_server * -helperStatefulDefer(statefulhelper * hlp) -{ - fatal("Not implemented"); - return NULL; -} - -void -helperStatefulReleaseServer(helper_stateful_server * srv) -{ - fatal("Not implemented"); -} - +void helperStats(StoreEntry * sentry, helper * hlp, const char *label) STUB +void helperStatefulStats(StoreEntry * sentry, statefulhelper * hlp, const char *label) STUB +void helperShutdown(helper * hlp) STUB +void helperStatefulShutdown(statefulhelper * hlp) STUB +void helperOpenServers(helper * hlp) STUB +void helperStatefulOpenServers(statefulhelper * hlp) STUB +void *helperStatefulServerGetData(helper_stateful_server * srv) STUB_RETVAL(NULL) +helper_stateful_server *helperStatefulDefer(statefulhelper * hlp) STUB_RETVAL(NULL) +void helperStatefulReleaseServer(helper_stateful_server * srv) STUB CBDATA_CLASS_INIT(statefulhelper); - -/* - * DO NOT MODIFY: - * arch-tag: 0b5fe2ac-1652-4b77-8788-85ded78ad3bb - */ diff --git a/src/tests/stub_http.cc b/src/tests/stub_http.cc index 7621c02f39..af699054ba 100644 --- a/src/tests/stub_http.cc +++ b/src/tests/stub_http.cc @@ -1,42 +1,6 @@ -/* - * $Id$ - * - * DEBUG: section 84 Helper process maintenance - * AUTHOR: Robert Collins - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - #include "squid.h" -const char * -httpMakeVaryMark(HttpRequest * request, HttpReply const * reply) -{ - fatal ("Not implemented"); - return NULL; -} +#define STUB_API "http.cc" +#include "tests/STUB.h" + +const char * httpMakeVaryMark(HttpRequest * request, HttpReply const * reply) STUB_RETVAL(NULL) diff --git a/src/tests/stub_icp.cc b/src/tests/stub_icp.cc index 5f4709fb0f..0de7f81a96 100644 --- a/src/tests/stub_icp.cc +++ b/src/tests/stub_icp.cc @@ -3,9 +3,8 @@ #include "ICP.h" #include "icp_opcode.h" -#define STUB { fatal("icp_*.cc required."); } -#define STUB_RETVAL(x) { fatal("icp_*.cc required."); return (x); } -//#define STUB_RETREF(x) { fatal("icp_*.cc required."); static x v; return v; } +#define STUB_API "icp_*.cc" +#include "tests/STUB.h" #ifdef __cplusplus _icp_common_t::_icp_common_t() STUB diff --git a/src/tests/stub_internal.cc b/src/tests/stub_internal.cc index 3656736686..45a9f3124d 100644 --- a/src/tests/stub_internal.cc +++ b/src/tests/stub_internal.cc @@ -1,42 +1,7 @@ -/* - * $Id$ - * - * DEBUG: section 84 Helper process maintenance - * AUTHOR: Robert Collins - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ +#include "config.h" +#include "protos.h" -#include "squid.h" +#define STUB_API "internal.cc" +#include "tests/STUB.h" -char * -internalLocalUri(const char *dir, const char *name) -{ - fatal ("Not implemented"); - return NULL; -} +char * internalLocalUri(const char *dir, const char *name) STUB_RETVAL(NULL) diff --git a/src/tests/stub_ipc.cc b/src/tests/stub_ipc.cc index 57b93b7a9f..1180582e93 100644 --- a/src/tests/stub_ipc.cc +++ b/src/tests/stub_ipc.cc @@ -2,9 +2,7 @@ // because ipcCreate is defined in protos.h still #include "protos.h" -pid_t -ipcCreate(int type, const char *prog, const char *const args[], const char *name, Ip::Address &local_addr, int *rfd, int *wfd, void **hIpc) -{ - fatal("ipc.cc required."); - return -1; -} +#define STUB_API "ipc.cc" +#include "tests/STUB.h" + +pid_t ipcCreate(int, const char *, const char *const [], const char *, Ip::Address &, int *, int *, void **) STUB_RETVAL(-1) diff --git a/src/tests/stub_mem_node.cc b/src/tests/stub_mem_node.cc index 62f974bde7..3c24418051 100644 --- a/src/tests/stub_mem_node.cc +++ b/src/tests/stub_mem_node.cc @@ -1,48 +1,8 @@ -/* - * $Id$ - * - * DEBUG: section 84 Helper process maintenance - * AUTHOR: Robert Collins - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - -#include "squid.h" +#include "config.h" #include "mem_node.h" -mem_node::mem_node(int64_t offset):nodeBuffer(0,offset,data) -{ - fatal ("Not implemented"); -} +#define STUB_API "mem_node.cc" +#include "tests/STUB.h" -size_t -mem_node::InUseCount() -{ - fatal ("Not implemented"); - return 0; -} +mem_node::mem_node(int64_t offset):nodeBuffer(0,offset,data) STUB +size_t mem_node::InUseCount() STUB_RETVAL(0) diff --git a/src/tests/stub_mime.cc b/src/tests/stub_mime.cc index 96b10a3d36..d2be1f0af5 100644 --- a/src/tests/stub_mime.cc +++ b/src/tests/stub_mime.cc @@ -1,42 +1,7 @@ -/* - * $Id$ - * - * DEBUG: section 28 Access Control - * AUTHOR: Robert Collins - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ +#include "config.h" +#include "protos.h" -#include "squid.h" +#define STUB_API "mime.cc" +#include "tests/STUB.h" -size_t -headersEnd(const char *mime, size_t l) -{ - fatal("Not implemented"); - return 0; -} +size_t headersEnd(const char *mime, size_t l) STUB_RETVAL(0) diff --git a/src/tests/stub_pconn.cc b/src/tests/stub_pconn.cc index 0affac1bd4..7446e10ad9 100644 --- a/src/tests/stub_pconn.cc +++ b/src/tests/stub_pconn.cc @@ -1,131 +1,31 @@ /* * STUB file for the pconn.cc API - * Functions here are inactive. */ #include "config.h" #include "pconn.h" #include "comm/Connection.h" -IdleConnList::IdleConnList(const char *key, PconnPool *parent) -{ - fatal("pconn.cc required"); -} - -IdleConnList::~IdleConnList() -{ - fatal("pconn.cc required"); -} - -void -IdleConnList::push(const Comm::ConnectionPointer &conn) -{ - fatal("pconn.cc required"); -} - -Comm::ConnectionPointer -IdleConnList::findUseable(const Comm::ConnectionPointer &key) -{ - fatal("pconn.cc required"); - return Comm::ConnectionPointer(); -} - -void -IdleConnList::clearHandlers(const Comm::ConnectionPointer &conn) -{ - fatal("pconn.cc required"); -} - -PconnPool::PconnPool(const char *) -{ - fatal("pconn.cc required"); -} - -PconnPool::~PconnPool() -{ - fatal("pconn.cc required"); -} - -void -PconnPool::moduleInit() -{ - fatal("pconn.cc required"); -} - -void -PconnPool::push(const Comm::ConnectionPointer &serverConn, const char *domain) -{ - fatal("pconn.cc required"); -} - -Comm::ConnectionPointer -PconnPool::pop(const Comm::ConnectionPointer &destLink, const char *domain, bool retriable) -{ - fatal("pconn.cc required"); - return Comm::ConnectionPointer(); -} - -void -PconnPool::count(int uses) -{ - fatal("pconn.cc required"); -} - -void -PconnPool::noteUses(int) -{ - fatal("pconn.cc required"); -} - -void -PconnPool::dumpHist(StoreEntry *e) const -{ - fatal("pconn.cc required"); -} - -void -PconnPool::dumpHash(StoreEntry *e) const -{ - fatal("pconn.cc required"); -} - -void -PconnPool::unlinkList(IdleConnList *list) -{ - fatal("pconn.cc required"); -} - -PconnModule * -PconnModule::GetInstance() -{ - fatal("pconn.cc required"); - return NULL; -} - -void -PconnModule::DumpWrapper(StoreEntry *e) -{ - fatal("pconn.cc required"); -} - -PconnModule::PconnModule() -{ - fatal("pconn.cc required"); -} - -void -PconnModule::registerWithCacheManager(void) -{ - fatal("pconn.cc required"); -} - -void -PconnModule::add(PconnPool *) -{ - fatal("pconn.cc required"); -} - -void -PconnModule::dump(StoreEntry *) -{ - fatal("pconn.cc required"); -} +#define STUB_API "pconn.cc" +#include "tests/STUB.h" + +IdleConnList::IdleConnList(const char *key, PconnPool *parent) STUB +IdleConnList::~IdleConnList() STUB +void IdleConnList::push(const Comm::ConnectionPointer &conn) STUB +Comm::ConnectionPointer IdleConnList::findUseable(const Comm::ConnectionPointer &key) STUB_RETVAL(Comm::ConnectionPointer()) +void IdleConnList::clearHandlers(const Comm::ConnectionPointer &conn) STUB +PconnPool::PconnPool(const char *) STUB +PconnPool::~PconnPool() STUB +void PconnPool::moduleInit() STUB +void PconnPool::push(const Comm::ConnectionPointer &serverConn, const char *domain) STUB +Comm::ConnectionPointer PconnPool::pop(const Comm::ConnectionPointer &destLink, const char *domain, bool retriable) STUB_RETVAL(Comm::ConnectionPointer()) +void PconnPool::count(int uses) STUB +void PconnPool::noteUses(int) STUB +void PconnPool::dumpHist(StoreEntry *e) const STUB +void PconnPool::dumpHash(StoreEntry *e) const STUB +void PconnPool::unlinkList(IdleConnList *list) STUB +PconnModule * PconnModule::GetInstance() STUB_RETVAL(NULL) +void PconnModule::DumpWrapper(StoreEntry *e) STUB +PconnModule::PconnModule() STUB +void PconnModule::registerWithCacheManager(void) STUB +void PconnModule::add(PconnPool *) STUB +void PconnModule::dump(StoreEntry *) STUB diff --git a/src/tests/stub_stmem.cc b/src/tests/stub_stmem.cc index 951fbf209a..4ddf12f162 100644 --- a/src/tests/stub_stmem.cc +++ b/src/tests/stub_stmem.cc @@ -1,49 +1,9 @@ -/* - * $Id$ - * - * DEBUG: section 84 Helper process maintenance - * AUTHOR: Robert Collins - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - -#include "squid.h" +#include "config.h" #include "stmem.h" -mem_hdr::mem_hdr() -{} - -mem_hdr::~mem_hdr() -{} +#define STUB_API "stmem.cc" +#include "tests/STUB.h" -size_t -mem_hdr::size() const -{ - fatal ("Not implemented"); - return 0; -} +mem_hdr::mem_hdr() STUB +mem_hdr::~mem_hdr() STUB +size_t mem_hdr::size() const STUB_RETVAL(0) diff --git a/src/tests/stub_store_client.cc b/src/tests/stub_store_client.cc index 90ed8e57cb..c90f04277c 100644 --- a/src/tests/stub_store_client.cc +++ b/src/tests/stub_store_client.cc @@ -1,108 +1,32 @@ -/* - * $Id$ - * - * DEBUG: section 84 Helper process maintenance - * AUTHOR: Robert Collins - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - #include "squid.h" #include "StoreClient.h" #include "Store.h" -int -storePendingNClients(const StoreEntry * e) +#define STUB_API "store_client.cc" +#include "tests/STUB.h" + +int storePendingNClients(const StoreEntry * e) { /* no clients in the tests so far */ return 0; } -/* Garh, too many stub files */ - -void -StoreEntry::invokeHandlers() -{} - -void -storeLog(int tag, const StoreEntry * e) -{ - /* do nothing for tests - we don't need the log */ -} - -void -storeLogOpen(void) -{ - fatal ("Not implemented"); -} - -void -storeDigestInit(void) -{ - fatal ("Not implemented"); -} - -void -storeRebuildStart(void) -{ - fatal ("Not implemented"); -} - -#include "Store.h" -const char * -storeEntryFlags(const StoreEntry *) -{ - fatal ("Not implemented"); - return NULL; -} - -void -storeReplSetup(void) +void StoreEntry::invokeHandlers() { - fatal ("Not implemented"); -} - -bool -store_client::memReaderHasLowerOffset(int64_t anOffset) const -{ - fatal ("Not implemented"); - return false; + /* do nothing for tests */ } void -store_client::dumpStats(MemBuf * output, int clientNumber) const -{ - fatal ("Not implemented"); -} - -int -store_client::getType() const +storeLog(int tag, const StoreEntry * e) { - return type; + /* do nothing for tests - we don't need the log */ } +void storeLogOpen(void) STUB +void storeDigestInit(void) STUB +void storeRebuildStart(void) STUB +const char *storeEntryFlags(const StoreEntry *) STUB_RETVAL(NULL) +void storeReplSetup(void) STUB +bool store_client::memReaderHasLowerOffset(int64_t anOffset) const STUB_RETVAL(false) +void store_client::dumpStats(MemBuf * output, int clientNumber) const STUB +int store_client::getType() const STUB_RETVAL(0) diff --git a/src/tests/stub_store_swapout.cc b/src/tests/stub_store_swapout.cc index b430995cf4..78806fd615 100644 --- a/src/tests/stub_store_swapout.cc +++ b/src/tests/stub_store_swapout.cc @@ -1,65 +1,15 @@ -/* - * $Id$ - * - * DEBUG: section 84 Helper process maintenance - * AUTHOR: Robert Collins - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - -#include "squid.h" - -/* wrong stub file... */ -void -storeUnlink(StoreEntry * e) -{ - fatal ("Not implemented"); -} - +#include "config.h" #include "StoreMeta.h" -char * -storeSwapMetaPack(tlv * tlv_list, int *length) -{ - fatal ("Not implemented"); - return NULL; -} +#define STUB_API "store_swapout.cc" +#include "tests/STUB.h" + +#include -tlv * -storeSwapMetaBuild(StoreEntry * e) -{ - fatal ("Not implemented"); - return NULL; -} +/* XXX: wrong stub file... */ +void storeUnlink(StoreEntry * e) STUB -void -storeSwapTLVFree(tlv * n) -{ - fatal ("Not implemented"); -} +char *storeSwapMetaPack(tlv * tlv_list, int *length) STUB_RETVAL(NULL) +tlv *storeSwapMetaBuild(StoreEntry * e) STUB_RETVAL(NULL) +void storeSwapTLVFree(tlv * n) STUB diff --git a/src/tests/stub_tools.cc b/src/tests/stub_tools.cc index 27afd55be7..fc9526927e 100644 --- a/src/tests/stub_tools.cc +++ b/src/tests/stub_tools.cc @@ -1,105 +1,97 @@ -/* - * $Id$ - * - * AUTHOR: Robert Collins - * - * SQUID Web Proxy Cache http://www.squid-cache.org/ - * ---------------------------------------------------------- - * - * Squid is the result of efforts by numerous individuals from - * the Internet community; see the CONTRIBUTORS file for full - * details. Many organizations have provided support for Squid's - * development; see the SPONSORS file for full details. Squid is - * Copyrighted (C) 2001 by the Regents of the University of - * California; see the COPYRIGHT file for full details. Squid - * incorporates software developed and/or copyrighted by other - * sources; see the CREDITS file for full details. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. - * - */ - #include "config.h" +// tool functions still defined in protos.h - TODO extract #include "protos.h" -int -percent(int a, int b) -{ - return b ? ((int) (100.0 * a / b + 0.5)) : 0; -} +#define STUB_API "tools.cc" +#include "tests/STUB.h" -/* MinGW needs also a stub of death() */ -void -death(int sig) -{ - fatal("tools.cc required"); -} +int DebugSignal = -1; +void releaseServerSockets(void) STUB +char * dead_msg(void) STUB_RETVAL(NULL) +void mail_warranty(void) STUB +void dumpMallocStats(void) STUB +void squid_getrusage(struct rusage *r) STUB +double rusage_cputime(struct rusage *r) STUB_RETVAL(0) +int rusage_maxrss(struct rusage *r) STUB_RETVAL(0) +int rusage_pagefaults(struct rusage *r) STUB_RETVAL(0) +void PrintRusage(void) STUB +void death(int sig) STUB +void BroadcastSignalIfAny(int& sig) STUB +void sigusr2_handle(int sig) STUB +void fatal(const char *message) STUB +void fatal_common(const char *message) STUB +void fatalf(const char *fmt,...) STUB +void fatalvf(const char *fmt, va_list args) STUB +void fatal_dump(const char *message) STUB +void debug_trap(const char *message) STUB +void sig_child(int sig) STUB +void sig_shutdown(int sig) STUB +const char * getMyHostname(void) STUB_RETVAL(NULL) +const char * uniqueHostname(void) STUB_RETVAL(NULL) +void leave_suid(void) STUB +void enter_suid(void) STUB +void no_suid(void) STUB -void* -xmemset(void* dst, int val, size_t sz) +bool +IamMasterProcess() { - assert(dst); - return memset(dst, val, sz); + //std::cerr << STUB_API << " IamMasterProcess() Not implemented\n"; + // Since most tests run as a single process, this is the best default. + // TODO: If some test case uses multiple processes and cares about + // its role, we may need to parameterize or remove this stub. + return true; } bool IamWorkerProcess() { - fprintf(stderr, "Not implemented"); + //std::cerr << STUB_API << " IamWorkerProcess() Not implemented\n"; return true; } bool IamDiskProcess() { - fprintf(stderr, "Not implemented"); + std::cerr << STUB_API << " IamDiskProcess() Not implemented\n"; return false; } -bool -IamMasterProcess() -{ - fprintf(stderr, "Not implemented"); - // Since most tests run as a single process, this is the best default. - // TODO: If some test case uses multiple processes and cares about - // its role, we may need to parameterize or remove this stub. - return true; -} - bool InDaemonMode() { - fprintf(stderr, "Not implemented"); + std::cerr << STUB_API << " InDaemonMode() Not implemented\n"; return false; } bool UsingSmp() { - fprintf(stderr, "Not implemented"); + std::cerr << STUB_API << " UsingSnmp() Not implemented\n"; return false; } -void -logsFlush(void) -{ - fatal("tools.cc required"); -} +bool IamCoordinatorProcess() STUB_RETVAL(false) +bool IamPrimaryProcess() STUB_RETVAL(false) +int NumberOfKids() STUB_RETVAL(0) +String ProcessRoles() STUB_RETVAL(String()) +void writePidFile(void) STUB +pid_t readPidFile(void) STUB_RETVAL(0) +void setMaxFD(void) STUB +void setSystemLimits(void) STUB +void squid_signal(int sig, SIGHDLR * func, int flags) STUB +void logsFlush(void) STUB +void kb_incr(kb_t * k, size_t v) STUB +void debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm) STUB +void parseEtcHosts(void) STUB +int getMyPort(void) STUB_RETVAL(0) +void setUmask(mode_t mask) STUB +void strwordquote(MemBuf * mb, const char *str) STUB +void keepCapabilities(void) STUB +void restoreCapabilities(int keep) STUB -void -no_suid(void) +void* +xmemset(void* dst, int val, size_t sz) { - fatal("tools.cc required"); + assert(dst); + return memset(dst, val, sz); } diff --git a/src/tests/stub_wordlist.cc b/src/tests/stub_wordlist.cc index 434b105f8c..3ec920a685 100644 --- a/src/tests/stub_wordlist.cc +++ b/src/tests/stub_wordlist.cc @@ -4,8 +4,8 @@ #define STUB_API "wordlist.cc" #include "tests/STUB.h" -const char *wordlistAdd(wordlist **, const char *) STUB_RETVAL(NULL); -void wordlistAddWl(wordlist **, wordlist *) STUB; -void wordlistJoin(wordlist **, wordlist **) STUB; -wordlist *wordlistDup(const wordlist *) STUB_RETVAL(NULL); -void wordlistDestroy(wordlist **) STUB; +const char *wordlistAdd(wordlist **, const char *) STUB_RETVAL(NULL) +void wordlistAddWl(wordlist **, wordlist *) STUB +void wordlistJoin(wordlist **, wordlist **) STUB +wordlist *wordlistDup(const wordlist *) STUB_RETVAL(NULL) +void wordlistDestroy(wordlist **) STUB diff --git a/src/tests/testStore.cc b/src/tests/testStore.cc index 0e80a6192a..0c4989d25a 100644 --- a/src/tests/testStore.cc +++ b/src/tests/testStore.cc @@ -23,7 +23,6 @@ TestStore::get(String, void (*)(StoreEntry*, void*), void*) {} void - TestStore::init() {} diff --git a/src/tests/testStore.h b/src/tests/testStore.h index 32c60330ae..cd09fd0f3b 100644 --- a/src/tests/testStore.h +++ b/src/tests/testStore.h @@ -45,11 +45,9 @@ public: virtual int callback(); - virtual StoreEntry* get - (const cache_key*); + virtual StoreEntry* get(const cache_key*); - virtual void get - (String, void (*)(StoreEntry*, void*), void*); + virtual void get(String, void (*)(StoreEntry*, void*), void*); virtual void init(); diff --git a/test-suite/Makefile.am b/test-suite/Makefile.am index cedd9833ef..e47b659e2c 100644 --- a/test-suite/Makefile.am +++ b/test-suite/Makefile.am @@ -53,12 +53,15 @@ check_PROGRAMS += debug \ tcp_banger2_LDADD = $(top_builddir)/lib/libmiscutil.la -DEBUG_SOURCE = test_tools.cc stub_debug.cc +DEBUG_SOURCE = test_tools.cc stub_debug.cc stub_tools.cc stub_debug.cc: $(top_srcdir)/src/tests/stub_debug.cc cp $(top_srcdir)/src/tests/stub_debug.cc . -CLEANFILES += stub_debug.cc +stub_tools.cc: $(top_srcdir)/src/tests/stub_tools.cc + cp $(top_srcdir)/src/tests/stub_tools.cc . + +CLEANFILES += stub_debug.cc stub_tools.cc ## XXX: somewhat broken. Its meant to test our debugs() implementation. ## but it has never been linked to the actual src/debug.cc implementation !! @@ -73,8 +76,10 @@ mem_node_test_SOURCES = mem_node_test.cc mem_node_test_LDADD = $(top_builddir)/src/mem_node.o $(LDADD) mem_hdr_test_SOURCES = mem_hdr_test.cc $(DEBUG_SOURCE) -mem_hdr_test_LDADD = $(top_builddir)/src/stmem.o \ - $(top_builddir)/src/mem_node.o $(LDADD) +mem_hdr_test_LDADD = \ + $(top_builddir)/src/stmem.o \ + $(top_builddir)/src/mem_node.o \ + $(LDADD) MemPoolTest_SOURCES = MemPoolTest.cc diff --git a/test-suite/test_tools.cc b/test-suite/test_tools.cc index 1f76733a1a..235ab3c796 100644 --- a/test-suite/test_tools.cc +++ b/test-suite/test_tools.cc @@ -14,45 +14,6 @@ xassert(const char *msg, const char *file, int line) exit (1); } -void -fatal_dump(const char *message) -{ - fprintf(stderr, "Fatal: %s",message); - exit (1); -} - -void -fatal(const char *message) -{ - fprintf(stderr, "Fatal: %s", message); - exit (1); -} - -/* used by fatalf */ -static void -fatalvf(const char *fmt, va_list args) -{ - static char fatal_str[BUFSIZ]; - vsnprintf(fatal_str, sizeof(fatal_str), fmt, args); - fatal(fatal_str); -} - -/* printf-style interface for fatal */ -void -fatalf(const char *fmt,...) -{ - va_list args; - va_start(args, fmt); - fatalvf(fmt, args); - va_end(args); -} - -void -debug_trap(const char *message) -{ - fatal(message); -} - dlink_node * dlinkNodeNew() {