|
From: <sv...@va...> - 2009-05-06 06:52:51
|
Author: njn
Date: 2009-05-06 07:52:47 +0100 (Wed, 06 May 2009)
New Revision: 9784
Log:
Make loss record ordering more deterministic, so that regtests are reliable.
Modified:
trunk/memcheck/mc_leakcheck.c
trunk/memcheck/tests/leak-cases-full.stderr.exp
Modified: trunk/memcheck/mc_leakcheck.c
===================================================================
--- trunk/memcheck/mc_leakcheck.c 2009-05-06 06:45:05 UTC (rev 9783)
+++ trunk/memcheck/mc_leakcheck.c 2009-05-06 06:52:47 UTC (rev 9784)
@@ -782,6 +782,15 @@
// If size are equal, compare by states.
if (lr_a->key.state < lr_b->key.state) return -1;
if (lr_a->key.state > lr_b->key.state) return 1;
+ // If they're still equal here, it doesn't matter that much, but we keep
+ // comparing other things so that regtests are as deterministic as
+ // possible. So: compare num_blocks.
+ if (lr_a->num_blocks < lr_b->num_blocks) return -1;
+ if (lr_a->num_blocks > lr_b->num_blocks) return 1;
+ // Finally, compare ExeContext addresses... older ones are likely to have
+ // lower addresses.
+ if (lr_a->key.allocated_at < lr_b->key.allocated_at) return -1;
+ if (lr_a->key.allocated_at > lr_b->key.allocated_at) return 1;
return 0;
}
Modified: trunk/memcheck/tests/leak-cases-full.stderr.exp
===================================================================
--- trunk/memcheck/tests/leak-cases-full.stderr.exp 2009-05-06 06:45:05 UTC (rev 9783)
+++ trunk/memcheck/tests/leak-cases-full.stderr.exp 2009-05-06 06:52:47 UTC (rev 9784)
@@ -6,42 +6,42 @@
16 bytes in 1 blocks are possibly lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cases.c:52)
- by 0x........: f (leak-cases.c:87)
+ by 0x........: f (leak-cases.c:78)
by 0x........: main (leak-cases.c:107)
16 bytes in 1 blocks are possibly lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cases.c:52)
- by 0x........: f (leak-cases.c:87)
+ by 0x........: f (leak-cases.c:81)
by 0x........: main (leak-cases.c:107)
16 bytes in 1 blocks are possibly lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cases.c:52)
- by 0x........: f (leak-cases.c:78)
+ by 0x........: f (leak-cases.c:84)
by 0x........: main (leak-cases.c:107)
16 bytes in 1 blocks are possibly lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cases.c:52)
- by 0x........: f (leak-cases.c:81)
+ by 0x........: f (leak-cases.c:84)
by 0x........: main (leak-cases.c:107)
16 bytes in 1 blocks are possibly lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cases.c:52)
- by 0x........: f (leak-cases.c:84)
+ by 0x........: f (leak-cases.c:87)
by 0x........: main (leak-cases.c:107)
16 bytes in 1 blocks are possibly lost in loss record ... of ...
at 0x........: malloc (vg_replace_malloc.c:...)
by 0x........: mk (leak-cases.c:52)
- by 0x........: f (leak-cases.c:84)
+ by 0x........: f (leak-cases.c:87)
by 0x........: main (leak-cases.c:107)
|