Bug 950545 (part 2) - Fix assertion failures and output mismatches in the DMD test. r=iacobcatalin.

DONTBUILD because DMD is NPOTB

--HG--
extra : rebase_source : 48388b467bcbce8347792c8e7f0cb45b1fc177aa
This commit is contained in:
Nicholas Nethercote 2013-12-18 13:58:08 -08:00
parent 062f3b1e47
commit bc3240a496
3 changed files with 90 additions and 236 deletions

View File

@ -2299,9 +2299,9 @@ void foo()
static void
UseItOrLoseIt(void* a)
{
if (a == 0) {
fprintf(stderr, "UseItOrLoseIt: %p\n", a);
}
char buf[64];
sprintf(buf, "%p\n", a);
fwrite(buf, 1, strlen(buf) + 1, stderr);
}
// The output from this should be compared against test-expected.dmd. It's
@ -2516,12 +2516,21 @@ RunTestMode(FILE* fp)
// Stress testing microbenchmark
//---------------------------------------------------------------------------
// This stops otherwise-unused variables from being optimized away.
static void
UseItOrLoseIt2(void* a)
{
if (a == (void*)0x42) {
printf("UseItOrLoseIt2\n");
}
}
MOZ_NEVER_INLINE static void
stress5()
{
for (int i = 0; i < 10; i++) {
void* x = malloc(64);
UseItOrLoseIt(x);
UseItOrLoseIt2(x);
if (i & 1) {
free(x);
}

View File

@ -29,7 +29,7 @@ def main():
# Arguments
if (len(sys.argv) != 3):
print("usage:", sys.argv[0], "<srcdir> <test-output>")
print("usage:", sys.argv[0], "<topsrcdir> <test.dmd>")
sys.exit(1)
srcdir = sys.argv[1]
@ -62,38 +62,38 @@ def main():
# Filter output
# In stack trace records we filter out all stack frames that contain a
# function whose name doesn't begin with "RunTestMode". And the remaining
# ones have their line numbers omitted, unfortunately, because they are
# often off by one or two and this can vary between builds (e.g. debug vs
# non-debug).
# In stack trace records we filter out most stack frames. The only thing
# we leave behind is a "DMD.cpp" entry if we see one or more frames that
# have DMD.cpp in them. There is simply too much variation to do anything
# better than that.
#
# As for stack frame records, we complete eliminate all those that contain
# a function whose name doesn't begin with "RunTestMode", because such
# stack frame records are highly dependent on the exact forms of stack
# traces.
# As for stack frame records, alas, we filter them out entirely because
# they have even more variation.
print("filtering output to", filtered_name)
with open(fixed_name, "r") as fin, \
open(filtered_name, "w") as fout:
test_frame_re = re.compile(r".*(RunTestMode\w*).*(DMD.cpp)")
test_frame_re = re.compile(r".*(DMD.cpp)")
for line in fin:
if re.match(r" (Allocated at|Reported( again)? at)", line):
# It's a stack trace record.
print(line, end='', file=fout)
# Filter the stack trace -- only show RunTestMode* frames.
# Filter the stack trace -- print a single line if we see one
# or more frames involving DMD.cpp.
seen_DMD_frame = False
for frame in fin:
if re.match(r" ", frame):
m = test_frame_re.match(frame)
if m:
print(" ...", m.group(1), "...", m.group(2),
file=fout)
seen_DMD_frame = True
else:
# We're past the stack trace.
if seen_DMD_frame:
print(" ... DMD.cpp", file=fout)
print(frame, end='', file=fout)
break
@ -103,22 +103,11 @@ def main():
line2 = fin.next()
line3 = fin.next()
line4 = fin.next()
frame = fin.next()
line5 = fin.next()
line6 = fin.next()
m = test_frame_re.match(frame)
if m:
# This is a stack frame record from RunTestMode* -- print
# it, obscuring record numbers (which vary unpredictably).
print(re.sub(r"record \d+ of \d+", "record M of N", line),
end='', file=fout)
print(line2, end='', file=fout)
print(line3, end='', file=fout)
print(line4, end='', file=fout)
print(" ...", m.group(1), "...", m.group(2), file=fout)
print(line6, end='', file=fout)
else:
# Some line that needs no special handling. Copy it through.
# A line that needs no special handling. Copy it through.
print(line, end='', file=fout)
# Compare with expected output

View File

@ -59,49 +59,49 @@ Twice-reported: 1 block in stack trace record 1 of 4
80 bytes (79 requested / 1 slop)
0.66% of the heap (0.66% cumulative); 29.41% of twice-reported (29.41% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported again at
... RunTestMode ... DMD.cpp
... DMD.cpp
Twice-reported: 1 block in stack trace record 2 of 4
80 bytes (78 requested / 2 slop)
0.66% of the heap (1.32% cumulative); 29.41% of twice-reported (58.82% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported again at
... RunTestMode ... DMD.cpp
... DMD.cpp
Twice-reported: 1 block in stack trace record 3 of 4
80 bytes (77 requested / 3 slop)
0.66% of the heap (1.99% cumulative); 29.41% of twice-reported (88.24% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported again at
... RunTestMode ... DMD.cpp
... DMD.cpp
Twice-reported: 1 block in stack trace record 4 of 4
32 bytes (30 requested / 2 slop)
0.26% of the heap (2.25% cumulative); 11.76% of twice-reported (100.00% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported again at
... RunTestMode ... DMD.cpp
... DMD.cpp
------------------------------------------------------------------
Unreported stack trace records
@ -111,42 +111,24 @@ Unreported: 9 blocks in stack trace record 1 of 3
1,008 bytes (900 requested / 108 slop)
8.34% of the heap (8.34% cumulative); 81.82% of unreported (81.82% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Unreported: 2 blocks in stack trace record 2 of 3
112 bytes (112 requested / 0 slop)
0.93% of the heap (9.27% cumulative); 9.09% of unreported (90.91% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Unreported: 2 blocks in stack trace record 3 of 3
112 bytes (112 requested / 0 slop)
0.93% of the heap (10.19% cumulative); 9.09% of unreported (100.00% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
------------------------------------------------------------------
Unreported stack frame records
------------------------------------------------------------------
Unreported: 9 blocks from 1 stack trace record in stack frame record M of N
1,008 bytes (900 requested / 108 slop)
8.34% of the heap; 81.82% of unreported
PC is
... RunTestMode ... DMD.cpp
Unreported: 2 blocks from 1 stack trace record in stack frame record M of N
112 bytes (112 requested / 0 slop)
0.93% of the heap; 9.09% of unreported
PC is
... RunTestMode ... DMD.cpp
Unreported: 2 blocks from 1 stack trace record in stack frame record M of N
112 bytes (112 requested / 0 slop)
0.93% of the heap; 9.09% of unreported
PC is
... RunTestMode ... DMD.cpp
------------------------------------------------------------------
Once-reported stack trace records
------------------------------------------------------------------
@ -155,147 +137,105 @@ Once-reported: 1 block in stack trace record 1 of 11
8,192 bytes (4,097 requested / 4,095 slop)
67.77% of the heap (67.77% cumulative); 77.40% of once-reported (77.40% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Once-reported: 1 block in stack trace record 2 of 11
1,024 bytes (1,023 requested / 1 slop)
8.47% of the heap (76.24% cumulative); 9.67% of once-reported (87.07% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Once-reported: 1 block in stack trace record 3 of 11
512 bytes (512 requested / 0 slop)
4.24% of the heap (80.48% cumulative); 4.84% of once-reported (91.91% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Once-reported: 2 blocks in stack trace record 4 of 11
240 bytes (240 requested / 0 slop)
1.99% of the heap (82.46% cumulative); 2.27% of once-reported (94.18% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Once-reported: 2 blocks in stack trace record 5 of 11
240 bytes (240 requested / 0 slop)
1.99% of the heap (84.45% cumulative); 2.27% of once-reported (96.45% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Once-reported: 1 block in stack trace record 6 of 11
96 bytes (96 requested / 0 slop)
0.79% of the heap (85.24% cumulative); 0.91% of once-reported (97.35% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Once-reported: 1 block in stack trace record 7 of 11
96 bytes (96 requested / 0 slop)
0.79% of the heap (86.04% cumulative); 0.91% of once-reported (98.26% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Once-reported: 1 block in stack trace record 8 of 11
80 bytes (80 requested / 0 slop)
0.66% of the heap (86.70% cumulative); 0.76% of once-reported (99.02% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Once-reported: 1 block in stack trace record 9 of 11
80 bytes (80 requested / 0 slop)
0.66% of the heap (87.36% cumulative); 0.76% of once-reported (99.77% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Once-reported: 1 block in stack trace record 10 of 11
16 bytes (10 requested / 6 slop)
0.13% of the heap (87.49% cumulative); 0.15% of once-reported (99.92% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Once-reported: 1 block in stack trace record 11 of 11
8 bytes (0 requested / 8 slop)
0.07% of the heap (87.56% cumulative); 0.08% of once-reported (100.00% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
------------------------------------------------------------------
Once-reported stack frame records
------------------------------------------------------------------
Once-reported: 1 block from 1 stack trace record in stack frame record M of N
8,192 bytes (4,097 requested / 4,095 slop)
67.77% of the heap; 77.40% of once-reported
PC is
... RunTestMode ... DMD.cpp
Once-reported: 1 block from 1 stack trace record in stack frame record M of N
1,024 bytes (1,023 requested / 1 slop)
8.47% of the heap; 9.67% of once-reported
PC is
... RunTestMode ... DMD.cpp
Once-reported: 1 block from 1 stack trace record in stack frame record M of N
512 bytes (512 requested / 0 slop)
4.24% of the heap; 4.84% of once-reported
PC is
... RunTestMode ... DMD.cpp
Once-reported: 4 blocks from 3 stack trace records in stack frame record M of N
416 bytes (416 requested / 0 slop)
3.44% of the heap; 3.93% of once-reported
PC is
... RunTestMode ... DMD.cpp
Once-reported: 4 blocks from 3 stack trace records in stack frame record M of N
416 bytes (416 requested / 0 slop)
3.44% of the heap; 3.93% of once-reported
PC is
... RunTestMode ... DMD.cpp
Once-reported: 1 block from 1 stack trace record in stack frame record M of N
16 bytes (10 requested / 6 slop)
0.13% of the heap; 0.15% of once-reported
PC is
... RunTestMode ... DMD.cpp
Once-reported: 1 block from 1 stack trace record in stack frame record M of N
8 bytes (0 requested / 8 slop)
0.07% of the heap; 0.08% of once-reported
PC is
... RunTestMode ... DMD.cpp
------------------------------------------------------------------
Summary
------------------------------------------------------------------
@ -320,25 +260,25 @@ Twice-reported: 1 block in stack trace record 1 of 2
80 bytes (77 requested / 3 slop)
2.82% of the heap (2.82% cumulative); 90.91% of twice-reported (90.91% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported again at
... RunTestMode ... DMD.cpp
... DMD.cpp
Twice-reported: 1 block in stack trace record 2 of 2
8 bytes (0 requested / 8 slop)
0.28% of the heap (3.10% cumulative); 9.09% of twice-reported (100.00% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported again at
... RunTestMode ... DMD.cpp
... DMD.cpp
------------------------------------------------------------------
Unreported stack trace records
@ -348,42 +288,24 @@ Unreported: 9 blocks in stack trace record 1 of 3
1,008 bytes (900 requested / 108 slop)
35.49% of the heap (35.49% cumulative); 48.84% of unreported (48.84% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Unreported: 6 blocks in stack trace record 2 of 3
528 bytes (528 requested / 0 slop)
18.59% of the heap (54.08% cumulative); 25.58% of unreported (74.42% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Unreported: 6 blocks in stack trace record 3 of 3
528 bytes (528 requested / 0 slop)
18.59% of the heap (72.68% cumulative); 25.58% of unreported (100.00% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
------------------------------------------------------------------
Unreported stack frame records
------------------------------------------------------------------
Unreported: 9 blocks from 1 stack trace record in stack frame record M of N
1,008 bytes (900 requested / 108 slop)
35.49% of the heap; 48.84% of unreported
PC is
... RunTestMode ... DMD.cpp
Unreported: 6 blocks from 1 stack trace record in stack frame record M of N
528 bytes (528 requested / 0 slop)
18.59% of the heap; 25.58% of unreported
PC is
... RunTestMode ... DMD.cpp
Unreported: 6 blocks from 1 stack trace record in stack frame record M of N
528 bytes (528 requested / 0 slop)
18.59% of the heap; 25.58% of unreported
PC is
... RunTestMode ... DMD.cpp
------------------------------------------------------------------
Once-reported stack trace records
------------------------------------------------------------------
@ -392,66 +314,42 @@ Once-reported: 1 block in stack trace record 1 of 4
512 bytes (512 requested / 0 slop)
18.03% of the heap (18.03% cumulative); 74.42% of once-reported (74.42% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Once-reported: 1 block in stack trace record 2 of 4
80 bytes (79 requested / 1 slop)
2.82% of the heap (20.85% cumulative); 11.63% of once-reported (86.05% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Once-reported: 1 block in stack trace record 3 of 4
80 bytes (78 requested / 2 slop)
2.82% of the heap (23.66% cumulative); 11.63% of once-reported (97.67% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
Once-reported: 1 block in stack trace record 4 of 4
16 bytes (10 requested / 6 slop)
0.56% of the heap (24.23% cumulative); 2.33% of once-reported (100.00% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Reported at
... RunTestMode ... DMD.cpp
... DMD.cpp
------------------------------------------------------------------
Once-reported stack frame records
------------------------------------------------------------------
Once-reported: 1 block from 1 stack trace record in stack frame record M of N
512 bytes (512 requested / 0 slop)
18.03% of the heap; 74.42% of once-reported
PC is
... RunTestMode ... DMD.cpp
Once-reported: 1 block from 1 stack trace record in stack frame record M of N
80 bytes (79 requested / 1 slop)
2.82% of the heap; 11.63% of once-reported
PC is
... RunTestMode ... DMD.cpp
Once-reported: 1 block from 1 stack trace record in stack frame record M of N
80 bytes (78 requested / 2 slop)
2.82% of the heap; 11.63% of once-reported
PC is
... RunTestMode ... DMD.cpp
Once-reported: 1 block from 1 stack trace record in stack frame record M of N
16 bytes (10 requested / 6 slop)
0.56% of the heap; 2.33% of once-reported
PC is
... RunTestMode ... DMD.cpp
------------------------------------------------------------------
Summary
------------------------------------------------------------------
@ -482,90 +380,48 @@ Unreported: ~4 blocks in stack trace record 1 of 7
~512 bytes (~512 requested / ~0 slop)
35.96% of the heap (35.96% cumulative); 35.96% of unreported (35.96% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Unreported: 1 block in stack trace record 2 of 7
256 bytes (256 requested / 0 slop)
17.98% of the heap (53.93% cumulative); 17.98% of unreported (53.93% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Unreported: 1 block in stack trace record 3 of 7
144 bytes (144 requested / 0 slop)
10.11% of the heap (64.04% cumulative); 10.11% of unreported (64.04% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Unreported: 1 block in stack trace record 4 of 7
128 bytes (128 requested / 0 slop)
8.99% of the heap (73.03% cumulative); 8.99% of unreported (73.03% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Unreported: ~1 block in stack trace record 5 of 7
~128 bytes (~128 requested / ~0 slop)
8.99% of the heap (82.02% cumulative); 8.99% of unreported (82.02% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Unreported: ~1 block in stack trace record 6 of 7
~128 bytes (~128 requested / ~0 slop)
8.99% of the heap (91.01% cumulative); 8.99% of unreported (91.01% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
Unreported: ~1 block in stack trace record 7 of 7
~128 bytes (~128 requested / ~0 slop)
8.99% of the heap (100.00% cumulative); 8.99% of unreported (100.00% cumulative)
Allocated at
... RunTestMode ... DMD.cpp
... DMD.cpp
------------------------------------------------------------------
Unreported stack frame records
------------------------------------------------------------------
Unreported: ~4 blocks from ~1 stack trace record in stack frame record M of N
~512 bytes (~512 requested / ~0 slop)
35.96% of the heap; 35.96% of unreported
PC is
... RunTestMode ... DMD.cpp
Unreported: 1 block from 1 stack trace record in stack frame record M of N
256 bytes (256 requested / 0 slop)
17.98% of the heap; 17.98% of unreported
PC is
... RunTestMode ... DMD.cpp
Unreported: 1 block from 1 stack trace record in stack frame record M of N
144 bytes (144 requested / 0 slop)
10.11% of the heap; 10.11% of unreported
PC is
... RunTestMode ... DMD.cpp
Unreported: 1 block from 1 stack trace record in stack frame record M of N
128 bytes (128 requested / 0 slop)
8.99% of the heap; 8.99% of unreported
PC is
... RunTestMode ... DMD.cpp
Unreported: ~1 block from ~1 stack trace record in stack frame record M of N
~128 bytes (~128 requested / ~0 slop)
8.99% of the heap; 8.99% of unreported
PC is
... RunTestMode ... DMD.cpp
Unreported: ~1 block from ~1 stack trace record in stack frame record M of N
~128 bytes (~128 requested / ~0 slop)
8.99% of the heap; 8.99% of unreported
PC is
... RunTestMode ... DMD.cpp
Unreported: ~1 block from ~1 stack trace record in stack frame record M of N
~128 bytes (~128 requested / ~0 slop)
8.99% of the heap; 8.99% of unreported
PC is
... RunTestMode ... DMD.cpp
------------------------------------------------------------------
Once-reported stack trace records
------------------------------------------------------------------