]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup and simplify unit tests (#336)
authorAmos Jeffries <yadij@users.noreply.github.com>
Fri, 25 Jan 2019 16:21:38 +0000 (16:21 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 25 Jan 2019 16:21:41 +0000 (16:21 +0000)
Polish unit tests to reduce their dependency lists inline with
the updated test documentation requirements.

Some further cleanup of unit tests documentation based on
experience pruning existing unit tests.

 * Only the test logic files actually need to be distributed by
   a test. All files being tested are supposed to be distributed
   from elsewhere and the test should rely on that to prevent
   future issues like the base/RefCount.h bug mentioned below.

 * Starting to deprecate TESTSOURCES which is causing more
   trouble than benefit by pulling in too many needless
   dependencies. eg the globals.cc objects and symbols. Tools it
   used to provide are largely superseded by the stub mechanisms.

Add missing stub files necessary for pruning dependencies. Also
fix some bugs in existing stub files.

Fix base/RefCount.h distribution. This file was not included in
the base/libbase.la dependency list but indirectly being
distributed by the unit-test existence. Which in some builds
could cause it not to exist in generated minimal tarballs.

19 files changed:
src/Makefile.am
src/base/Makefile.am
src/client_db.h
src/snmp_agent.h
src/tests/Stub.list
src/tests/stub_HelperChildConfig.cc
src/tests/stub_HttpHeader.cc [new file with mode: 0644]
src/tests/stub_HttpRequest.cc
src/tests/stub_SBuf.cc
src/tests/stub_StatHist.cc
src/tests/stub_SwapDir.cc [deleted file]
src/tests/stub_client_db.cc
src/tests/stub_gopher.cc [new file with mode: 0644]
src/tests/stub_libhttp.cc [new file with mode: 0644]
src/tests/stub_libstore.cc [new file with mode: 0644]
src/tests/stub_store.cc
src/tests/testACLMaxUserIP.cc
src/tests/testIpAddress.cc [moved from src/tests/testAddress.cc with 99% similarity]
src/tests/testIpAddress.h [moved from src/tests/testAddress.h with 100% similarity]

index aefe18da01530cd37725028de88ab62449911cf7..3bb72902675b38705d15d55c91afcdc279bd3f50 100644 (file)
@@ -38,7 +38,6 @@ if ENABLE_AUTH
 SUBDIRS += auth
 AUTH_LIBS= auth/libauth.la
 AUTH_ACL_LIBS= auth/libacls.la
-check_PROGRAMS += tests/testACLMaxUserIP
 endif
 DIST_SUBDIRS += auth
 
@@ -866,17 +865,13 @@ TESTSOURCES= \
 ## - place stubs etc. requiredd to link in nodist_*_SOURCES
 ## - add other component .(h|cc) files needed to link and run tests
 ##
-## NP: (TESTSOURCES) defines stub debugs() and new/delete for testing
-##
 #check_PROGRAMS += tests/testX
 #tests_testX_SOURCES= \
 #      tests/testX.cc \
-#      tests/testX.h \
-#      X.cc \
-#      X.h
+#      tests/testX.h
 #nodist_tests_testX_SOURCES= \
-#      tests/stubs_as_needed.cc \
-#      $(TESTSOURCES)
+#      X.cc \
+#      tests/stubs_as_needed.cc
 #tests_testX_LDADD=\
 #      $(LIBCPPUNIT_LIBS) \
 #      $(COMPAT_LIB) \
@@ -908,12 +903,8 @@ tests_testMem_SOURCES = \
        tests/testMem.cc \
        tests/testMem.h
 nodist_tests_testMem_SOURCES = \
-       tests/stub_debug.cc \
-       tests/stub_SBuf.cc \
-       tests/stub_time.cc \
-       $(TESTSOURCES)
-tests_testMem_LDADD= \
-       base/libbase.la \
+       tests/stub_time.cc
+tests_testMem_LDADD = \
        mem/libmem.la \
        $(top_builddir)/lib/libmiscutil.la \
        $(LIBCPPUNIT_LIBS) \
@@ -928,14 +919,8 @@ tests_testCharacterSet_SOURCES = \
        tests/testCharacterSet.cc \
        tests/testCharacterSet.h
 nodist_tests_testCharacterSet_SOURCES = \
-       base/CharacterSet.h \
-       tests/stub_cbdata.cc \
-       tests/stub_debug.cc \
-       tests/stub_libmem.cc \
-       tests/stub_MemBuf.cc \
-       tests/stub_SBuf.cc \
-       $(TESTSOURCES)
-tests_testCharacterSet_LDADD= \
+       base/CharacterSet.h
+tests_testCharacterSet_LDADD = \
        base/libbase.la \
        $(LIBCPPUNIT_LIBS) \
        $(COMPAT_LIB) \
@@ -944,16 +929,11 @@ tests_testCharacterSet_LDFLAGS = $(LIBADD_DL)
 
 check_PROGRAMS += tests/testEnumIterator
 tests_testEnumIterator_SOURCES = \
-       base/EnumIterator.h \
-       tests/stub_debug.cc \
-       tests/stub_libmem.cc \
-       tests/stub_SBuf.cc \
-       tests/testEnumIterator.h \
-       tests/testEnumIterator.cc
+       tests/testEnumIterator.cc \
+       tests/testEnumIterator.h
 nodist_tests_testEnumIterator_SOURCES = \
-       $(TESTSOURCES)
+       base/EnumIterator.h
 tests_testEnumIterator_LDADD = \
-       base/libbase.la \
        $(LIBCPPUNIT_LIBS) \
        $(COMPAT_LIB) \
        $(XTRA_LIBS)
@@ -961,13 +941,13 @@ tests_testEnumIterator_LDFLAGS = $(LIBADD_DL)
 
 check_PROGRAMS += tests/testLookupTable
 tests_testLookupTable_SOURCES = \
-       tests/testLookupTable.h \
        tests/testLookupTable.cc \
+       tests/testLookupTable.h
+nodist_tests_testLookupTable_SOURCES = \
+       base/LookupTable.h \
        tests/stub_debug.cc \
        tests/stub_libmem.cc \
-       tests/stub_SBufDetailedStats.cc \
-       base/LookupTable.h
-nodist_tests_testLookupTable_SOURCES = $(TESTSOURCES)
+       tests/stub_SBufDetailedStats.cc
 tests_testLookupTable_LDADD = \
        sbuf/libsbuf.la \
        base/libbase.la \
@@ -976,19 +956,13 @@ tests_testLookupTable_LDADD = \
        $(XTRA_LIBS)
 tests_testLookupTable_LDFLAGS = $(LIBADD_DL)
 
-check_PROGRAMS += testRefCount
-testRefCount_SOURCES= \
-       base/Lock.h \
-       base/RefCount.h \
+check_PROGRAMS += tests/testRefCount
+## TODO: make this use cppunit tests
+tests_testRefCount_SOURCES = \
        tests/testRefCount.cc
-nodist_testRefCount_SOURCES= \
-       tests/stub_cbdata.cc \
-       tests/stub_debug.cc \
-       tests/stub_libmem.cc \
-       tests/stub_MemBuf.cc
-testRefCount_LDADD = \
-       base/libbase.la \
-       $(top_builddir)/lib/libmiscutil.la \
+nodist_tests_testRefCount_SOURCES = \
+       base/RefCount.h
+tests_testRefCount_LDADD = \
        $(COMPAT_LIB) \
        $(XTRA_LIBS)
 tests_testRefCount_LDFLAGS = $(LIBADD_DL)
@@ -998,12 +972,10 @@ tests_testYesNoNone_SOURCES = \
        tests/testYesNoNone.cc \
        tests/testYesNoNone.h
 nodist_tests_testYesNoNone_SOURCES = \
-       tests/STUB.h \
+       base/YesNoNone.h \
        tests/stub_debug.cc \
-       tests/stub_libmem.cc \
-       tests/stub_SBuf.cc \
-       base/YesNoNone.h
-tests_testYesNoNone_LDADD= \
+       tests/stub_SBuf.cc
+tests_testYesNoNone_LDADD = \
        base/libbase.la \
        $(LIBCPPUNIT_LIBS) \
        $(COMPAT_LIB) \
@@ -1013,235 +985,31 @@ tests_testYesNoNone_LDFLAGS = $(LIBADD_DL)
 ## Tests of anyp/*
 
 check_PROGRAMS += tests/testURL
-## TODO: Trim this down once the insanity is over.
 tests_testURL_SOURCES = \
-       AccessLogEntry.cc \
-       BodyPipe.cc \
-       cache_cf.h \
-       AuthReg.h \
-       RefreshPattern.h \
-       cache_cf.cc \
-       tests/stub_cache_manager.cc \
-       CacheDigest.h \
-       tests/stub_CacheDigest.cc \
-       CachePeer.cc \
-       CachePeer.h \
-       carp.h \
-       tests/stub_carp.cc \
-       cbdata.cc \
-       client_db.h \
-       client_db.cc \
-       client_side.h \
-       client_side.cc \
-       client_side_reply.cc \
-       client_side_request.cc \
-       ClientInfo.h \
-       clientStream.cc \
-       tests/stub_CollapsedForwarding.cc \
-       ConfigOption.cc \
-       ConfigParser.cc \
-       CpuAffinityMap.cc \
-       CpuAffinityMap.h \
-       CpuAffinitySet.cc \
-       CpuAffinitySet.h \
-       $(DELAY_POOL_SOURCE) \
-       fs_io.h \
-       fs_io.cc \
-       dlink.h \
-       dlink.cc \
-       $(DNSSOURCE) \
-       errorpage.cc \
-       ETag.cc \
-       event.cc \
-       external_acl.cc \
-       ExternalACLEntry.cc \
-       fatal.h \
-       tests/stub_fatal.cc \
-       fd.h \
-       fd.cc \
-       fde.cc \
-       FileMap.h \
-       filemap.cc \
-       fqdncache.h \
-       fqdncache.cc \
-       FwdState.cc \
-       FwdState.h \
-       gopher.h \
-       gopher.cc \
-       helper.cc \
-       hier_code.h \
-       $(HTCPSOURCE) \
-       http.cc \
-       HttpBody.h \
-       HttpBody.cc \
-       tests/stub_HttpControlMsg.cc \
-       HttpHeaderFieldStat.h \
-       HttpHdrCc.h \
-       HttpHdrCc.cc \
-       HttpHdrContRange.cc \
-       HttpHdrRange.cc \
-       HttpHdrSc.cc \
-       HttpHdrScTarget.cc \
-       HttpHeader.h \
-       HttpHeader.cc \
-       HttpHeaderFieldInfo.h \
-       HttpHeaderTools.h \
-       HttpHeaderTools.cc \
-       HttpReply.cc \
-       PeerPoolMgr.h \
-       PeerPoolMgr.cc \
-       RequestFlags.h \
-       RequestFlags.cc \
-       HttpRequest.cc \
-       icp_v2.cc \
-       icp_v3.cc \
-       $(IPC_SOURCE) \
-       ipcache.cc \
-       int.h \
-       int.cc \
-       internal.h \
-       internal.cc \
-       tests/stub_libeui.cc \
-       LogTags.cc \
-       MasterXaction.cc \
-       MasterXaction.h \
-       multicast.h \
-       multicast.cc \
-       mem_node.cc \
-       MemBuf.cc \
-       MemObject.cc \
-       mime.h \
-       mime.cc \
-       mime_header.h \
-       mime_header.cc \
-       neighbors.h \
-       neighbors.cc \
-       Notes.h \
-       Notes.cc \
-       Parsing.cc \
-       pconn.cc \
-       peer_digest.cc \
-       peer_proxy_negotiate_auth.h \
-       peer_proxy_negotiate_auth.cc \
-       peer_select.cc \
-       peer_sourcehash.h \
-       peer_sourcehash.cc \
-       peer_userhash.h \
-       peer_userhash.cc \
-       Pipeline.cc \
-       Pipeline.h \
-       redirect.h \
-       tests/stub_redirect.cc \
-       refresh.h \
-       refresh.cc \
-       RemovalPolicy.cc \
-       tests/stub_SBufDetailedStats.cc \
-       $(SNMP_SOURCE) \
-       SquidMath.h \
-       SquidMath.cc \
-       IoStats.h \
-       stat.h \
-       stat.cc \
-       StatCounters.h \
-       StatCounters.cc \
-       StatHist.h \
-       tests/stub_StatHist.cc \
-       stmem.cc \
-       repl_modules.h \
-       store.cc \
-       store_client.cc \
-       store_digest.h \
-       tests/stub_store_digest.cc \
-       store_io.cc \
-       store_key_md5.h \
-       store_key_md5.cc \
-       store_log.h \
-       store_log.cc \
-       store_rebuild.h \
-       store_rebuild.cc \
-       store_swapin.h \
-       store_swapin.cc \
-       store_swapmeta.cc \
-       store_swapout.cc \
-       StoreFileSystem.cc \
-       StoreIOState.cc \
-       tests/stub_StoreMeta.cc \
-       StoreMetaUnpacker.cc \
-       StoreSwapLogData.cc \
-       String.cc \
-       StrList.h \
-       StrList.cc \
-       Transients.cc \
-       tests/stub_SwapDir.cc \
-       MemStore.cc \
-       tests/stub_debug.cc \
-       tests/stub_libauth_acls.cc \
-       tests/stub_libauth.cc \
-       tests/stub_libdiskio.cc \
-       tests/stub_libmem.cc \
-       tests/stub_libsecurity.cc \
-       tests/stub_main_cc.cc \
-       tests/stub_ipc_Forwarder.cc \
-       tests/stub_store_stats.cc \
        tests/testURL.cc \
        tests/testURL.h \
        tests/testUriScheme.cc \
-       tests/testUriScheme.h \
-       tests/stub_time.cc \
-       tests/stub_EventLoop.cc \
-       tools.h \
-       tools.cc \
-       tests/stub_tunnel.cc \
-       urn.h \
-       urn.cc \
-       wccp2.h \
-       tests/stub_wccp2.cc \
-       whois.h \
-       tests/stub_whois.cc \
-       FadingCounter.cc \
-       $(WIN32_SOURCE) \
-       wordlist.h \
-       wordlist.cc
+       tests/testUriScheme.h
 nodist_tests_testURL_SOURCES = \
-       $(BUILT_SOURCES)
+       anyp/Uri.h \
+       anyp/UriScheme.h \
+       String.cc \
+       tests/stub_access_log.cc \
+       tests/stub_cbdata.cc \
+       tests/stub_debug.cc \
+       tests/stub_HelperChildConfig.cc \
+       tests/stub_HttpHeader.cc \
+       tests/stub_HttpRequest.cc \
+       tests/stub_libhttp.cc \
+       tests/stub_libmem.cc \
+       tests/stub_StatHist.cc
 tests_testURL_LDADD = \
        libsquid.la \
-       clients/libclients.la \
-       servers/libservers.la \
-       helper/libhelper.la \
-       http/libhttp.la \
-       ftp/libftp.la \
-       parser/libparser.la \
        anyp/libanyp.la \
-       ident/libident.la \
-       acl/libacls.la \
-       eui/libeui.la \
-       acl/libstate.la \
-       acl/libapi.la \
-       dns/libdns.la \
        base/libbase.la \
        ip/libip.la \
-       fs/libfs.la \
-       $(SSL_LIBS) \
-       ipc/libipc.la \
-       mgr/libmgr.la \
-       $(SNMP_LIBS) \
-       icmp/libicmp.la \
-       comm/libcomm.la \
-       log/liblog.la \
-       format/libformat.la \
-       store/libstore.la \
        sbuf/libsbuf.la \
-       $(REGEXLIB) \
-       $(REPL_OBJS) \
-       $(ADAPTATION_LIBS) \
-       $(ESI_LIBS) \
-       $(top_builddir)/lib/libmisccontainers.la \
        $(top_builddir)/lib/libmiscencoding.la \
-       $(top_builddir)/lib/libmiscutil.la \
-       $(NETTLELIB) \
-       $(SSLLIB) \
-       $(KRB5LIBS) \
        $(LIBCPPUNIT_LIBS) \
        $(COMPAT_LIB) \
        $(XTRA_LIBS)
@@ -1250,43 +1018,32 @@ tests_testURL_LDFLAGS = $(LIBADD_DL)
 ## Tests of dns/*
 
 check_PROGRAMS += tests/testDns
-tests_testDns_SOURCES= \
+tests_testDns_SOURCES = \
        tests/testRFC1035.cc \
        tests/testRFC1035.h
-nodist_tests_testDns_SOURCES= \
-       tests/stub_debug.cc \
-       tests/stub_libmem.cc \
-       tests/stub_SBuf.cc \
-       tests/stub_tools.cc
-tests_testDns_LDADD= \
+nodist_tests_testDns_SOURCES=
+tests_testDns_LDADD = \
        dns/libdns.la \
-       base/libbase.la \
-       $(top_builddir)/lib/libmiscutil.la \
        $(LIBCPPUNIT_LIBS) \
        $(COMPAT_LIB) \
        $(XTRA_LIBS)
-tests_testDns_LDFLAGS= $(LIBADD_DL)
+tests_testDns_LDFLAGS = $(LIBADD_DL)
 
 ## Tests of parser/*
 
 check_PROGRAMS += tests/testTokenizer
 tests_testTokenizer_SOURCES = \
-       tests/testTokenizer.h \
-       tests/testTokenizer.cc
+       tests/testTokenizer.cc \
+       tests/testTokenizer.h
 nodist_tests_testTokenizer_SOURCES = \
        parser/Tokenizer.h \
-       SquidString.h \
-       String.cc \
-       $(TESTSOURCES) \
        tests/stub_debug.cc \
        tests/stub_libmem.cc \
-       tests/stub_time.cc \
-       tests/stub_SBufDetailedStats.cc
+       tests/stub_StatHist.cc
 tests_testTokenizer_LDADD = \
        parser/libparser.la \
-       base/libbase.la \
        sbuf/libsbuf.la \
-       $(top_builddir)/lib/libmiscutil.la \
+       base/libbase.la \
        $(LIBCPPUNIT_LIBS) \
        $(COMPAT_LIB) \
        $(XTRA_LIBS)
@@ -1295,18 +1052,16 @@ tests_testTokenizer_LDFLAGS = $(LIBADD_DL)
 ## Tests of sbuf/* and String handling objects
 
 check_PROGRAMS += tests/testSBuf
-tests_testSBuf_SOURCES= \
-       tests/testSBuf.h \
-       tests/testSBuf.cc \
-       tests/SBufFindTest.h \
+tests_testSBuf_SOURCES = \
        tests/SBufFindTest.cc \
-       tests/stub_SBufDetailedStats.cc \
-       tests/stub_time.cc \
+       tests/SBufFindTest.h \
+       tests/testSBuf.cc \
+       tests/testSBuf.h
+nodist_tests_testSBuf_SOURCES = \
        tests/stub_debug.cc \
-       tests/stub_fatal.cc \
-       tests/stub_libmem.cc
-nodist_tests_testSBuf_SOURCES=$(TESTSOURCES)
-tests_testSBuf_LDADD= \
+       tests/stub_libmem.cc \
+       tests/stub_StatHist.cc
+tests_testSBuf_LDADD = \
        sbuf/libsbuf.la \
        base/libbase.la \
        $(LIBCPPUNIT_LIBS) \
@@ -1315,16 +1070,14 @@ tests_testSBuf_LDADD= \
 tests_testSBuf_LDFLAGS = $(LIBADD_DL)
 
 check_PROGRAMS += tests/testSBufList
-tests_testSBufList_SOURCES= \
-       tests/testSBufList.h \
+tests_testSBufList_SOURCES = \
        tests/testSBufList.cc \
-       tests/stub_SBufDetailedStats.cc \
-       tests/stub_time.cc \
+       tests/testSBufList.h
+nodist_tests_testSBufList_SOURCES = \
        tests/stub_debug.cc \
-       tests/stub_fatal.cc \
-       tests/stub_libmem.cc
-nodist_tests_testSBufList_SOURCES=$(TESTSOURCES)
-tests_testSBufList_LDADD=\
+       tests/stub_libmem.cc \
+       tests/stub_StatHist.cc
+tests_testSBufList_LDADD = \
        sbuf/libsbuf.la \
        base/libbase.la \
        $(LIBCPPUNIT_LIBS) \
@@ -1333,38 +1086,16 @@ tests_testSBufList_LDADD=\
 tests_testSBufList_LDFLAGS = $(LIBADD_DL)
 
 check_PROGRAMS += tests/testString
-## string needs mem.cc.
-## mem.cc needs ClientInfo.h
-## libsquid pulls in SquidConfig and children. stub them.
 tests_testString_SOURCES = \
-       ClientInfo.h \
-       MemBuf.cc \
-       String.cc \
-       tests/stub_SBufDetailedStats.cc \
        tests/testString.cc \
-       tests/testString.h \
-       cache_cf.h \
-       tests/stub_cache_cf.cc \
-       tests/stub_cache_manager.cc \
-       tests/stub_cbdata.cc \
-       tests/stub_debug.cc \
-       tests/stub_HelperChildConfig.cc \
-       tests/stub_libmem.cc \
-       tools.h \
-       tests/stub_tools.cc \
-       tests/stub_time.cc \
-       wordlist.h \
-       wordlist.cc
+       tests/testString.h
 nodist_tests_testString_SOURCES = \
-       $(TESTSOURCES)
+       String.cc \
+       tests/stub_SBuf.cc \
+       tests/stub_debug.cc \
+       tests/stub_libmem.cc
 tests_testString_LDADD = \
        base/libbase.la \
-       libsquid.la \
-       ip/libip.la \
-       sbuf/libsbuf.la \
-       $(top_builddir)/lib/libmiscutil.la \
-       $(REGEXLIB) \
-       $(SSLLIB) \
        $(LIBCPPUNIT_LIBS) \
        $(COMPAT_LIB) \
        $(XTRA_LIBS)
@@ -1459,7 +1190,6 @@ tests_testRock_SOURCES = \
        tests/stub_access_log.cc \
        cache_cf.h \
        tests/stub_cache_cf.cc \
-       client_db.h \
        tests/stub_cache_manager.cc \
        tests/stub_client_db.cc \
        tests/stub_client_side_request.cc \
@@ -1965,7 +1695,7 @@ tests_testDiskIO_SOURCES = \
        String.cc \
        StrList.h \
        StrList.cc \
-       tests/stub_SwapDir.cc \
+       tests/stub_libstore.cc \
        Transients.cc \
        log/access_log.h \
        tests/stub_access_log.cc \
@@ -2062,132 +1792,53 @@ tests_testDiskIO_LDFLAGS = $(LIBADD_DL)
 
 ## Tests of auth/*
 
-tests_testACLMaxUserIP_SOURCES= \
-       cbdata.cc \
-       ClientInfo.h \
-       tests/stub_CollapsedForwarding.cc \
-       ConfigOption.cc \
+if ENABLE_AUTH
+check_PROGRAMS += tests/testACLMaxUserIP
+tests_testACLMaxUserIP_SOURCES = \
+       tests/testACLMaxUserIP.cc \
+       tests/testACLMaxUserIP.h
+nodist_tests_testACLMaxUserIP_SOURCES = \
        ConfigParser.cc \
-       tests/stub_ETag.cc \
-       event.cc \
-       fatal.h \
-       tests/stub_fatal.cc \
-       FileMap.h \
-       filemap.cc \
-       HttpBody.cc \
-       HttpHeader.h \
-       HttpHeader.cc \
-       HttpHeaderFieldInfo.h \
-       HttpHeaderTools.h \
-       HttpHeaderTools.cc \
-       HttpHdrContRange.cc \
-       HttpHdrRange.cc \
-       HttpHeaderFieldStat.h \
-       HttpHdrCc.h \
-       HttpHdrCc.cc \
-       HttpHdrSc.cc \
-       HttpHdrScTarget.cc \
-       int.h \
-       int.cc \
-       MasterXaction.cc \
-       MasterXaction.h \
-       Notes.cc \
-       Notes.h \
-       mem_node.cc \
+       dlink.cc \
+       globals.cc \
        Parsing.cc \
-       tests/stub_libsecurity.cc \
-       SquidMath.cc \
-       StatCounters.cc \
-       StatCounters.h \
-       StatHist.h \
-       StrList.h \
-       StrList.cc \
-       tests/stub_StatHist.cc \
-       stmem.cc \
-       tests/stub_SBufDetailedStats.cc \
        String.cc \
-       StoreIOState.cc \
-       tests/stub_StoreMeta.cc \
-       StoreMetaUnpacker.cc \
-       StoreSwapLogData.cc \
-       store_key_md5.h \
-       store_key_md5.cc \
-       swap_log_op.cc \
-       swap_log_op.h \
-       tests/stub_SwapDir.cc \
-       Transients.cc \
-       log/access_log.h \
        tests/stub_access_log.cc \
-       cache_cf.h \
        tests/stub_cache_cf.cc \
+       tests/stub_cbdata.cc \
        tests/stub_client_side.cc \
        tests/stub_debug.cc \
-       tests/stub_DelayId.cc \
        tests/stub_errorpage.cc \
-       fd.h \
-       tests/stub_fd.cc \
+       tests/stub_fatal.cc \
+       tests/stub_HelperChildConfig.cc \
+       tests/stub_HttpHeader.cc \
        tests/stub_HttpRequest.cc \
-       tests/stub_HttpReply.cc \
-       tests/stub_ipc_TypedMsgHdr.cc \
        tests/stub_libauth.cc \
-       tests/stub_libcomm.cc \
-       tests/stub_libdiskio.cc \
-       tests/stub_libformat.cc \
+       tests/stub_libhttp.cc \
        tests/stub_libmem.cc \
-       tests/stub_libsslsquid.cc \
-       tests/stub_MemObject.cc \
-       tests/stub_MemStore.cc \
-       mime.h \
-       tests/stub_mime.cc \
-       tests/stub_pconn.cc \
-       tests/stub_Port.cc \
-       repl_modules.h \
-       tests/stub_store.cc \
-       tests/stub_store_client.cc \
-       store_rebuild.h \
-       tests/stub_store_rebuild.cc \
-       tests/stub_store_stats.cc \
-       tests/stub_store_swapout.cc \
-       tools.h \
-       tests/stub_tools.cc \
-       tests/stub_cache_manager.cc \
-       tests/stub_UdsOp.cc \
-       tests/testACLMaxUserIP.cc \
-       tests/testACLMaxUserIP.h \
-       tests/stub_time.cc \
-       tests/stub_libanyp.cc \
-       MemBuf.cc \
-       wordlist.h \
-       wordlist.cc
-nodist_tests_testACLMaxUserIP_SOURCES= \
-       $(TESTSOURCES)
-tests_testACLMaxUserIP_LDADD= \
-       libsquid.la \
-       helper/libhelper.la \
-       http/libhttp.la \
-       parser/libparser.la \
+       tests/stub_libsecurity.cc \
+       tests/stub_MemBuf.cc \
+       tests/stub_StatHist.cc
+tests_testACLMaxUserIP_LDADD = \
        $(AUTH_ACL_LIBS) \
-       ident/libident.la \
-       acl/libacls.la \
-       eui/libeui.la \
-       acl/libstate.la \
        acl/libapi.la \
-       anyp/libanyp.la \
-       base/libbase.la \
+       acl/libstate.la \
+       acl/libacls.la \
+       SquidConfig.o \
        ip/libip.la \
-       ipc/libipc.la \
-       mgr/libmgr.la \
+       parser/libparser.la \
        sbuf/libsbuf.la \
-       $(top_builddir)/lib/libmisccontainers.la \
-       $(top_builddir)/lib/libmiscencoding.la \
-       $(top_builddir)/lib/libmiscutil.la \
-       $(NETTLELIB) \
-       $(REGEXLIB) \
+       base/libbase.la \
        $(SSLLIB) \
        $(LIBCPPUNIT_LIBS) \
        $(COMPAT_LIB) \
        $(XTRA_LIBS)
 tests_testACLMaxUserIP_LDFLAGS = $(LIBADD_DL)
+else
+EXTRA_DIST += \
+       tests/testACLMaxUserIP.cc \
+       tests/testACLMaxUserIP.h
+endif
 
 ## Tests of http/* and HTTP Protocol objects
 
@@ -2207,8 +1858,7 @@ tests_test_http_range_SOURCES = \
        carp.h \
        tests/stub_carp.cc \
        cbdata.cc \
-       client_db.h \
-       client_db.cc \
+       tests/stub_client_db.cc \
        client_side.h \
        client_side.cc \
        client_side_reply.cc \
@@ -2246,7 +1896,7 @@ tests_test_http_range_SOURCES = \
        FwdState.cc \
        FwdState.h \
        gopher.h \
-       gopher.cc \
+       tests/stub_gopher.cc \
        helper.cc \
        hier_code.h \
        $(HTCPSOURCE) \
@@ -2350,7 +2000,7 @@ tests_test_http_range_SOURCES = \
        String.cc \
        StrList.h \
        StrList.cc \
-       tests/stub_SwapDir.cc \
+       tests/stub_libstore.cc \
        Transients.cc \
        tests/test_http_range.cc \
        tests/stub_external_acl.cc \
@@ -2606,8 +2256,7 @@ tests_testHttpRequest_SOURCES = \
        carp.h \
        tests/stub_carp.cc \
        cbdata.cc \
-       client_db.h \
-       client_db.cc \
+       tests/stub_client_db.cc \
        client_side.h \
        client_side.cc \
        client_side_reply.cc \
@@ -2641,7 +2290,7 @@ tests_testHttpRequest_SOURCES = \
        FwdState.cc \
        FwdState.h \
        gopher.h \
-       gopher.cc \
+       tests/stub_gopher.cc \
        helper.cc \
        hier_code.h \
        $(HTCPSOURCE) \
@@ -2747,7 +2396,7 @@ tests_testHttpRequest_SOURCES = \
        tools.cc \
        Transients.cc \
        tests/stub_tunnel.cc \
-       tests/stub_SwapDir.cc \
+       tests/stub_libstore.cc \
        MemStore.cc \
        urn.h \
        urn.cc \
@@ -2807,21 +2456,21 @@ tests_testHttpRequest_LDFLAGS = $(LIBADD_DL)
 ## Tests of ip/*
 
 check_PROGRAMS += tests/testIpAddress
-tests_testIpAddress_SOURCES= \
-       tests/testAddress.cc \
-       tests/testAddress.h
-nodist_tests_testIpAddress_SOURCES= \
-       ip/Address.h \
+tests_testIpAddress_SOURCES = \
+       tests/testIpAddress.cc \
+       tests/testIpAddress.h
+nodist_tests_testIpAddress_SOURCES = \
        tests/stub_debug.cc \
        tests/stub_libmem.cc \
+       tests/stub_SBuf.cc \
        tests/stub_tools.cc
-tests_testIpAddress_LDADD= \
+tests_testIpAddress_LDADD = \
        ip/libip.la \
        base/libbase.la \
        $(LIBCPPUNIT_LIBS) \
        $(COMPAT_LIB) \
        $(XTRA_LIBS)
-tests_testIpAddress_LDFLAGS= $(LIBADD_DL)
+tests_testIpAddress_LDFLAGS = $(LIBADD_DL)
 
 ## Tests of icmp/*
 
@@ -2899,8 +2548,7 @@ tests_testCacheManager_SOURCES = \
        carp.h \
        tests/stub_carp.cc \
        cbdata.cc \
-       client_db.h \
-       client_db.cc \
+       tests/stub_client_db.cc \
        client_side.h \
        client_side.cc \
        client_side_reply.cc \
@@ -2937,7 +2585,7 @@ tests_testCacheManager_SOURCES = \
        FwdState.cc \
        FwdState.h \
        gopher.h \
-       gopher.cc \
+       tests/stub_gopher.cc \
        hier_code.h \
        helper.cc \
        $(HTCPSOURCE) \
@@ -3043,7 +2691,7 @@ tests_testCacheManager_SOURCES = \
        tools.cc \
        Transients.cc \
        tests/stub_tunnel.cc \
-       tests/stub_SwapDir.cc \
+       tests/stub_libstore.cc \
        MemStore.cc \
        $(UNLINKDSOURCE) \
        urn.h \
@@ -3200,8 +2848,7 @@ tests_testEvent_SOURCES = \
        carp.h \
        tests/stub_carp.cc \
        cbdata.cc \
-       client_db.h \
-       client_db.cc \
+       tests/stub_client_db.cc \
        client_side.h \
        client_side.cc \
        client_side_reply.cc \
@@ -3242,7 +2889,7 @@ tests_testEvent_SOURCES = \
        FwdState.cc \
        FwdState.h \
        gopher.h \
-       gopher.cc \
+       tests/stub_gopher.cc \
        helper.cc \
        hier_code.h \
        $(HTCPSOURCE) \
@@ -3347,7 +2994,7 @@ tests_testEvent_SOURCES = \
        StoreMetaUnpacker.cc \
        StoreSwapLogData.cc \
        String.cc \
-       tests/stub_SwapDir.cc \
+       tests/stub_libstore.cc \
        tests/CapturingStoreEntry.h \
        tests/testEvent.cc \
        tests/testEvent.h \
@@ -3434,8 +3081,7 @@ tests_testEventLoop_SOURCES = \
        carp.h \
        tests/stub_carp.cc \
        cbdata.cc \
-       client_db.h \
-       client_db.cc \
+       tests/stub_client_db.cc \
        client_side.h \
        client_side.cc \
        client_side_reply.cc \
@@ -3476,7 +3122,7 @@ tests_testEventLoop_SOURCES = \
        FwdState.cc \
        FwdState.h \
        gopher.h \
-       gopher.cc \
+       tests/stub_gopher.cc \
        helper.cc \
        hier_code.h \
        $(HTCPSOURCE) \
@@ -3580,7 +3226,7 @@ tests_testEventLoop_SOURCES = \
        String.cc \
        StrList.h \
        StrList.cc \
-       tests/stub_SwapDir.cc \
+       tests/stub_libstore.cc \
        tests/testEventLoop.cc \
        tests/testEventLoop.h \
        tests/stub_main_cc.cc \
index a6ee09775dae2eba939d50ecb4df7375850d09bc..82ea63630fa6eec75668273d0265a4c4f8f66186 100644 (file)
@@ -37,6 +37,7 @@ libbase_la_SOURCES = \
        Packable.h \
        PackableStream.h \
        Range.h \
+       RefCount.h \
        RegexPattern.cc \
        RegexPattern.h \
        RunnersRegistry.cc \
index fc4231c707ba975feed829d72efa14e8ac9ca8f8..7eec6d995cb366f2a0817edaf6b6880aeb3c93f4 100644 (file)
 #include "anyp/ProtocolType.h"
 #include "ip/Address.h"
 #include "LogTags.h"
+#if SQUID_SNMP
+#include "cache_snmp.h"
+#include "snmp_vars.h"
+#endif
 
 namespace Ip
 {
@@ -36,6 +40,7 @@ ClientInfo * clientdbGetInfo(const Ip::Address &addr);
 
 #if SQUID_SNMP
 Ip::Address *client_entry(Ip::Address *current);
+variable_list *snmp_meshCtblFn(variable_list *, snint *);
 #endif
 
 #endif /* SQUID_CLIENT_DB_H_ */
index d56889f2002bb9db0c741d38376a3697d495dab9..4268a8e13e96af7d07aa915b68c4b7b23142c72d 100644 (file)
@@ -24,7 +24,6 @@ variable_list *snmp_netIpFn(variable_list *, snint *);
 variable_list *snmp_netFqdnFn(variable_list *, snint *);
 variable_list *snmp_netDnsFn(variable_list *, snint *);
 variable_list *snmp_meshPtblFn(variable_list *, snint *);
-variable_list *snmp_meshCtblFn(variable_list *, snint *);
 
 #endif /* SQUID_SNMP */
 #endif /* SQUID_SNMP_AGENT_H_ */
index f22dd50535dd77dc34e088faba906cf0323093ab..474f777ec87f544516d803fdc040ea5181642abe 100644 (file)
@@ -29,10 +29,12 @@ STUB_SOURCE= tests/STUB.h \
        tests/stub_external_acl.cc \
        tests/stub_fatal.cc \
        tests/stub_fd.cc \
+       tests/stub_gopher.cc \
        tests/stub_helper.cc \
        tests/stub_HelperChildConfig.cc \
        tests/stub_http.cc \
        tests/stub_HttpControlMsg.cc \
+       tests/stub_HttpHeader.cc \
        tests/stub_HttpReply.cc \
        tests/stub_HttpRequest.cc \
        tests/stub_icp.cc \
@@ -48,6 +50,7 @@ STUB_SOURCE= tests/STUB.h \
        tests/stub_libdiskio.cc \
        tests/stub_libeui.cc \
        tests/stub_libformat.cc \
+       tests/stub_libhttp.cc \
        tests/stub_libicmp.cc \
        tests/stub_libip.cc \
        tests/stub_liblog.cc \
@@ -55,6 +58,7 @@ STUB_SOURCE= tests/STUB.h \
        tests/stub_libmgr.cc \
        tests/stub_libsecurity.cc \
        tests/stub_libsslsquid.cc \
+       tests/stub_libstore.cc \
        tests/stub_main_cc.cc \
        tests/stub_MemBuf.cc \
        tests/stub_mem_node.cc \
@@ -77,7 +81,6 @@ STUB_SOURCE= tests/STUB.h \
        tests/stub_store_rebuild.cc \
        tests/stub_store_stats.cc \
        tests/stub_store_swapout.cc \
-       tests/stub_SwapDir.cc \
        tests/stub_time.cc \
        tests/stub_tools.cc \
        tests/stub_tunnel.cc \
index 0edf69a35afb4f9716d5ebb9c859ad7d42042589..4a120009469f8637f909d20107824915e7d05182 100644 (file)
@@ -39,19 +39,7 @@ Helper::ChildConfig::ChildConfig(const unsigned int m):
     defaultQueueSize(true)
 {}
 
-int
-Helper::ChildConfig::needNew() const
-{
-    /* during the startup and reconfigure use our special amount... */
-    if (starting_up || reconfiguring) return n_startup;
-
-    /* keep a minimum of n_idle helpers free... */
-    if ( (n_active + n_idle) < n_max) return n_idle;
-
-    /* do not ever start more than n_max processes. */
-    return (n_max - n_active);
-}
-
+int Helper::ChildConfig::needNew() const STUB_RETVAL(0)
 void Helper::ChildConfig::parseConfig() STUB
 Helper::ChildConfig & Helper::ChildConfig::updateLimits(const Helper::ChildConfig &) STUB_RETVAL(*this)
 
diff --git a/src/tests/stub_HttpHeader.cc b/src/tests/stub_HttpHeader.cc
new file mode 100644 (file)
index 0000000..5bd5d1e
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#include "squid.h"
+#include "ETag.h"
+#include "TimeOrTag.h"
+
+#define STUB_API "HttpHeader.cc"
+#include "STUB.h"
+
+#include "HttpHeader.h"
+HttpHeaderEntry::HttpHeaderEntry(Http::HdrType, const SBuf &, const char *) {STUB}
+HttpHeaderEntry::~HttpHeaderEntry() {STUB}
+HttpHeaderEntry *HttpHeaderEntry::parse(const char *, const char *) STUB_RETVAL(nullptr)
+HttpHeaderEntry *HttpHeaderEntry::clone() const STUB_RETVAL(nullptr)
+void HttpHeaderEntry::packInto(Packable *) const STUB
+int HttpHeaderEntry::getInt() const STUB_RETVAL(0)
+int64_t HttpHeaderEntry::getInt64() const STUB_RETVAL(0)
+HttpHeader::HttpHeader() {STUB}
+HttpHeader::HttpHeader(const http_hdr_owner_type) {STUB}
+HttpHeader::HttpHeader(const HttpHeader &) {STUB}
+HttpHeader::~HttpHeader() {STUB}
+HttpHeader &HttpHeader::operator =(const HttpHeader &other) STUB_RETVAL(*this)
+void HttpHeader::clean() STUB
+void HttpHeader::append(const HttpHeader *) STUB
+bool HttpHeader::update(HttpHeader const *) STUB_RETVAL(false)
+void HttpHeader::compact() STUB
+int HttpHeader::parse(const char *, size_t, Http::ContentLengthInterpreter &) STUB_RETVAL(-1)
+int HttpHeader::parse(const char *, size_t, bool, size_t &, Http::ContentLengthInterpreter &) STUB_RETVAL(-1)
+void HttpHeader::packInto(Packable *, bool) const STUB
+HttpHeaderEntry *HttpHeader::getEntry(HttpHeaderPos *) const STUB_RETVAL(nullptr)
+HttpHeaderEntry *HttpHeader::findEntry(Http::HdrType) const STUB_RETVAL(nullptr)
+int HttpHeader::delByName(const SBuf &) STUB_RETVAL(0)
+int HttpHeader::delById(Http::HdrType) STUB_RETVAL(0)
+void HttpHeader::delAt(HttpHeaderPos, int &) STUB
+void HttpHeader::refreshMask() STUB
+void HttpHeader::addEntry(HttpHeaderEntry *) STUB
+void HttpHeader::insertEntry(HttpHeaderEntry *) STUB
+String HttpHeader::getList(Http::HdrType) const STUB_RETVAL(String())
+bool HttpHeader::getList(Http::HdrType, String *) const STUB_RETVAL(false)
+String HttpHeader::getStrOrList(Http::HdrType) const STUB_RETVAL(String())
+String HttpHeader::getByName(const SBuf &) const STUB_RETVAL(String())
+String HttpHeader::getByName(const char *) const STUB_RETVAL(String())
+String HttpHeader::getById(Http::HdrType) const STUB_RETVAL(String())
+bool HttpHeader::getByIdIfPresent(Http::HdrType, String *) const STUB_RETVAL(false)
+bool HttpHeader::hasNamed(const SBuf &, String *) const STUB_RETVAL(false)
+bool HttpHeader::hasNamed(const char *, unsigned int, String *) const STUB_RETVAL(false)
+String HttpHeader::getByNameListMember(const char *, const char *, const char) const STUB_RETVAL(String())
+String HttpHeader::getListMember(Http::HdrType, const char *, const char) const STUB_RETVAL(String())
+int HttpHeader::has(Http::HdrType) const STUB_RETVAL(0)
+void HttpHeader::addVia(const AnyP::ProtocolVersion &, const HttpHeader *) STUB
+void HttpHeader::putInt(Http::HdrType, int) STUB
+void HttpHeader::putInt64(Http::HdrType, int64_t ) STUB
+void HttpHeader::putTime(Http::HdrType, time_t) STUB
+void HttpHeader::putStr(Http::HdrType, const char *) STUB
+void HttpHeader::putAuth(const char *, const char *) STUB
+void HttpHeader::putCc(const HttpHdrCc *) STUB
+void HttpHeader::putContRange(const HttpHdrContRange *) STUB
+void HttpHeader::putRange(const HttpHdrRange *) STUB
+void HttpHeader::putSc(HttpHdrSc *) STUB
+void HttpHeader::putWarning(const int, const char *const) STUB
+void HttpHeader::putExt(const char *, const char *) STUB
+int HttpHeader::getInt(Http::HdrType) const STUB_RETVAL(0)
+int64_t HttpHeader::getInt64(Http::HdrType) const STUB_RETVAL(0)
+time_t HttpHeader::getTime(Http::HdrType) const STUB_RETVAL(0)
+const char *HttpHeader::getStr(Http::HdrType) const STUB_RETVAL(nullptr)
+const char *HttpHeader::getLastStr(Http::HdrType) const STUB_RETVAL(nullptr)
+HttpHdrCc *HttpHeader::getCc() const STUB_RETVAL(nullptr)
+HttpHdrRange *HttpHeader::getRange() const STUB_RETVAL(nullptr)
+HttpHdrSc *HttpHeader::getSc() const STUB_RETVAL(nullptr)
+HttpHdrContRange *HttpHeader::getContRange() const STUB_RETVAL(nullptr)
+const char *HttpHeader::getAuth(Http::HdrType, const char *auth_scheme) const STUB_RETVAL(nullptr)
+ETag HttpHeader::getETag(Http::HdrType) const STUB_RETVAL(ETag())
+TimeOrTag HttpHeader::getTimeOrTag(Http::HdrType) const STUB_RETVAL(TimeOrTag())
+int HttpHeader::hasListMember(Http::HdrType, const char *, const char) const STUB_RETVAL(0)
+int HttpHeader::hasByNameListMember(const char *, const char *, const char) const STUB_RETVAL(0)
+void HttpHeader::removeHopByHopEntries() STUB
+void HttpHeader::removeConnectionHeaderEntries() STUB
+bool HttpHeader::Isolate(const char **, size_t, const char **, const char **) STUB_RETVAL(false)
+bool HttpHeader::needUpdate(const HttpHeader *fresh) const STUB_RETVAL(false)
+bool HttpHeader::skipUpdateHeader(const Http::HdrType) const STUB_RETVAL(false)
+void HttpHeader::updateWarnings() STUB
+int httpHeaderParseQuotedString(const char *, const int, String *) STUB_RETVAL(-1)
+SBuf httpHeaderQuoteString(const char *) STUB_RETVAL(SBuf())
+void httpHeaderCalcMask(HttpHeaderMask *, Http::HdrType [], size_t) STUB
+void httpHeaderInitModule() STUB
index 235d031b1964166d2141eb8fa8d224daa596f772..fdf9f003ac6764b1c484eb12cf4ac506b7b00d13 100644 (file)
@@ -24,6 +24,7 @@ HttpRequest * HttpRequest::clone() const STUB_RETVAL(NULL)
 bool HttpRequest::maybeCacheable() STUB_RETVAL(false)
 bool HttpRequest::conditional() const STUB_RETVAL(false)
 bool HttpRequest::canHandle1xx() const STUB_RETVAL(false)
+char * HttpRequest::canonicalCleanUrl() const STUB_RETVAL(nullptr)
 #if USE_ADAPTATION
 Adaptation::History::Pointer HttpRequest::adaptLogHistory() const STUB_RETVAL(Adaptation::History::Pointer())
 Adaptation::History::Pointer HttpRequest::adaptHistory(bool) const STUB_RETVAL(Adaptation::History::Pointer())
index f155857b43acf8fce7793da21528af2e8b8760ac..376099ec72c736ec29cf7e1003c781ebc44da99a 100644 (file)
@@ -30,10 +30,11 @@ SBuf::SBuf(const std::string &) {}
 SBuf::~SBuf() {}
 SBuf& SBuf::assign(const SBuf &) STUB_RETVAL(*this)
 SBuf& SBuf::assign(const char *, size_type) STUB_RETVAL(*this)
-void clear() STUB
+void SBuf::clear() STUB
 SBuf& SBuf::append(const SBuf &) STUB_RETVAL(*this)
 SBuf& SBuf::append(const char *, size_type) STUB_RETVAL(*this)
-SBuf& Printf(const char *, ...);
+SBuf& SBuf::append(const char) STUB_RETVAL(*this)
+SBuf& SBuf::Printf(const char *, ...) STUB_RETVAL(*this)
 SBuf& SBuf::appendf(const char *, ...) STUB_RETVAL(*this)
 SBuf& SBuf::vappendf(const char *, va_list) STUB_RETVAL(*this)
 std::ostream& SBuf::print(std::ostream &os) const STUB_RETVAL(os)
@@ -61,7 +62,9 @@ SBuf::size_type SBuf::find(const SBuf &, size_type) const STUB_RETVAL(SBuf::npos
 SBuf::size_type SBuf::rfind(char, size_type) const STUB_RETVAL(SBuf::npos)
 SBuf::size_type SBuf::rfind(const SBuf &, size_type) const STUB_RETVAL(SBuf::npos)
 SBuf::size_type SBuf::findFirstOf(const CharacterSet &, size_type) const STUB_RETVAL(SBuf::npos)
+SBuf::size_type SBuf::findLastOf(const CharacterSet &, size_type) const STUB_RETVAL(SBuf::npos)
 SBuf::size_type SBuf::findFirstNotOf(const CharacterSet &, size_type) const STUB_RETVAL(SBuf::npos)
+SBuf::size_type SBuf::findLastNotOf(const CharacterSet &, size_type) const STUB_RETVAL(SBuf::npos)
 void SBuf::toLower() STUB
 void SBuf::toUpper() STUB
 
index f4b9c638a7a7e6f65e508a2c9b2b50d49d12ee3b..c0451ed4bc7930a1e4fb60644c9aed341d93dee7 100644 (file)
@@ -19,6 +19,6 @@ 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 StatHist::logInit(unsigned int i, double d1, double d2) STUB_NOP
 void statHistIntDumper(StoreEntry * sentry, int idx, double val, double size, int count) STUB
 
diff --git a/src/tests/stub_SwapDir.cc b/src/tests/stub_SwapDir.cc
deleted file mode 100644 (file)
index 0bec725..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-#include "squid.h"
-#include "store/Disk.h"
-
-#define STUB_API "store/Disk.cc"
-#include "tests/STUB.h"
-
-// SwapDir::SwapDir(char const *) STUB
-// SwapDir::~SwapDir() STUB
-void SwapDir::create() STUB
-void SwapDir::dump(StoreEntry &) const STUB
-bool SwapDir::doubleCheck(StoreEntry &) STUB_RETVAL(false)
-void SwapDir::getStats(StoreInfoStats &) const STUB
-void SwapDir::stat(StoreEntry &) const STUB
-void SwapDir::statfs(StoreEntry &)const STUB
-void SwapDir::maintain() STUB
-uint64_t SwapDir::minSize() const STUB_RETVAL(0)
-int64_t SwapDir::minObjectSize() const STUB_RETVAL(0)
-int64_t SwapDir::maxObjectSize() const STUB_RETVAL(0)
-void SwapDir::maxObjectSize(int64_t) STUB
-void SwapDir::reference(StoreEntry &) STUB
-bool SwapDir::dereference(StoreEntry &) STUB_RETVAL(false)
-bool SwapDir::canStore(const StoreEntry &, int64_t, int &) const STUB_RETVAL(false)
-bool SwapDir::canLog(StoreEntry const &)const STUB_RETVAL(false)
-void SwapDir::openLog() STUB
-void SwapDir::closeLog() STUB
-int SwapDir::writeCleanStart() STUB_RETVAL(0)
-void SwapDir::writeCleanDone() STUB
-void SwapDir::logEntry(const StoreEntry &, int) const STUB
-char const * SwapDir::type() const STUB_RETVAL("stub")
-bool SwapDir::active() const STUB_RETVAL(false)
-bool SwapDir::needsDiskStrand() const STUB_RETVAL(false)
-ConfigOption * SwapDir::getOptionTree() const STUB_RETVAL(NULL)
-void SwapDir::parseOptions(int) STUB
-void SwapDir::dumpOptions(StoreEntry *) const STUB
-bool SwapDir::optionReadOnlyParse(char const *, const char *, int) STUB_RETVAL(false)
-void SwapDir::optionReadOnlyDump(StoreEntry *) const STUB
-bool SwapDir::optionObjectSizeParse(char const *, const char *, int) STUB_RETVAL(false)
-void SwapDir::optionObjectSizeDump(StoreEntry *) const STUB
-StoreEntry * SwapDir::get(const cache_key *) STUB_RETVAL(NULL)
-
index e87aff5736261e0b15e06561dec57fd0b0607939..fb2af72b78ee05e57113c51cc091685319d7f749 100644 (file)
@@ -7,14 +7,11 @@
  */
 
 #include "squid.h"
-#include "client_db.h"
 
 #define STUB_API "client_db.cc"
 #include "tests/STUB.h"
 
-class ClientInfo;
-
-void clientdbInit(void) STUB
+#include "client_db.h"
 void clientdbUpdate(const Ip::Address &, const LogTags &, AnyP::ProtocolType, size_t) STUB
 int clientdbCutoffDenied(const Ip::Address &) STUB_RETVAL(-1)
 void clientdbDump(StoreEntry *) STUB
@@ -22,8 +19,9 @@ 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) STUB
-ClientInfo *clientdbGetInfo(const Ip::Address &addr) STUB_RETVAL(NULL)
+ClientInfo *clientdbGetInfo(const Ip::Address &addr) STUB_RETVAL(nullptr)
+#endif
+#if SQUID_SNMP
+Ip::Address *client_entry(Ip::Address *) STUB_RETVAL(nullptr)
+variable_list *snmp_meshCtblFn(variable_list *, snint *) STUB_RETVAL(nullptr)
 #endif
-void clientOpenListenSockets(void) STUB
-void clientHttpConnectionsClose(void) STUB
-
diff --git a/src/tests/stub_gopher.cc b/src/tests/stub_gopher.cc
new file mode 100644 (file)
index 0000000..2f8645f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#include "squid.h"
+
+#define STUB_API "gopher.cc"
+#include "tests/STUB.h"
+
+#include "gopher.h"
+void gopherStart(FwdState *) STUB
+int gopherCachable(const HttpRequest *) STUB
diff --git a/src/tests/stub_libhttp.cc b/src/tests/stub_libhttp.cc
new file mode 100644 (file)
index 0000000..f056a4e
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#include "squid.h"
+#include "client_side.h"
+#include "comm/Connection.h"
+#include "SquidConfig.h"
+
+#define STUB_API "http/libhttp.la"
+#include "STUB.h"
+
+#include "http/ContentLengthInterpreter.h"
+namespace Http
+{
+// XXX: use C++11 initialization for this class
+Http::ContentLengthInterpreter::ContentLengthInterpreter():
+    value(-1),
+    headerWideProblem(nullptr),
+    debugLevel(Config.onoff.relaxed_header_parser <= 0 ? DBG_IMPORTANT : 2),
+    sawBad(false),
+    needsSanitizing(false),
+    sawGood(false),
+    prohibitedAndIgnored_(nullptr)
+{
+}
+bool ContentLengthInterpreter::checkField(const String &) STUB_RETVAL(false)
+bool ContentLengthInterpreter::goodSuffix(const char *, const char * const) const STUB_RETVAL(false)
+bool ContentLengthInterpreter::checkValue(const char *, const int) STUB_RETVAL(false)
+bool ContentLengthInterpreter::checkList(const String &) STUB_RETVAL(false)
+}
+
+#include "http/Message.h"
+namespace Http
+{
+Message::Message(http_hdr_owner_type) {STUB}
+Message::~Message() {STUB}
+void Message::packInto(Packable *, bool) const STUB
+void Message::setContentLength(int64_t) STUB
+bool Message::persistent() const STUB_RETVAL(false)
+void Message::putCc(const HttpHdrCc *) STUB
+bool Message::parse(const char *, const size_t, bool, Http::StatusCode *) STUB_RETVAL(false)
+bool Message::parseCharBuf(const char *, ssize_t) STUB_RETVAL(false)
+int Message::httpMsgParseStep(const char *, int, int) STUB_RETVAL(-1)
+int Message::httpMsgParseError() STUB_RETVAL(0)
+void Message::firstLineBuf(MemBuf&) STUB
+void Message::hdrCacheInit() STUB
+bool Message::parseHeader(Http1::Parser &, Http::ContentLengthInterpreter &) STUB_RETVAL(false)
+}
+
+#include "http/MethodType.h"
+namespace Http
+{
+const SBuf MethodType_sb[1] = {SBuf()};
+}
+
+#include "http/RegisteredHeaders.h"
+namespace Http
+{
+HeaderTableRecord::HeaderTableRecord() {STUB_NOP}
+HeaderTableRecord::HeaderTableRecord(const char *) {STUB_NOP}
+HeaderTableRecord::HeaderTableRecord(const char *, Http::HdrType, Http::HdrFieldType, int) {STUB}
+HeaderLookupTable_t::HeaderLookupTable_t() {STUB_NOP}
+const HeaderTableRecord& HeaderLookupTable_t::lookup(const char *, const std::size_t) const STUB_RETVAL(BadHdr)
+const HeaderLookupTable_t HeaderLookupTable;
+}
+std::ostream &operator<< (std::ostream&os, Http::HdrType) STUB_RETVAL(os)
+
+#include "http/RequestMethod.h"
+HttpRequestMethod::HttpRequestMethod(const SBuf &) {STUB}
+void HttpRequestMethod::HttpRequestMethodXXX(char const *) STUB
+const SBuf &HttpRequestMethod::image() const STUB_RETVAL(theImage)
+bool HttpRequestMethod::isHttpSafe() const STUB_RETVAL(false)
+bool HttpRequestMethod::isIdempotent() const STUB_RETVAL(false)
+bool HttpRequestMethod::respMaybeCacheable() const STUB_RETVAL(false)
+bool HttpRequestMethod::shouldInvalidate() const STUB_RETVAL(false)
+bool HttpRequestMethod::purgesOthers() const STUB_RETVAL(false)
+
+#include "http/StatusCode.h"
+namespace Http
+{
+const char *StatusCodeString(const Http::StatusCode) STUB_RETVAL(nullptr)
+}
+
+#include "http/StatusLine.h"
+namespace Http
+{
+void StatusLine::init() STUB
+void StatusLine::clean() STUB
+void StatusLine::set(const AnyP::ProtocolVersion &, Http::StatusCode, const char *) STUB
+const char *StatusLine::reason() const STUB_RETVAL(nullptr)
+void StatusLine::packInto(Packable *) const STUB
+bool StatusLine::parse(const String &, const char *, const char *) STUB_RETVAL(false)
+}
+
+#include "http/Stream.h"
+namespace Http
+{
+Stream::Stream(const Comm::ConnectionPointer &, ClientHttpRequest *) {STUB}
+Stream::~Stream() {STUB}
+void Stream::registerWithConn() STUB
+bool Stream::startOfOutput() const STUB
+void Stream::writeComplete(size_t) STUB
+void Stream::pullData() STUB
+bool Stream::multipartRangeRequest() const STUB_RETVAL(false)
+int64_t Stream::getNextRangeOffset() const STUB_RETVAL(-1)
+bool Stream::canPackMoreRanges() const STUB_RETVAL(false)
+size_t Stream::lengthToSend(Range<int64_t> const &) const STUB_RETVAL(0)
+clientStream_status_t Stream::socketState() STUB_RETVAL(STREAM_NONE)
+void Stream::sendStartOfMessage(HttpReply *, StoreIOBuffer) STUB
+void Stream::sendBody(StoreIOBuffer) STUB
+void Stream::noteSentBodyBytes(size_t) STUB
+void Stream::buildRangeHeader(HttpReply *) STUB
+clientStreamNode *Stream::getTail() const STUB_RETVAL(nullptr)
+clientStreamNode *Stream::getClientReplyContext() const STUB_RETVAL(nullptr)
+ConnStateData *Stream::getConn() const STUB_RETVAL(nullptr)
+void Stream::noteIoError(const int) STUB
+void Stream::finished() STUB
+void Stream::initiateClose(const char *) STUB
+void Stream::deferRecipientForLater(clientStreamNode *, HttpReply *, StoreIOBuffer) STUB
+}
+
diff --git a/src/tests/stub_libstore.cc b/src/tests/stub_libstore.cc
new file mode 100644 (file)
index 0000000..9d6f58a
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#include "squid.h"
+
+#define STUB_API "store/libstore.la"
+#include "tests/STUB.h"
+
+#include "store/Controller.h"
+namespace Store
+{
+Controller::Controller() {STUB_NOP}
+Controller::~Controller() {STUB_NOP}
+void Controller::create() STUB
+void Controller::init() STUB
+uint64_t Controller::maxSize() const STUB_RETVAL(0)
+uint64_t Controller::minSize() const STUB_RETVAL(0)
+uint64_t Controller::currentSize() const STUB_RETVAL(0)
+uint64_t Controller::currentCount() const STUB_RETVAL(0)
+int64_t Controller::maxObjectSize() const STUB_RETVAL(0)
+void Controller::getStats(StoreInfoStats &) const STUB
+void Controller::stat(StoreEntry &) const STUB
+void Controller::sync() STUB
+void Controller::maintain() STUB
+void Controller::evictCached(StoreEntry &) STUB
+void Controller::evictIfFound(const cache_key *) STUB
+int Controller::callback() STUB
+StoreEntry *Controller::find(const cache_key *) STUB_RETVAL(nullptr)
+StoreEntry *Controller::peek(const cache_key *) STUB_RETVAL(nullptr)
+StoreEntry *Controller::findCallbackXXX(const cache_key *) STUB_RETVAL(nullptr)
+bool Controller::markedForDeletion(const cache_key *) const STUB_RETVAL(false)
+bool Controller::markedForDeletionAndAbandoned(const StoreEntry &) const STUB_RETVAL(false)
+bool Controller::hasReadableDiskEntry(const StoreEntry &) const STUB_RETVAL(false)
+int64_t Controller::accumulateMore(StoreEntry &) const STUB_RETVAL(0)
+void Controller::updateLimits() STUB
+void Controller::handleIdleEntry(StoreEntry &) STUB
+void Controller::freeMemorySpace(const int) STUB
+void Controller::memoryOut(StoreEntry &, const bool) STUB
+void Controller::updateOnNotModified(StoreEntry *, const StoreEntry &) STUB
+bool Controller::allowCollapsing(StoreEntry *, const RequestFlags &, const HttpRequestMethod &) STUB_RETVAL(false)
+void Controller::addReading(StoreEntry *, const cache_key *) STUB
+void Controller::addWriting(StoreEntry *, const cache_key *) STUB
+bool Controller::transientsReader(const StoreEntry &) const STUB_RETVAL(false)
+bool Controller::transientsWriter(const StoreEntry &) const STUB_RETVAL(false)
+void Controller::transientsCompleteWriting(StoreEntry &) STUB
+void Controller::syncCollapsed(const sfileno) STUB
+void Controller::stopSharing(StoreEntry &) STUB
+int Controller::transientReaders(const StoreEntry &) const STUB_RETVAL(0)
+void Controller::transientsDisconnect(StoreEntry &) STUB
+void Controller::transientsClearCollapsingRequirement(StoreEntry &) STUB
+void Controller::memoryDisconnect(StoreEntry &) STUB
+StoreSearch *Controller::search() STUB_RETVAL(nullptr)
+bool Controller::SmpAware() STUB_RETVAL(false)
+int Controller::store_dirs_rebuilding = 0;
+Controller nil;
+Controller &Root() STUB_RETVAL(Store::nil)
+void Init(Controller *) STUB
+void FreeMemory() STUB
+}
+
+#include "store/Disk.h"
+namespace Store
+{
+Disk::Disk(char const *) {STUB}
+Disk::~Disk() {STUB}
+char const *Disk::type() const STUB_RETVAL(nullptr)
+bool Disk::needsDiskStrand() const STUB_RETVAL(false)
+bool Disk::active() const STUB_RETVAL(false)
+void Disk::diskFull() STUB
+void Disk::create() STUB
+StoreEntry *Disk::get(const cache_key *) STUB_RETVAL(nullptr)
+uint64_t Disk::minSize() const STUB_RETVAL(0)
+int64_t Disk::maxObjectSize() const STUB_RETVAL(0)
+void Disk::getStats(StoreInfoStats &) const STUB
+void Disk::stat(StoreEntry &) const STUB
+void Disk::reference(StoreEntry &) STUB
+bool Disk::dereference(StoreEntry &) STUB_RETVAL(false)
+void Disk::maintain() STUB
+int64_t Disk::minObjectSize() const STUB_RETVAL(0)
+void Disk::maxObjectSize(int64_t) STUB
+bool Disk::objectSizeIsAcceptable(int64_t) const STUB_RETVAL(false)
+void Disk::parseOptions(int) STUB
+void Disk::dumpOptions(StoreEntry *) const STUB
+ConfigOption *Disk::getOptionTree() const STUB_RETVAL(nullptr)
+void Disk::dump(StoreEntry &) const STUB
+bool Disk::doubleCheck(StoreEntry &) STUB_RETVAL(false)
+void Disk::statfs(StoreEntry &) const STUB
+bool Disk::canLog(StoreEntry const &) const STUB_RETVAL(false)
+void Disk::openLog() STUB
+void Disk::closeLog() STUB
+void Disk::logEntry(const StoreEntry &, int) const STUB
+int Disk::writeCleanStart() STUB_RETVAL(0)
+void Disk::writeCleanDone() STUB
+}
+
+#include "store/Disks.h"
+namespace Store
+{
+Disks::Disks() {STUB}
+void Disks::create() STUB
+void Disks::init() STUB
+StoreEntry *Disks::get(const cache_key *) STUB_RETVAL(nullptr)
+uint64_t Disks::maxSize() const STUB_RETVAL(0)
+uint64_t Disks::minSize() const STUB_RETVAL(0)
+uint64_t Disks::currentSize() const STUB_RETVAL(0)
+uint64_t Disks::currentCount() const STUB_RETVAL(0)
+int64_t Disks::maxObjectSize() const STUB_RETVAL(0)
+void Disks::getStats(StoreInfoStats &) const STUB
+void Disks::stat(StoreEntry &) const STUB
+void Disks::sync() STUB
+void Disks::reference(StoreEntry &) STUB
+bool Disks::dereference(StoreEntry &) STUB_RETVAL(false)
+void Disks::updateHeaders(StoreEntry *) STUB
+void Disks::maintain() STUB
+bool Disks::anchorToCache(StoreEntry &, bool &) STUB_RETVAL(false)
+bool Disks::updateAnchored(StoreEntry &) STUB_RETVAL(false)
+void Disks::evictCached(StoreEntry &) STUB
+void Disks::evictIfFound(const cache_key *) STUB
+int Disks::callback() STUB_RETVAL(0)
+void Disks::updateLimits() STUB
+int64_t Disks::accumulateMore(const StoreEntry&) const STUB_RETVAL(0)
+bool Disks::SmpAware() STUB_RETVAL(false)
+bool Disks::hasReadableEntry(const StoreEntry &) const STUB_RETVAL(false)
+}
+void storeDirOpenSwapLogs(void) STUB
+int storeDirWriteCleanLogs(int) STUB_RETVAL(0)
+void storeDirCloseSwapLogs(void) STUB
+void allocate_new_swapdir(Store::DiskConfig *) STUB
+void free_cachedir(Store::DiskConfig *) STUB
+STDIRSELECT *storeDirSelectSwapDir = nullptr;
+void storeDirSwapLog(const StoreEntry *, int) STUB
+
+#include "store/LocalSearch.h"
+namespace Store
+{
+StoreSearch *NewLocalSearch() STUB_RETVAL(nullptr)
+}
index 7c81acf79d81646d603d545387e4e9f351b38a32..f0a5480ed6fd1bf1e60aabd20146a422114cd8e5 100644 (file)
@@ -97,17 +97,7 @@ void StoreEntry::append(char const *, int) STUB
 void StoreEntry::vappendf(const char *, va_list) STUB
 void StoreEntry::setCollapsingRequirement(const bool required) STUB
 
-Store::Controller &Store::Root() STUB_RETREF(Store::Controller)
-void Store::Init(Store::Controller *root) STUB
-void Store::FreeMemory() STUB
-void Store::Stats(StoreEntry * output) STUB
 void Store::Maintain(void *unused) STUB
-int Store::Controller::store_dirs_rebuilding = 0;
-StoreSearch *Store::Controller::search() STUB_RETVAL(NULL)
-void Store::Controller::maintain() STUB
-bool Store::Controller::markedForDeletion(const cache_key *) const STUB_RETVAL(false)
-void Store::Controller::freeMemorySpace(const int) STUB
-bool Store::Controller::SmpAware() STUB_RETVAL(false)
 
 std::ostream &operator <<(std::ostream &os, const StoreEntry &)
 {
index 7e9c26b851b44593665b2c303f3d4ef39bfef7bc..36fa056ee66c3ca85c66a7b2fe9f067157f4f3ad 100644 (file)
 #include "auth/AclMaxUserIp.h"
 #include "auth/UserRequest.h"
 #include "ConfigParser.h"
-#include "testACLMaxUserIP.h"
+#include "tests/testACLMaxUserIP.h"
 #include "unitTestMain.h"
 
 #include <stdexcept>
 
 CPPUNIT_TEST_SUITE_REGISTRATION( testACLMaxUserIP );
 
+/* globals required to resolve link issues */
+AnyP::PortCfgPointer HttpPortList;
+
 void
 testACLMaxUserIP::testDefaults()
 {
similarity index 99%
rename from src/tests/testAddress.cc
rename to src/tests/testIpAddress.cc
index ebf990cb4b97353614da39ba60928c2a62fbaae8..bc32bdfd8cc74cc98fbd197521320776fa6cf67e 100644 (file)
@@ -9,7 +9,7 @@
 #include "squid.h"
 #include "ip/Address.h"
 #include "ip/tools.h"
-#include "testAddress.h"
+#include "tests/testIpAddress.h"
 #include "unitTestMain.h"
 
 #include <cstring>
@@ -27,8 +27,6 @@
 
 CPPUNIT_TEST_SUITE_REGISTRATION( testIpAddress );
 
-#include "tests/stub_SBuf.cc"
-
 /* so that we don't break POD dependency just for the test */
 struct timeval current_time;
 double current_dtime;