-#define SQUID_UNIT_TEST 1
-#include "squid.h"
+/*
+ * Copyright (C) 1996-2016 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 "ConfigParser.h"
#include "DiskIO/DiskIOModule.h"
#include "fs/rock/RockSwapDir.h"
#include "globals.h"
#include "HttpHeader.h"
#include "HttpReply.h"
-#include "Mem.h"
#include "MemObject.h"
#include "RequestFlags.h"
#include "SquidConfig.h"
#include "Store.h"
+#include "store/Disk.h"
+#include "store/Disks.h"
#include "StoreFileSystem.h"
#include "StoreSearch.h"
-#include "SwapDir.h"
#include "testRock.h"
#include "testStoreSupport.h"
+#include "unitTestMain.h"
#include <stdexcept>
#if HAVE_SYS_STAT_H
if (0 > system ("rm -rf " TESTDIR))
throw std::runtime_error("Failed to clean test work directory");
+ Config.memShared.defaultTo(false);
+
// use current directory for shared segments (on path-based OSes)
Ipc::Mem::Segment::BasePath = getcwd(cwd,MAXPATHLEN);
if (Ipc::Mem::Segment::BasePath == NULL)
Ipc::Mem::Segment::BasePath = ".";
- Store::Root(new StoreController);
+ Store::Init();
store = new Rock::SwapDir();
{
CPPUNIT_NS::TestFixture::tearDown();
- Store::Root(NULL);
+ Store::FreeMemory();
store = NULL;
comm_init();
- httpHeaderInitModule(); /* must go before any header processing (e.g. the one in errorInitialize) */
+ httpHeaderInitModule(); /* must go before any header processing (e.g. the one in errorInitialize) */
- httpReplyInitModule(); /* must go before accepting replies */
+ httpReplyInitModule(); /* must go before accepting replies */
mem_policy = createRemovalPolicy(Config.replPolicy);
StoreEntry *const pe = createEntry(i);
pe->buffer();
- /* TODO: remove this when the metadata is separated */
- {
- Packer p;
- packerToStoreInit(&p, pe);
- pe->getReply()->packHeadersInto(&p);
- packerClean(&p);
- }
-
+ pe->getReply()->packHeadersInto(pe);
pe->flush();
pe->timestampsSet();
pe->complete();
CPPUNIT_ASSERT_EQUAL(static_cast<StoreEntry *>(NULL), pe2);
}
}
+