This test was broken by the pageLoaded / pageFlushed callbacks; it overwrote the page type with garbage, then stasis attempted to interpret the page type

This commit is contained in:
Sears Russell 2007-07-19 16:34:18 +00:00
parent 7ca0619db0
commit 799300753c

View file

@ -74,10 +74,14 @@ START_TEST(pageOpCheckRecovery) {
p.memAddr = memAddr;
memset(p.memAddr, 1, PAGE_SIZE);
// Reset the page type after overwriting it with memset. Otherwise, Stasis
// will try to interpret it when it flushes the page to disk.
*page_type_ptr(&p) = 0;
TpageSet(xid, pageid1, p.memAddr);
memset(p.memAddr, 2, PAGE_SIZE);
*page_type_ptr(&p) = 0;
TpageSet(xid, pageid2, p.memAddr);
@ -99,20 +103,24 @@ START_TEST(pageOpCheckRecovery) {
int pageid3 = TpageAlloc(xid);
memset(p.memAddr, 3, PAGE_SIZE);
*page_type_ptr(&p) = 0;
TpageSet(xid, pageid3, p.memAddr);
byte newAddr[PAGE_SIZE];
memset(p.memAddr, 1, PAGE_SIZE);
*page_type_ptr(&p) = 0;
TpageGet(xid, pageid1, newAddr);
assert(!memcmp(p.memAddr, newAddr, PAGE_SIZE-sizeof(lsn_t)));
memset(p.memAddr, 2, PAGE_SIZE);
*page_type_ptr(&p) = 0;
TpageGet(xid, pageid2, newAddr);
assert(!memcmp(p.memAddr, newAddr, PAGE_SIZE-sizeof(lsn_t)));
memset(p.memAddr, 3, PAGE_SIZE);
*page_type_ptr(&p) = 0;
TpageGet(xid, pageid3, newAddr);
assert(!memcmp(p.memAddr, newAddr, PAGE_SIZE-sizeof(lsn_t)));
Tcommit(xid);