Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/5241

Change subject: tests: Add a test case to the rangemap unit test that exposes a bug.
......................................................................

tests: Add a test case to the rangemap unit test that exposes a bug.

When looking up a range in a rangemap, the find function would use upper_bound to determine what region to check. The region directly before the upper_bound
has a starting point which is less than the current region, and since the
ranges in the map are assumed to be non-overlapping, if that region doesn't
overlap with us then no earlier one will either, since they would have to cover
the one we already checked to get to us.

The region upper_bound returns also needs to be checked though. Even though
it starts farther up than we do, our end point may extend far enough to touch.
This was slipping by the unit test because the region in the map that this
would apply to was at the beginning of the map, and there was some specialied
logic which handled that case.

This change adds a check to the unit test which catches this case. A
subsequent change will rework the AddrRangeMap class to handle this case
properly.

Change-Id: I2066beef56fc968d770d83e7cacdd272cf05b410
---
M src/unittest/rangemaptest.cc
1 file changed, 3 insertions(+), 0 deletions(-)



diff --git a/src/unittest/rangemaptest.cc b/src/unittest/rangemaptest.cc
index 6975f66..1b44268 100644
--- a/src/unittest/rangemaptest.cc
+++ b/src/unittest/rangemaptest.cc
@@ -63,6 +63,9 @@
     assert(i != r.end());
     cout << i->first.to_string() << " " << i->second << endl;

+    i = r.find(RangeIn(50, 61));
+    assert(i != r.end());
+
     i = r.find(RangeIn(55, 55));
     assert(i == r.end());


--
To view, visit https://gem5-review.googlesource.com/5241
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2066beef56fc968d770d83e7cacdd272cf05b410
Gerrit-Change-Number: 5241
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to