This is the mail archive of the
frysk@sources.redhat.com
mailing list for the frysk project.
Re: Additional PtraceBuffer tests
On Tue, 2006-07-04 at 12:45 +0200, Mark Wielaard wrote:
> This patch adds some more checks to make the test more robust.
>
> 2006-07-04 Mark Wielaard <mark@klomp.org>
>
> * frysk-sys/frysk/sys/TestPtraceByteBuffer.java
> (testTextVariable): Make sure we are manipulating only the child
> text area not our own.
Now with actual patch attached. Duh...
Index: frysk-sys/frysk/sys/TestPtraceByteBuffer.java
===================================================================
RCS file: /cvs/frysk/frysk-sys/frysk/sys/TestPtraceByteBuffer.java,v
retrieving revision 1.3
diff -u -r1.3 TestPtraceByteBuffer.java
--- frysk-sys/frysk/sys/TestPtraceByteBuffer.java 28 Jun 2006 10:06:39 -0000 1.3
+++ frysk-sys/frysk/sys/TestPtraceByteBuffer.java 4 Jul 2006 10:37:50 -0000
@@ -115,6 +115,8 @@
intVal = buffer.getInt(addr);
assertEquals("Forked child int value after poke", 2, intVal);
+ assertEquals("Our own int value", 42, TestLib.intVal);
+
// Byte
addr = TestLib.getByteValAddr();
byte byteVal = buffer.getByte(addr);
@@ -124,6 +126,8 @@
byteVal = buffer.getByte(addr);
assertEquals("Forked child long value after poke", 3, byteVal);
+ assertEquals("Our own byte value", 43, TestLib.byteVal);
+
// Long
addr = TestLib.getLongValAddr();
long longVal = buffer.getLong(addr);
@@ -133,10 +137,11 @@
longVal = buffer.getLong(addr);
assertEquals("Forked child long value after poke", 4, longVal);
+ assertEquals("Our own long value", 44, TestLib.longVal);
// Pretend we have little endian values now
newBytes = new byte[]
- { (byte) 52, (byte) 0, (byte) 0, (byte) 0 };
+ { (byte) 62, (byte) 0, (byte) 0, (byte) 0 };
addr = TestLib.getIntValAddr();
buffer.position(addr);
buffer.putByte(newBytes[0]);
@@ -145,10 +150,10 @@
buffer.putByte(newBytes[3]);
addr = TestLib.getByteValAddr();
- buffer.putByte(addr, (byte) 53);
+ buffer.putByte(addr, (byte) 63);
newBytes = new byte[]
- { (byte) 54, (byte) 0, (byte) 0, (byte) 0,
+ { (byte) 64, (byte) 0, (byte) 0, (byte) 0,
(byte) 0, (byte) 0, (byte) 0, (byte) 0 };
addr = TestLib.getLongValAddr();
buffer.position(addr);
@@ -166,29 +171,35 @@
// Int
addr = TestLib.getIntValAddr();
intVal = buffer.getInt(addr);
- assertEquals("Our own int value", 42, TestLib.intVal);
+ assertEquals("Forked child int value", 62, intVal);
buffer.putInt(addr, 2);
intVal = buffer.getInt(addr);
assertEquals("Forked child int value after poke", 2, intVal);
+ assertEquals("Our own int value", 42, TestLib.intVal);
+
// Byte
addr = TestLib.getByteValAddr();
byteVal = buffer.getByte(addr);
- assertEquals("Forked child byte value", 53, byteVal);
+ assertEquals("Forked child byte value", 63, byteVal);
buffer.putByte(addr, (byte) 3);
byteVal = buffer.getByte(addr);
assertEquals("Forked child long value after poke", 3, byteVal);
+ assertEquals("Our own byte value", 43, TestLib.byteVal);
+
// Long
addr = TestLib.getLongValAddr();
longVal = buffer.getLong(addr);
- assertEquals("Forked child long value", 54, longVal);
+ assertEquals("Forked child long value", 64, longVal);
buffer.putLong(addr, 4);
longVal = buffer.getLong(addr);
assertEquals("Forked child long value after poke", 4, longVal);
+
+ assertEquals("Our own long value", 44, TestLib.longVal);
}
/**