MCPcopy Create free account
hub / github.com/apache/trafficserver / execute_and_verify

Function execute_and_verify

src/iocore/cache/unit_tests/test_CacheVol.cc:219–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

217}
218
219void
220execute_and_verify()
221{
222 ts::PostScript clear([&]() -> void {
223 ClearConfigVol(&config_volumes);
224 ClearCacheVolList(&cp_list, cp_list_len);
225 });
226
227 cplist_init();
228
229 if (cplist_reconfigure() < 0) {
230 Warning("reconfigure failed");
231 return;
232 }
233
234 /* compare the volumes */
235 REQUIRE(cp_list_len == config_volumes.num_volumes);
236
237 /* check that the volumes and sizes
238 match the configuration */
239 int matched = 0;
240 ConfigVol *cp = config_volumes.cp_queue.head;
241 CacheVol *cachep;
242
243 for (int i = 0; i < config_volumes.num_volumes; i++) {
244 cachep = cp_list.head;
245 while (cachep) {
246 if (cachep->vol_number == cp->number) {
247 // Configuration and Actual volumes should match
248 REQUIRE(cachep->scheme == cp->scheme);
249 REQUIRE(cachep->size == (cp->size << (20 - STORE_BLOCK_SHIFT)));
250 REQUIRE(cachep == cp->cachep);
251
252 /* check that the number of volumes match the ones
253 on disk */
254 int d_no;
255 int m_vols = 0;
256 for (d_no = 0; d_no < gndisks; d_no++) {
257 if (cachep->disk_stripes[d_no]) {
258 DiskStripe *dp = cachep->disk_stripes[d_no];
259 // DiskStripes and CacheVols should match
260 REQUIRE(dp->vol_number == cachep->vol_number);
261
262 /* check the diskvolblock queue */
263 DiskStripeBlockQueue *dpbq = dp->dpb_queue.head;
264 while (dpbq) {
265 // DiskStripe and DiskStripeBlocks should match
266 REQUIRE(dpbq->b->number == cachep->vol_number);
267 dpbq = dpbq->link.next;
268 }
269
270 m_vols += dp->num_volblocks;
271 }
272 }
273 // Num volumes in CacheVol and DiskStripe should match
274 REQUIRE(m_vols == cachep->num_vols);
275
276 matched++;

Callers 1

Calls 5

ClearConfigVolFunction · 0.85
ClearCacheVolListFunction · 0.85
cplist_initFunction · 0.85
cplist_reconfigureFunction · 0.85
onMethod · 0.45

Tested by

no test coverage detected