Bug 950545 (part 1) - Fix the dump numbering in the DMD test. r=iacobcatalin.

--HG--
extra : rebase_source : 2b04382850c19aff46fce02d02ce1c235edde473
This commit is contained in:
Nicholas Nethercote 2013-12-18 13:55:47 -08:00
parent 6379279148
commit 8813ddf3ef

View File

@ -2315,11 +2315,11 @@ RunTestMode(FILE* fp)
// The first part of this test requires sampling to be disabled.
gOptions->SetSampleBelowSize(1);
// 0th Dump. Zero for everything.
// Dump 1. Zero for everything.
Dump(writer);
// 1st Dump: 1 freed, 9 out of 10 unreported.
// 2nd Dump: still present and unreported.
// Dump 2: 1 freed, 9 out of 10 unreported.
// Dump 3: still present and unreported.
int i;
char* a;
for (i = 0; i < 10; i++) {
@ -2329,94 +2329,94 @@ RunTestMode(FILE* fp)
free(a);
// Min-sized block.
// 1st Dump: reported.
// 2nd Dump: thrice-reported.
// Dump 2: reported.
// Dump 3: thrice-reported.
char* a2 = (char*) malloc(0);
Report(a2);
// Operator new[].
// 1st Dump: reported.
// 2nd Dump: reportedness carries over, due to ReportOnAlloc.
// Dump 2: reported.
// Dump 3: reportedness carries over, due to ReportOnAlloc.
char* b = new char[10];
ReportOnAlloc(b);
// ReportOnAlloc, then freed.
// 1st Dump: freed, irrelevant.
// 2nd Dump: freed, irrelevant.
// Dump 2: freed, irrelevant.
// Dump 3: freed, irrelevant.
char* b2 = new char;
ReportOnAlloc(b2);
free(b2);
// 1st Dump: reported 4 times.
// 2nd Dump: freed, irrelevant.
// Dump 2: reported 4 times.
// Dump 3: freed, irrelevant.
char* c = (char*) calloc(10, 3);
Report(c);
for (int i = 0; i < 3; i++) {
Report(c);
}
// 1st Dump: ignored.
// 2nd Dump: irrelevant.
// Dump 2: ignored.
// Dump 3: irrelevant.
Report((void*)(intptr_t)i);
// jemalloc rounds this up to 8192.
// 1st Dump: reported.
// 2nd Dump: freed.
// Dump 2: reported.
// Dump 3: freed.
char* e = (char*) malloc(4096);
e = (char*) realloc(e, 4097);
Report(e);
// First realloc is like malloc; second realloc is shrinking.
// 1st Dump: reported.
// 2nd Dump: re-reported.
// Dump 2: reported.
// Dump 3: re-reported.
char* e2 = (char*) realloc(nullptr, 1024);
e2 = (char*) realloc(e2, 512);
Report(e2);
// First realloc is like malloc; second realloc creates a min-sized block.
// XXX: on Windows, second realloc frees the block.
// 1st Dump: reported.
// 2nd Dump: freed, irrelevant.
// Dump 2: reported.
// Dump 3: freed, irrelevant.
char* e3 = (char*) realloc(nullptr, 1023);
//e3 = (char*) realloc(e3, 0);
MOZ_ASSERT(e3);
Report(e3);
// 1st Dump: freed, irrelevant.
// 2nd Dump: freed, irrelevant.
// Dump 2: freed, irrelevant.
// Dump 3: freed, irrelevant.
char* f = (char*) malloc(64);
free(f);
// 1st Dump: ignored.
// 2nd Dump: irrelevant.
// Dump 2: ignored.
// Dump 3: irrelevant.
Report((void*)(intptr_t)0x0);
// 1st Dump: mixture of reported and unreported.
// 2nd Dump: all unreported.
// Dump 2: mixture of reported and unreported.
// Dump 3: all unreported.
foo();
foo();
// 1st Dump: twice-reported.
// 2nd Dump: twice-reported.
// Dump 2: twice-reported.
// Dump 3: twice-reported.
char* g1 = (char*) malloc(77);
ReportOnAlloc(g1);
ReportOnAlloc(g1);
// 1st Dump: twice-reported.
// 2nd Dump: once-reported.
// Dump 2: twice-reported.
// Dump 3: once-reported.
char* g2 = (char*) malloc(78);
Report(g2);
ReportOnAlloc(g2);
// 1st Dump: twice-reported.
// 2nd Dump: once-reported.
// Dump 2: twice-reported.
// Dump 3: once-reported.
char* g3 = (char*) malloc(79);
ReportOnAlloc(g3);
Report(g3);
// All the odd-ball ones.
// 1st Dump: all unreported.
// 2nd Dump: all freed, irrelevant.
// Dump 2: all unreported.
// Dump 3: all freed, irrelevant.
// XXX: no memalign on Mac
//void* x = memalign(64, 65); // rounds up to 128
//UseItOrLoseIt(x);
@ -2429,7 +2429,7 @@ RunTestMode(FILE* fp)
//UseItOrLoseIt(z);
//aligned_alloc(64, 256); // XXX: C11 only
// 1st Dump.
// Dump 2.
Dump(writer);
//---------
@ -2444,7 +2444,7 @@ RunTestMode(FILE* fp)
//free(y);
//free(z);
// 2nd Dump.
// Dump 3.
Dump(writer);
//---------
@ -2508,6 +2508,7 @@ RunTestMode(FILE* fp)
// At the end we're 64 bytes into the current sample so we report ~1,424
// bytes of allocation overall, which is 64 less than the real value 1,488.
// Dump 4.
Dump(writer);
}