52 void setUp()
override;
83 CPPUNIT_NS::TestFixture::setUp();
85 if (0 > system (
"rm -rf " TESTDIR))
86 throw std::runtime_error(
"Failed to clean test work directory");
94 char *config_line=
xstrdup(
"10 max-size=16384");
115 CPPUNIT_NS::TestFixture::tearDown();
128 if (0 > system (
"rm -rf " TESTDIR))
129 throw std::runtime_error(
"Failed to clean test work directory");
158 snprintf(buf,
sizeof(buf),
"dummy url %i", i);
159 buf[
sizeof(buf) - 1] =
'\0';
204 CPPUNIT_ASSERT_EQUAL(0, ::stat(
TESTDIR, &sb));
217 for (
int i = 0; i < 5; ++i) {
233 pe->
unlock(
"TestRock::testRockSwapOut priming");
246 pe->
unlock(
"TestRock::testRockSwapOut e#3");
250 CPPUNIT_ASSERT(pe2 !=
nullptr);
263 pe->
unlock(
"TestRock::testRockSwapOut e#4");
278 CPPUNIT_ASSERT_EQUAL(-1, pe2->
swap_dirn);
284 pe->
unlock(
"TestRock::testRockSwapOut e#5.1");
285 pe2->
unlock(
"TestRock::testRockSwapOut e#5.2");
295 pe3->
unlock(
"TestRock::testRockSwapOut e#5.3");
301 for (
int i = 0; i < 6; ++i) {
303 CPPUNIT_ASSERT(pe !=
nullptr);
308 CPPUNIT_ASSERT_EQUAL(
static_cast<StoreEntry *
>(
nullptr), pe2);
void free_cachedir(Store::DiskConfig *swap)
void allocate_new_swapdir(Store::DiskConfig &swap)
RemovalPolicy * mem_policy
RemovalPolicy * REMOVALPOLICYCREATE(wordlist *args)
RemovalPolicy * createRemovalPolicy(RemovalPolicySettings *settings)
static void SetCfgLine(char *line)
Set the configuration file line to parse.
void setHeaders(Http::StatusCode status, const char *reason, const char *ctype, int64_t clen, time_t lmt, time_t expires)
void packHeadersUsingSlowPacker(Packable &p) const
same as packHeadersUsingFastPacker() but assumes that p cannot quickly process small additions
void useConfig() override
static const char * BasePath
common path of all segment names in path-based environments
Decision decision
current decision state
const HttpReply & freshestReply() const
HttpReply & adjustableBaseReply()
customizes our test setup
virtual void finishShutdown()
Meant for cleanup of services needed by the already destroyed objects.
SupportOrVeto cachable
whether the response may be stored in the cache
initializes shared memory segments used by Rock::SwapDir
uint64_t currentCount() const override
the total number of objects stored right now
void parse(int index, char *path) override
void create() override
create system resources needed for this store to operate in the future
RemovalPolicySettings * replPolicy
Store::DiskConfig cacheSwap
YesNoNone shmLocking
shared_memory_locking
char * store_dir_select_algorithm
struct SquidConfig::@88 Store
YesNoNone memShared
whether the memory cache is shared among workers
int unlock(const char *context)
void release(const bool shareable=false)
swap_status_t swap_status
sfileno swap_filen
unique ID inside a cache_dir for swapped out entries; -1 for others
bool setPublicKey(const KeyScope keyScope=ksDefault)
static int store_dirs_rebuilding
the number of cache_dirs being rebuilt; TODO: move to Disks::Rebuilding
RefCount< SwapDir > * swapDirs
implements test program's main() function while enabling customization
int run(int argc, char *argv[])
RefCount< Rock::SwapDir > SwapDirPointer
StoreEntry * addEntry(const int i)
CPPUNIT_TEST(testRockCreate)
StoreEntry * createEntry(const int i)
StoreEntry * getEntry(const int i)
CPPUNIT_TEST_SUITE(TestRock)
CPPUNIT_TEST(testRockSwapOut)
void defaultTo(bool beSet)
enables or disables the option; updating to 'implicit' state
char const * visible_appname_string
Controller & Root()
safely access controller singleton
StoreEntry * storeCreateEntry(const char *url, const char *logUrl, const RequestFlags &flags, const HttpRequestMethod &method)
StoreEntry * storeGetPublic(const char *uri, const HttpRequestMethod &method)
void storeReplAdd(const char *type, REMOVALPOLICYCREATE *create)
REMOVALPOLICYCREATE createRemovalPolicy_lru
static void addSwapDir(TestRock::SwapDirPointer aStore)
CPPUNIT_TEST_SUITE_REGISTRATION(TestRock)
static const char * storeId(const int i)