]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Reduce dependencies of testConfigParser (#888)
authorAmos Jeffries <yadij@users.noreply.github.com>
Fri, 20 Aug 2021 14:50:37 +0000 (14:50 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 22 Aug 2021 14:52:55 +0000 (14:52 +0000)
Move several globals used by the legacy parse logic into cache_cf.cc
and remove unnecessary objects linked to testConfigParser.

15 files changed:
src/HttpUpgradeProtocolAccess.cc
src/Makefile.am
src/acl/AllOf.cc
src/acl/Arp.cc
src/acl/Eui64.cc
src/acl/Gadgets.cc
src/acl/HttpHeaderData.cc
src/acl/RegexData.cc
src/adaptation/Config.cc
src/adaptation/ServiceConfig.cc
src/cache_cf.cc
src/cache_cf.h
src/globals.h
src/tests/stub_cache_cf.cc
src/tests/testConfigParser.cc

index dc1863e3f528ffe312e4165be0bedb6372f08359..fe4bedc0e010a307a0785ef914a222430ab51f6a 100644 (file)
@@ -9,6 +9,7 @@
 #include "squid.h"
 #include "acl/Acl.h"
 #include "acl/Gadgets.h"
+#include "cache_cf.h"
 #include "ConfigParser.h"
 #include "globals.h"
 #include "HttpUpgradeProtocolAccess.h"
index 48716d9e80ae84c57ca5b8555b2df9fc8de4b171..e4c618c1c4ede62e5065761192f343bb1072684e 100644 (file)
@@ -2828,38 +2828,19 @@ tests_testStatHist_LDFLAGS = $(LIBADD_DL)
 
 check_PROGRAMS += tests/testConfigParser
 tests_testConfigParser_SOURCES = \
-       ClientInfo.h \
-       ConfigParser.cc \
        tests/testConfigParser.cc \
-       tests/testConfigParser.h \
-       tests/stub_HelperChildConfig.cc \
-       tests/stub_MemBuf.cc \
-       tests/stub_SBufDetailedStats.cc \
+       tests/testConfigParser.h
+nodist_tests_testConfigParser_SOURCES = \
+       ConfigParser.cc \
        String.cc \
        tests/stub_acl.cc \
        tests/stub_cache_cf.cc \
-       cache_cf.h \
-       tests/stub_cbdata.cc \
        tests/stub_debug.cc \
-       tests/stub_event.cc \
        tests/stub_fatal.cc \
-       fatal.h \
        tests/stub_libmem.cc \
-       tests/stub_time.cc \
-       tests/stub_tools.cc \
-       tools.h \
-       wordlist.cc \
-       wordlist.h
-nodist_tests_testConfigParser_SOURCES = \
-       $(TESTSOURCES)
+       tests/stub_SBuf.cc
 tests_testConfigParser_LDADD = \
-       libsquid.la \
-       ip/libip.la \
-       sbuf/libsbuf.la \
        base/libbase.la \
-       $(top_builddir)/lib/libmiscutil.la \
-       $(REGEXLIB) \
-       $(SSLLIB) \
        $(LIBCPPUNIT_LIBS) \
        $(COMPAT_LIB) \
        $(XTRA_LIBS)
index bfec159f5be5d17db46c42bf1fd1bf7cd68d5aad..5d7786b75f1ca9a84021aa5895d308dbcf830c9f 100644 (file)
@@ -10,8 +10,9 @@
 #include "acl/AllOf.h"
 #include "acl/BoolOps.h"
 #include "acl/Checklist.h"
-#include "globals.h"
+#include "cache_cf.h"
 #include "MemBuf.h"
+#include "sbuf/SBuf.h"
 
 char const *
 Acl::AllOf::typeString() const
index 91cb36dec2dd81d4aa9699050f736c99ab5441b2..685427b0e90c48fa6e62368b3ca07aa0e218a5d0 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "acl/Arp.h"
 #include "acl/FilledChecklist.h"
+#include "cache_cf.h"
 #include "Debug.h"
 #include "eui/Eui48.h"
 #include "globals.h"
index 74ae0fba8cf6533737dd18bcf60947e088573240..1dad63b0083a4ff1f32b95c07808eb85de883f06 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "acl/Eui64.h"
 #include "acl/FilledChecklist.h"
+#include "cache_cf.h"
 #include "Debug.h"
 #include "eui/Eui64.h"
 #include "globals.h"
index adbc2e83d9f5762398483c68e26b11a0d42e1300..ad1f6c7bd3cd6ef8f49ee9a490a878291c65dd9e 100644 (file)
@@ -23,6 +23,7 @@
 #include "acl/Gadgets.h"
 #include "acl/Strategised.h"
 #include "acl/Tree.h"
+#include "cache_cf.h"
 #include "ConfigParser.h"
 #include "errorpage.h"
 #include "globals.h"
index 19e01d791e3e13f405aa5a3872b6b09df61e489e..aa986e9f332bbca17b6e21a8795d58b71a0377b2 100644 (file)
@@ -14,6 +14,7 @@
 #include "acl/HttpHeaderData.h"
 #include "acl/RegexData.h"
 #include "base/RegexPattern.h"
+#include "cache_cf.h"
 #include "ConfigParser.h"
 #include "Debug.h"
 #include "HttpHeaderTools.h"
index 6ca458a7547f38bb645547f9dfcd784019987f87..0a84a0c9d763bcaeb29bbbf08868aa7c728e98c0 100644 (file)
@@ -19,6 +19,7 @@
 #include "acl/Checklist.h"
 #include "acl/RegexData.h"
 #include "base/RegexPattern.h"
+#include "cache_cf.h"
 #include "ConfigParser.h"
 #include "Debug.h"
 #include "sbuf/Algorithms.h"
index 95bcf99bbe7cea63a13f557a9ab63576252191fd..5a5288288f4ccc4e43e85a0929256841c15935a7 100644 (file)
@@ -14,6 +14,7 @@
 #include "adaptation/History.h"
 #include "adaptation/Service.h"
 #include "adaptation/ServiceGroups.h"
+#include "cache_cf.h"
 #include "ConfigParser.h"
 #include "DebugMessages.h"
 #include "globals.h"
index bfbd4f23eb47ffc6beedc39b75b66318e9857061..f46174428018ac86b0ca3777369182ef3349fd78 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "squid.h"
 #include "adaptation/ServiceConfig.h"
+#include "cache_cf.h"
 #include "ConfigParser.h"
 #include "Debug.h"
 #include "globals.h"
index 5808631fc8e10455b1ae917321da81023a3932ab..afd58f42daae659560036672eda646b40029e7f6 100644 (file)
@@ -266,6 +266,11 @@ static void free_http_upgrade_request_protocols(HttpUpgradeProtocolAccess **prot
  */
 static ConfigParser LegacyParser = ConfigParser();
 
+const char *cfg_directive = nullptr;
+const char *cfg_filename = nullptr;
+int config_lineno = 0;
+char config_input_line[BUFSIZ] = {};
+
 void
 self_destruct(void)
 {
index 8bdc3f1b17b9b19f999d90baaf95f9fa7e24bd45..b280f2b3a07c0d179ef8f20cdc3d7538a7d5f5da 100644 (file)
@@ -27,5 +27,11 @@ void parse_time_t(time_t * var);
 /// Parse bytes number from a string
 void parseBytesOptionValue(size_t * bptr, const char *units, char const * value);
 
+/// During parsing, the name of the current squid.conf directive being parsed.
+extern const char *cfg_directive;
+extern const char *cfg_filename;
+extern int config_lineno;
+extern char config_input_line[BUFSIZ];
+
 #endif /* SQUID_CACHE_CF_H_ */
 
index cb740453f3c79b3ee428a4f7a22fe520bc8b2c56..be7c45cca9fe928369508d5c0c0ae3499afdd9fa 100644 (file)
@@ -20,10 +20,6 @@ extern char *ConfigFile;    /* NULL */
 extern char *IcpOpcodeStr[];
 extern char ThisCache[RFC2181_MAXHOSTNAMELEN << 1];
 extern char ThisCache2[RFC2181_MAXHOSTNAMELEN << 1];
-extern char config_input_line[BUFSIZ];
-/// During parsing, the name of the current squid.conf directive being parsed.
-extern const char *cfg_directive; /* NULL */
-extern const char *cfg_filename;    /* NULL */
 extern const char *dash_str;    /* "-" */
 extern const char *null_string; /* "" */
 extern const char *version_string;  /* VERSION */
@@ -41,7 +37,6 @@ extern int Opening_FD;      /* 0 */
 extern int NDnsServersAlloc;    /* 0 */
 extern int RESERVED_FD;
 extern int Squid_MaxFD;     /* SQUID_MAXFD */
-extern int config_lineno;   /* 0 */
 extern int opt_reuseaddr;   /* 1 */
 extern int neighbors_do_private_keys;   /* 1 */
 extern int opt_catch_signals;   /* 1 */
index 87ddd1345c3accb1758c2ed8d0798f8b088bca91..af38cb8c5fd9351c6d415588626e3995972c0c52 100644 (file)
 #include "tests/STUB.h"
 
 #include "cache_cf.h"
+const char *cfg_directive = nullptr;
+const char *cfg_filename = nullptr;
+int config_lineno = 0;
+char config_input_line[BUFSIZ] = {};
 void self_destruct(void) STUB
 void parse_int(int *) STUB
 void parse_onoff(int *) STUB
index 44039815d79bb1a7946e05ac0c2f03e3751e4674..fa1960afd2ddf7bf5d20b94c90079b60c3d106f1 100644 (file)
@@ -9,11 +9,13 @@
 #include "squid.h"
 #include "ConfigParser.h"
 #include "SquidString.h"
-#include "testConfigParser.h"
+#include "tests/testConfigParser.h"
 #include "unitTestMain.h"
 
 CPPUNIT_TEST_SUITE_REGISTRATION( testConfigParser);
 
+int shutting_down = 0;
+
 void testConfigParser::setUp()
 {
 }