]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: remove dead testNull unit test
authorAmos Jeffries <squid3@treenet.co.nz>
Fri, 2 Nov 2012 23:54:44 +0000 (17:54 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Fri, 2 Nov 2012 23:54:44 +0000 (17:54 -0600)
src/Makefile.am
src/tests/testNull.cc [deleted file]
src/tests/testNull.h [deleted file]

index 6db06c5364397ee0077c7104f1c75cc9fc480acf..f829646f4a8e29329ddd4f21068fab1d1acea207 100644 (file)
@@ -197,7 +197,6 @@ EXTRA_PROGRAMS = \
        tests/testUfs \
        tests/testCoss \
        tests/testRock \
-       tests/testNull \
        ufsdump
 
 ## cfgen is used when building squid
@@ -3543,150 +3542,6 @@ tests_testCoss_LDFLAGS = $(LIBADD_DL)
 tests_testCoss_DEPENDENCIES = \
        $(SWAP_TEST_DS)
 
-tests_testNull_SOURCES = \
-       tests/testNull.cc \
-       tests/testMain.cc \
-       tests/testNull.h \
-       internal.h \
-       tests/stub_internal.cc \
-       store_rebuild.h \
-       tests/stub_store_rebuild.cc \
-       tests/stub_store_stats.cc \
-       fd.h \
-       fd.cc \
-       disk.h \
-       disk.cc \
-       FileMap.h \
-       filemap.cc \
-       HttpBody.h \
-       HttpBody.cc \
-       HttpReply.cc \
-       HttpStatusLine.cc \
-       int.h \
-       int.cc \
-       SquidList.h \
-       SquidList.cc \
-       MemObject.cc \
-       StoreSwapLogData.cc \
-       StoreIOState.cc \
-       StoreMeta.cc \
-       StoreMetaMD5.cc \
-       StoreMetaSTD.cc \
-       StoreMetaSTDLFS.cc \
-       StoreMetaUnpacker.cc \
-       StoreMetaURL.cc \
-       StoreMetaVary.cc \
-       StoreFileSystem.cc \
-       store_io.cc \
-       store_swapout.cc \
-       store_swapmeta.cc \
-       $(UNLINKDSOURCE) \
-       $(WIN32_SOURCE) \
-       event.cc \
-       $(DELAY_POOL_SOURCE) \
-       CacheDigest.h \
-       CacheDigest.cc \
-       ConfigParser.cc \
-       EventLoop.cc \
-       HttpMsg.cc \
-       RemovalPolicy.cc \
-       store_dir.cc \
-       repl_modules.h \
-       store.cc \
-       HttpRequestMethod.cc \
-       store_key_md5.h \
-       store_key_md5.cc \
-       Parsing.cc \
-       ConfigOption.cc \
-       SwapDir.cc \
-       tests/stub_acl.cc \
-       cache_cf.h \
-       YesNoNone.h \
-       tests/stub_cache_cf.cc \
-       tests/stub_helper.cc \
-       cbdata.cc \
-       String.cc \
-       tests/stub_comm.cc \
-       tests/stub_debug.cc \
-       tests/stub_client_side_request.cc \
-       tests/stub_http.cc \
-       mem_node.cc \
-       stmem.cc \
-       mime.h \
-       tests/stub_mime.cc \
-       HttpHeaderFieldInfo.h \
-       HttpHeaderTools.h \
-       HttpHeaderTools.cc \
-       HttpHeader.h \
-       HttpHeader.cc \
-       Mem.h \
-       mem.cc \
-       ClientInfo.h \
-       MemBuf.cc \
-       HttpHdrContRange.cc \
-       Packer.cc \
-       HttpHeaderFieldStat.h \
-       HttpHdrCc.h \
-       HttpHdrCc.cc \
-       HttpHdrCc.cci \
-       HttpHdrSc.cc \
-       HttpHdrScTarget.cc \
-       url.cc \
-       StatCounters.h \
-       StatCounters.cc \
-       StatHist.h \
-       tests/stub_StatHist.cc \
-       tests/stub_errorpage.cc \
-       tests/stub_HttpRequest.cc \
-       log/access_log.h \
-       tests/stub_access_log.cc \
-       refresh.h \
-       refresh.cc \
-       tests/stub_store_client.cc \
-       tests/stub_store_stats.cc \
-       tools.h \
-       tests/stub_tools.cc \
-       tests/testStoreSupport.cc \
-       tests/testStoreSupport.h \
-       time.cc \
-       URLScheme.cc \
-       wordlist.h \
-       wordlist.cc \
-       $(DISKIO_SOURCE)
-
-nodist_tests_testNull_SOURCES = \
-       $(TESTSOURCES) \
-       $(DISKIO_GEN_SOURCE)
-tests_testNull_LDADD = \
-       $(REGEXLIB) \
-       $(AUTH_ACL_LIBS) \
-       ident/libident.la \
-       acl/libacls.la \
-       eui/libeui.la \
-       acl/libstate.la \
-       $(AUTH_LIBS) \
-       acl/libapi.la \
-       base/libbase.la \
-       libsquid.la \
-       ip/libip.la \
-       fs/libfs.la \
-       ipc/libipc.la \
-       mgr/libmgr.la \
-       $(REPL_OBJS) \
-       $(DISK_LIBS) \
-       $(DISK_OS_LIBS) \
-       acl/libapi.la \
-       $(top_builddir)/lib/libmisccontainers.la \
-       $(top_builddir)/lib/libmiscencoding.la \
-       $(top_builddir)/lib/libmiscutil.la \
-       $(SQUID_CPPUNIT_LIBS) \
-       $(SSLLIB) \
-       $(COMPAT_LIB) \
-       $(XTRA_LIBS)
-tests_testNull_LDFLAGS = $(LIBADD_DL)
-tests_testNull_DEPENDENCIES = \
-       $(SWAP_TEST_DS)
-
 ## Tests of the URL module.
 ## TODO: Trim this down once the insanity is over.
 tests_testURL_SOURCES = \
diff --git a/src/tests/testNull.cc b/src/tests/testNull.cc
deleted file mode 100644 (file)
index 0e2bcf5..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-#define SQUID_UNIT_TEST 1
-#include "squid.h"
-#include "testNull.h"
-#include "Store.h"
-#include "SwapDir.h"
-#include "DiskIO/DiskIOModule.h"
-#include "fs/null/store_null.h"
-#include "Mem.h"
-#include "MemObject.h"
-#include "HttpHeader.h"
-#include "HttpReply.h"
-#include "RequestFlags.h"
-#include "SquidConfig.h"
-#include "StoreFileSystem.h"
-#include "testStoreSupport.h"
-
-#if HAVE_STDEXCEPT
-#include <stdexcept>
-#endif
-
-#define TESTDIR "testNull__testNullSearch"
-
-CPPUNIT_TEST_SUITE_REGISTRATION( testNull );
-
-typedef RefCount<NullSwapDir> SwapDirPointer;
-extern REMOVALPOLICYCREATE createRemovalPolicy_lru;
-
-static void
-addSwapDir(SwapDirPointer aStore)
-{
-    allocate_new_swapdir(&Config.cacheSwap);
-    Config.cacheSwap.swapDirs[Config.cacheSwap.n_configured] = aStore.getRaw();
-    ++Config.cacheSwap.n_configured;
-}
-
-void
-testNull::commonInit()
-{
-    static bool inited = false;
-
-    if (inited)
-        return;
-
-    StoreFileSystem::SetupAllFs();
-
-    Config.Store.avgObjectSize = 1024;
-
-    Config.Store.objectsPerBucket = 20;
-
-    Config.Store.maxObjectSize = 2048;
-
-    Config.store_dir_select_algorithm = xstrdup("round-robin");
-
-    Config.replPolicy = new RemovalPolicySettings;
-
-    Config.replPolicy->type = xstrdup ("lru");
-
-    Config.replPolicy->args = NULL;
-
-    /* garh garh */
-    storeReplAdd("lru", createRemovalPolicy_lru);
-
-    visible_appname_string = xstrdup(APP_FULLNAME);
-
-    Mem::Init();
-
-    comm_init();
-
-    httpHeaderInitModule();    /* must go before any header processing (e.g. the one in errorInitialize) */
-
-    httpReplyInitModule();     /* must go before accepting replies */
-
-    mem_policy = createRemovalPolicy(Config.replPolicy);
-
-    inited = true;
-}
-
-void
-testNull::testNullCreate()
-{
-    StorePointer aRoot (new StoreController);
-    Store::Root(aRoot);
-    SwapDirPointer aStore (new NullSwapDir());
-    addSwapDir(aStore);
-
-    commonInit();
-
-    char *path=xstrdup(TESTDIR);
-    char *config_line=xstrdup("foo");
-    strtok(config_line, w_space);
-    aStore->parse(0, path);
-    safe_free(path);
-    safe_free(config_line);
-
-    /* ok, ready to create */
-    aStore->create();
-
-    free_cachedir(&Config.cacheSwap);
-    Store::Root(NULL);
-
-    /* todo: here we should test a dirty rebuild */
-
-    //    safe_free(Config.replPolicy->type);
-    //    delete Config.replPolicy;
-}
-
-/* TODO make this a cbdata class */
-
-static bool cbcalled;
-
-static void
-searchCallback(void *cbdata)
-{
-    cbcalled = true;
-}
-
-void
-testNull::testNullSearch()
-{
-    /* test sequence
-     * make a valid working ufs swapdir
-     * put two entries in it and sync logs
-     * search the ufs dir
-     * check the entries we find are what we want
-     */
-    StorePointer aRoot (new StoreController);
-    Store::Root(aRoot);
-    SwapDirPointer aStore (new NullSwapDir());
-    addSwapDir(aStore);
-
-    commonInit();
-
-    char *path=xstrdup(TESTDIR);
-    char *config_line=xstrdup("foo");
-    strtok(config_line, w_space);
-    aStore->parse(0, path);
-    safe_free(path);
-    safe_free(config_line);
-
-    /* ok, ready to create */
-    aStore->create();
-
-    /* ok, ready to use */
-    Store::Root().init();
-
-    /* rebuild is a scheduled event */
-    StockEventLoop loop;
-
-    /* our swapdir must be scheduled to rebuild - though it does not
-     * make sense to rebuild Null stores at all.  store_dirs_rebuilding
-     * is initialized to _1_ and adding our swapdir makes it 2.
-     */
-    CPPUNIT_ASSERT_EQUAL(2, StoreController::store_dirs_rebuilding);
-
-    loop.run();
-
-    /* nothing left to rebuild */
-    CPPUNIT_ASSERT_EQUAL(1, StoreController::store_dirs_rebuilding);
-
-    /* add an entry */
-    {
-        /* Create "vary" base object */
-        RequestFlags flags;
-        flags.cachable = 1;
-        StoreEntry *pe = storeCreateEntry("dummy url", "dummy log url", flags, METHOD_GET);
-        /* We are allowed to do this typecast */
-        HttpReply *rep = (HttpReply *) pe->getReply(); // bypass const
-        rep->setHeaders(HTTP_OK, "dummy test object", "x-squid-internal/test", -1, -1, squid_curtime + 100000);
-
-        pe->setPublicKey();
-
-        pe->buffer();
-        /* TODO: remove this when the metadata is separated */
-        {
-            Packer p;
-            packerToStoreInit(&p, pe);
-            pe->getReply()->packHeadersInto(&p);
-            packerClean(&p);
-        }
-
-        pe->flush();
-        pe->timestampsSet();
-        pe->complete();
-        pe->swapOut();
-        /* Null does not accept store entries */
-        CPPUNIT_ASSERT(pe->swap_dirn == -1);
-        pe->unlock();
-    }
-
-    storeDirWriteCleanLogs(0);
-
-    /* here we cheat: we know that UFSSwapDirs search off disk. If we did an init call to a new
-     * swapdir instance, we'd not be testing a clean build.
-     */
-    StoreSearchPointer search = aStore->search (NULL, NULL); /* search for everything in the store */
-
-    /* nothing should be available */
-    CPPUNIT_ASSERT(search->error() == false);
-    CPPUNIT_ASSERT(search->isDone() == true);
-    CPPUNIT_ASSERT(search->currentItem() == NULL);
-    CPPUNIT_ASSERT(search->next() == false);
-
-    /* trigger a callback */
-    cbcalled = false;
-    search->next(searchCallback, NULL);
-    CPPUNIT_ASSERT(cbcalled == true);
-
-    /* still nothing */
-    CPPUNIT_ASSERT(search->error() == false);
-    CPPUNIT_ASSERT(search->isDone() == true);
-    CPPUNIT_ASSERT(search->currentItem() == NULL);
-    CPPUNIT_ASSERT(search->next() == false);
-
-    free_cachedir(&Config.cacheSwap);
-    Store::Root(NULL);
-
-    //TODO: do this once, or each time.    safe_free(Config.replPolicy->type);
-    //    delete Config.replPolicy;
-}
diff --git a/src/tests/testNull.h b/src/tests/testNull.h
deleted file mode 100644 (file)
index 76441c8..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-
-#ifndef SQUID_SRC_TEST_STORECONTROLLER_H
-#define SQUID_SRC_TEST_STORECONTROLLER_H
-
-#include <cppunit/extensions/HelperMacros.h>
-
-/*
- * test the store framework
- */
-
-class testNull : public CPPUNIT_NS::TestFixture
-{
-    CPPUNIT_TEST_SUITE( testNull );
-    CPPUNIT_TEST( testNullCreate );
-    CPPUNIT_TEST( testNullSearch );
-    CPPUNIT_TEST_SUITE_END();
-
-public:
-
-protected:
-    void commonInit();
-    void testNullCreate();
-    void testNullSearch();
-};
-
-#endif
-