Fix self-test failure in addrmap
Mark pointed out that my recent addrmap C++-ficiation changes caused a regression in the self-tests. This patch fixes the problem by updating this test not to allocate the mutable addrmap on an obstack.
This commit is contained in:
parent
32681b482a
commit
aa09537375
1 changed files with 3 additions and 7 deletions
|
@ -429,9 +429,8 @@ test_addrmap ()
|
||||||
void *val2 = &array[2];
|
void *val2 = &array[2];
|
||||||
|
|
||||||
/* Create mutable addrmap. */
|
/* Create mutable addrmap. */
|
||||||
struct obstack temp_obstack;
|
auto_obstack temp_obstack;
|
||||||
obstack_init (&temp_obstack);
|
std::unique_ptr<struct addrmap_mutable> map (new addrmap_mutable);
|
||||||
struct addrmap_mutable *map = new (&temp_obstack) addrmap_mutable;
|
|
||||||
SELF_CHECK (map != nullptr);
|
SELF_CHECK (map != nullptr);
|
||||||
|
|
||||||
/* Check initial state. */
|
/* Check initial state. */
|
||||||
|
@ -445,7 +444,7 @@ test_addrmap ()
|
||||||
|
|
||||||
/* Create corresponding fixed addrmap. */
|
/* Create corresponding fixed addrmap. */
|
||||||
struct addrmap *map2
|
struct addrmap *map2
|
||||||
= new (&temp_obstack) addrmap_fixed (&temp_obstack, map);
|
= new (&temp_obstack) addrmap_fixed (&temp_obstack, map.get ());
|
||||||
SELF_CHECK (map2 != nullptr);
|
SELF_CHECK (map2 != nullptr);
|
||||||
CHECK_ADDRMAP_FIND (map2, array, 0, 9, nullptr);
|
CHECK_ADDRMAP_FIND (map2, array, 0, 9, nullptr);
|
||||||
CHECK_ADDRMAP_FIND (map2, array, 10, 12, val1);
|
CHECK_ADDRMAP_FIND (map2, array, 10, 12, val1);
|
||||||
|
@ -479,9 +478,6 @@ test_addrmap ()
|
||||||
CHECK_ADDRMAP_FIND (map, array, 10, 12, val1);
|
CHECK_ADDRMAP_FIND (map, array, 10, 12, val1);
|
||||||
CHECK_ADDRMAP_FIND (map, array, 13, 13, val2);
|
CHECK_ADDRMAP_FIND (map, array, 13, 13, val2);
|
||||||
CHECK_ADDRMAP_FIND (map, array, 14, 19, nullptr);
|
CHECK_ADDRMAP_FIND (map, array, 14, 19, nullptr);
|
||||||
|
|
||||||
/* Cleanup. */
|
|
||||||
obstack_free (&temp_obstack, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace selftests
|
} // namespace selftests
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue