From 0b2adb52230d9a60b424c70ad01294019be1067d Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Wed, 26 Feb 2014 09:58:29 -0500 Subject: [PATCH] Bug 429157: Udpate tests to better test memory console change Change-Id: I418919c208ab456ce7edbc45edd61d11b54eecd2 Signed-off-by: Marc Khouzam --- .../GDBConsoleSynchronizingTest_7_6.java | 65 ++++++++++++++----- 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/GDBConsoleSynchronizingTest_7_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/GDBConsoleSynchronizingTest_7_6.java index 14eeaa21486..be522c0521d 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/GDBConsoleSynchronizingTest_7_6.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_6/GDBConsoleSynchronizingTest_7_6.java @@ -62,6 +62,9 @@ public class GDBConsoleSynchronizingTest_7_6 extends BaseTestCase { final static private int DEFAULT_TIMEOUT = 1000; final static private TimeUnit DEFAULT_TIME_UNIT = TimeUnit.MILLISECONDS; + final static private String NEW_VAR_VALUE = "0x12345678"; + final static private int NEW_VAR_SIZE = 4; // The number of bytes of NEW_VAR_VALUE + final static private byte[] NEW_MEM = { 0x12, 0x34, 0x56, 0x78 }; // The individual bytes of NEW_VAR_VALUE private DsfSession fSession; private DsfServicesTracker fServicesTracker; @@ -157,11 +160,11 @@ public class GDBConsoleSynchronizingTest_7_6 extends BaseTestCase { IExpressionDMAddress data = query.get(); IMemoryDMContext memoryDmc = DMContexts.getAncestorOfType(frameDmc, IMemoryDMContext.class); - readMemory(memoryDmc, data.getAddress(), 1); + readMemory(memoryDmc, data.getAddress(), NEW_VAR_SIZE); fEventsReceived.clear(); - final String newValue = "100"; + String newValue = NEW_VAR_VALUE; queueConsoleCommand("set variable i=" + newValue); IMemoryChangedEvent memoryEvent = waitForEvent(IMemoryChangedEvent.class); @@ -169,11 +172,18 @@ public class GDBConsoleSynchronizingTest_7_6 extends BaseTestCase { assertEquals(data.getAddress(), memoryEvent.getAddresses()[0]); // Now verify the memory service knows the new memory value - MemoryByte[] memory = readMemory(memoryDmc, data.getAddress(), 1); - assertEquals(newValue, Byte.toString(memory[0].getValue())); + MemoryByte[] memory = readMemory(memoryDmc, data.getAddress(), NEW_VAR_SIZE); + assertEquals(NEW_VAR_SIZE, memory.length); + for (int i=0; i