------------------------------------------------------------ revno: 12266 [merge] revision-id: kinkie@squid-cache.org-20120809150102-md1i26aah9d3xfn5 parent: squid3@treenet.co.nz-20120809103838-ne85mq2c0bvcf2ot parent: kinkie@squid-cache.org-20120809145930-3vscoxqkv0n09z9d committer: Francesco Chemolli branch nick: trunk timestamp: Thu 2012-08-09 17:01:02 +0200 message: Convert all yet-unconverted stub files to the STUB API. ------------------------------------------------------------ Use --include-merges or -n0 to see merged revisions. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: kinkie@squid-cache.org-20120809150102-md1i26aah9d3xfn5 # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: 5498ca0fc8d02de94a7f722b2ea10e32aaecf04d # timestamp: 2012-08-09 15:51:40 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: squid3@treenet.co.nz-20120809103838-\ # ne85mq2c0bvcf2ot # # Begin patch === modified file 'src/tests/STUB.h' --- src/tests/STUB.h 2012-01-07 10:15:40 +0000 +++ src/tests/STUB.h 2012-08-08 12:14:34 +0000 @@ -28,11 +28,15 @@ /// Intended for registration pattern APIs where the function result does not matter to the test #define STUB_NOP { std::cerr<<"SKIP: "< HelperChildConfig::HelperChildConfig(const unsigned int m): @@ -26,9 +29,4 @@ return (n_max - n_active); } -void -HelperChildConfig::parseConfig() -{ - fprintf(stderr, "HelperChildConfig::parseConfig not implemented."); - exit(1); -} +void HelperChildConfig::parseConfig() STUB === modified file 'src/tests/stub_HttpRequest.cc' --- src/tests/stub_HttpRequest.cc 2012-07-17 14:25:06 +0000 +++ src/tests/stub_HttpRequest.cc 2012-08-08 07:54:29 +0000 @@ -6,15 +6,15 @@ #include "tests/STUB.h" HttpRequest::HttpRequest() : HttpMsg(hoRequest) STUB - HttpRequest::HttpRequest(const HttpRequestMethod& method, AnyP::ProtocolType protocol, const char *aUrlpath) : HttpMsg(hoRequest) STUB - HttpRequest::~HttpRequest() STUB - void HttpRequest::packFirstLineInto(Packer * p, bool full_uri) const STUB - bool HttpRequest::sanityCheckStartLine(MemBuf *buf, const size_t hdr_len, http_status *error) STUB_RETVAL(false) - void HttpRequest::hdrCacheInit() STUB - void HttpRequest::reset() STUB - bool HttpRequest::expectingBody(const HttpRequestMethod& unused, int64_t&) const STUB_RETVAL(false) - void HttpRequest::initHTTP(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aUrlpath) STUB - bool HttpRequest::parseFirstLine(const char *start, const char *end) STUB_RETVAL(false) - HttpRequest * HttpRequest::clone() const STUB_RETVAL(NULL) - bool HttpRequest::inheritProperties(const HttpMsg *aMsg) STUB_RETVAL(false) - int64_t HttpRequest::getRangeOffsetLimit() STUB_RETVAL(0) +HttpRequest::HttpRequest(const HttpRequestMethod& method, AnyP::ProtocolType protocol, const char *aUrlpath) : HttpMsg(hoRequest) STUB +HttpRequest::~HttpRequest() STUB +void HttpRequest::packFirstLineInto(Packer * p, bool full_uri) const STUB +bool HttpRequest::sanityCheckStartLine(MemBuf *buf, const size_t hdr_len, http_status *error) STUB_RETVAL(false) +void HttpRequest::hdrCacheInit() STUB +void HttpRequest::reset() STUB +bool HttpRequest::expectingBody(const HttpRequestMethod& unused, int64_t&) const STUB_RETVAL(false) +void HttpRequest::initHTTP(const HttpRequestMethod& aMethod, AnyP::ProtocolType aProtocol, const char *aUrlpath) STUB +bool HttpRequest::parseFirstLine(const char *start, const char *end) STUB_RETVAL(false) +HttpRequest * HttpRequest::clone() const STUB_RETVAL(NULL) +bool HttpRequest::inheritProperties(const HttpMsg *aMsg) STUB_RETVAL(false) +int64_t HttpRequest::getRangeOffsetLimit() STUB_RETVAL(0) === modified file 'src/tests/stub_StatHist.cc' --- src/tests/stub_StatHist.cc 2012-05-14 12:45:54 +0000 +++ src/tests/stub_StatHist.cc 2012-08-08 09:24:40 +0000 @@ -1,35 +1,16 @@ #include "squid.h" +#include "StatHist.h" + #define STUB_API "StatHist.cc" #include "STUB.h" -#include "StatHist.h" - - -void -StatHist::dump(StoreEntry * sentry, StatHistBinDumper * bd) const -{} - -void -StatHist::enumInit(unsigned int i) -{} - -void -StatHist::count(double d) -{} - -double -statHistDeltaMedian(const StatHist & A, const StatHist & B) -STUB_RETVAL(0.0) - -double -statHistDeltaPctile(const StatHist & A, const StatHist & B, double pctile) -STUB_RETVAL(0.0) - -void -StatHist::logInit(unsigned int i, double d1, double d2) -STUB class StoreEntry; -void -statHistIntDumper(StoreEntry * sentry, int idx, double val, double size, int count) -STUB + +void StatHist::dump(StoreEntry * sentry, StatHistBinDumper * bd) const STUB +void StatHist::enumInit(unsigned int i) STUB_NOP +void StatHist::count(double d) STUB_NOP +double statHistDeltaMedian(const StatHist & A, const StatHist & B) STUB_RETVAL(0.0) +double statHistDeltaPctile(const StatHist & A, const StatHist & B, double pctile) STUB_RETVAL(0.0) +void StatHist::logInit(unsigned int i, double d1, double d2) STUB +void statHistIntDumper(StoreEntry * sentry, int idx, double val, double size, int count) STUB === modified file 'src/tests/stub_cache_cf.cc' --- src/tests/stub_cache_cf.cc 2012-07-13 10:48:12 +0000 +++ src/tests/stub_cache_cf.cc 2012-08-07 15:58:08 +0000 @@ -43,35 +43,7 @@ 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); - - if (token == NULL) - self_destruct(); - - while (*token && xisspace(*token)) - ++token; - - if (!*token) - self_destruct(); - - *var = xstrdup((char *) token); -} -#endif - void parse_wordlist(wordlist ** list) STUB -#if 0 -{ - char *token; - char *t = strtok(NULL, ""); - - while ((token = strwordtok(NULL, &t))) - wordlistAdd(list, token); -} -#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) === modified file 'src/tests/stub_client_side_request.cc' --- src/tests/stub_client_side_request.cc 2012-01-20 18:55:04 +0000 +++ src/tests/stub_client_side_request.cc 2012-08-07 15:58:08 +0000 @@ -34,8 +34,3 @@ #include "squid.h" #include "client_side_request.h" #include "Store.h" - -#if !_USE_INLINE_ -#include "client_side_request.cci" -#endif - === modified file 'src/tests/stub_debug.cc' --- src/tests/stub_debug.cc 2012-07-25 12:31:05 +0000 +++ src/tests/stub_debug.cc 2012-08-08 07:35:10 +0000 @@ -1,6 +1,9 @@ /* * A stub implementation of the Debug.h API. * For use by test binaries which do not need the full context debugging + * + * Note: it doesn't use the STUB API as the functions defined here must + * not abort the unit test. */ #include "squid.h" #include "Debug.h" === modified file 'src/tests/stub_libcomm.cc' --- src/tests/stub_libcomm.cc 2012-08-01 12:51:45 +0000 +++ src/tests/stub_libcomm.cc 2012-08-08 07:54:29 +0000 @@ -26,19 +26,19 @@ void Comm::ConnOpener::start() STUB void Comm::ConnOpener::swanSong() STUB Comm::ConnOpener::ConnOpener(Comm::ConnectionPointer &, AsyncCall::Pointer &, time_t) : AsyncJob("STUB Comm::ConnOpener") STUB - Comm::ConnOpener::~ConnOpener() STUB - void Comm::ConnOpener::setHost(const char *) STUB - const char * Comm::ConnOpener::getHost() const STUB_RETVAL(NULL) +Comm::ConnOpener::~ConnOpener() STUB +void Comm::ConnOpener::setHost(const char *) STUB +const char * Comm::ConnOpener::getHost() const STUB_RETVAL(NULL) #include "comm/forward.h" - bool Comm::IsConnOpen(const Comm::ConnectionPointer &) STUB_RETVAL(false) +bool Comm::IsConnOpen(const Comm::ConnectionPointer &) STUB_RETVAL(false) #include "comm/IoCallback.h" - void Comm::IoCallback::setCallback(iocb_type type, AsyncCall::Pointer &cb, char *buf, FREE *func, int sz) STUB - void Comm::IoCallback::selectOrQueueWrite() STUB - void Comm::IoCallback::cancel(const char *reason) STUB - void Comm::IoCallback::finish(comm_err_t code, int xerrn) STUB - Comm::CbEntry *Comm::iocb_table = NULL; +void Comm::IoCallback::setCallback(iocb_type type, AsyncCall::Pointer &cb, char *buf, FREE *func, int sz) STUB +void Comm::IoCallback::selectOrQueueWrite() STUB +void Comm::IoCallback::cancel(const char *reason) STUB +void Comm::IoCallback::finish(comm_err_t code, int xerrn) STUB +Comm::CbEntry *Comm::iocb_table = NULL; void Comm::CallbackTableInit() STUB void Comm::CallbackTableDestruct() STUB === modified file 'src/tests/stub_main_cc.cc' --- src/tests/stub_main_cc.cc 2012-01-20 18:55:04 +0000 +++ src/tests/stub_main_cc.cc 2012-08-08 09:24:40 +0000 @@ -35,15 +35,10 @@ #include "squid.h" -void -shut_down(int) -{ /* stub */ } - -void -reconfigure(int) -{ /* stub */ } - -void -rotate_logs(int) -{ /* stub */ } +#define STUB_API "stub_main_cc.cc" +#include "tests/STUB.h" + +void shut_down(int) STUB +void reconfigure(int) STUB +void rotate_logs(int) STUB === modified file 'src/tests/stub_mem.cc' --- src/tests/stub_mem.cc 2012-01-20 18:55:04 +0000 +++ src/tests/stub_mem.cc 2012-08-08 09:24:40 +0000 @@ -60,10 +60,5 @@ return cxx_xfree; } -void * -memAllocate(mem_type type) -STUB_RETVAL(NULL) - -void -memFree(void *p, int type) -STUB +void * memAllocate(mem_type type) STUB_RETVAL(NULL) +void memFree(void *p, int type) STUB === modified file 'src/tests/stub_store_rebuild.cc' --- src/tests/stub_store_rebuild.cc 2012-01-20 18:55:04 +0000 +++ src/tests/stub_store_rebuild.cc 2012-08-08 09:24:40 +0000 @@ -34,30 +34,14 @@ #include "squid-old.h" -void -storeRebuildProgress(int sd_index, int total, int sofar) -{} - -void - -storeRebuildComplete(struct _store_rebuild_data *dc) -{} - -bool -storeRebuildLoadEntry(int, int, MemBuf&, _store_rebuild_data&) -{ - return false; -} - -bool -storeRebuildKeepEntry(const StoreEntry &tmpe, const cache_key *key, - struct _store_rebuild_data &counts) -{ - return false; -} - -bool -storeRebuildParseEntry(MemBuf &, StoreEntry &, cache_key *, struct _store_rebuild_data &, uint64_t) -{ - return false; -} +#define STUB_API "stub_store_rebuild.cc" +#include "tests/STUB.h" + +void storeRebuildProgress(int sd_index, int total, int sofar) STUB +void storeRebuildComplete(struct _store_rebuild_data *dc) STUB_NOP +bool storeRebuildLoadEntry(int, int, MemBuf&, _store_rebuild_data&) +{ + return false; +} +bool storeRebuildKeepEntry(const StoreEntry &tmpe, const cache_key *key, struct _store_rebuild_data &counts) STUB_RETVAL(false) +bool storeRebuildParseEntry(MemBuf &, StoreEntry &, cache_key *, struct _store_rebuild_data &, uint64_t) STUB_RETVAL(false) === modified file 'src/tests/stub_tools.cc' --- src/tests/stub_tools.cc 2012-01-20 18:55:04 +0000 +++ src/tests/stub_tools.cc 2012-08-08 12:14:34 +0000 @@ -49,30 +49,13 @@ return true; } -bool -IamDiskProcess() -{ - std::cerr << STUB_API << " IamDiskProcess() Not implemented\n"; - return false; -} - -bool -InDaemonMode() -{ - std::cerr << STUB_API << " InDaemonMode() Not implemented\n"; - return false; -} - -bool -UsingSmp() -{ - std::cerr << STUB_API << " UsingSnmp() Not implemented\n"; - return false; -} - +bool IamDiskProcess() STUB_RETVAL_NOP(false) +bool InDaemonMode() STUB_RETVAL_NOP(false) +bool UsingSmp() STUB_RETVAL_NOP(false) bool IamCoordinatorProcess() STUB_RETVAL(false) bool IamPrimaryProcess() STUB_RETVAL(false) int NumberOfKids() STUB_RETVAL(0) + //not yet needed in the Stub, causes dependency on String //String ProcessRoles() STUB_RETVAL(String()) void writePidFile(void) STUB