-#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
#include <sys/stat.h>
#endif
-#if HAVE_STDEXCEPT
-#include <stdexcept>
-#endif
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
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();
store->create();
rr = new Rock::SwapDirRr;
- rr->run(rrAfterConfig);
+ rr->useConfig();
}
void
{
CPPUNIT_NS::TestFixture::tearDown();
- Store::Root(NULL);
+ Store::FreeMemory();
store = NULL;
free_cachedir(&Config.cacheSwap);
- delete rr;
+ rr->finishShutdown(); // deletes rr
+ rr = NULL;
// TODO: do this once, or each time.
// safe_free(Config.replPolicy->type);
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->type = xstrdup("lru");
Config.replPolicy->args = NULL;
/* garh garh */
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);
}
}
+