public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Delete long disabled memory test; resolve 3725.
@ 2008-03-11 14:02 cagney
  0 siblings, 0 replies; only message in thread
From: cagney @ 2008-03-11 14:02 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  6d67bc37490287adde65bb6c27f2274a0cc8b53d (commit)
      from  d2b45db5fdcf5094be981b00b77106374924e5cb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 6d67bc37490287adde65bb6c27f2274a0cc8b53d
Author: Andrew Cagney <cagney@redhat.com>
Date:   Tue Mar 11 09:59:03 2008 -0400

    Delete long disabled memory test; resolve 3725.
    
    frysk-core/frysk/pkglibdir/ChangeLog
    2008-03-11  Andrew Cagney  <cagney@redhat.com>
    
    	* funit-memory.c: Delete.
    
    frysk-core/frysk/proc/ChangeLog
    2008-03-11  Andrew Cagney  <cagney@redhat.com>
    
    	* TestMemory.java: Delete.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/pkglibdir/ChangeLog      |    4 +
 frysk-core/frysk/pkglibdir/funit-memory.c |  162 ----------------------
 frysk-core/frysk/proc/ChangeLog           |    2 +
 frysk-core/frysk/proc/TestMemory.java     |  211 -----------------------------
 4 files changed, 6 insertions(+), 373 deletions(-)
 delete mode 100644 frysk-core/frysk/pkglibdir/funit-memory.c
 delete mode 100644 frysk-core/frysk/proc/TestMemory.java

First 500 lines of diff:
diff --git a/frysk-core/frysk/pkglibdir/ChangeLog b/frysk-core/frysk/pkglibdir/ChangeLog
index 8ba0e2f..b98305f 100644
--- a/frysk-core/frysk/pkglibdir/ChangeLog
+++ b/frysk-core/frysk/pkglibdir/ChangeLog
@@ -1,3 +1,7 @@
+2008-03-11  Andrew Cagney  <cagney@redhat.com>
+
+	* funit-memory.c: Delete.
+
 2008-03-10  Mark Wielaard  <mwielaard@redhat.com>
 
 	* funit-libfunccall.c: New test program for TestLibFunctionStepFrame.
diff --git a/frysk-core/frysk/pkglibdir/funit-memory.c b/frysk-core/frysk/pkglibdir/funit-memory.c
deleted file mode 100644
index ffab3d7..0000000
--- a/frysk-core/frysk/pkglibdir/funit-memory.c
+++ /dev/null
@@ -1,162 +0,0 @@
-// This file is part of the program FRYSK.
-//
-// Copyright 2005, Red Hat Inc.
-//
-// FRYSK is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// FRYSK is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with FRYSK; if not, write to the Free Software Foundation,
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-// 
-// In addition, as a special exception, Red Hat, Inc. gives You the
-// additional right to link the code of FRYSK with code not covered
-// under the GNU General Public License ("Non-GPL Code") and to
-// distribute linked combinations including the two, subject to the
-// limitations in this paragraph. Non-GPL Code permitted under this
-// exception must only link to the code of FRYSK through those well
-// defined interfaces identified in the file named EXCEPTION found in
-// the source code files (the "Approved Interfaces"). The files of
-// Non-GPL Code may instantiate templates or use macros or inline
-// functions from the Approved Interfaces without causing the
-// resulting work to be covered by the GNU General Public
-// License. Only Red Hat, Inc. may make changes or additions to the
-// list of Approved Interfaces. You must obey the GNU General Public
-// License in all respects for all of the FRYSK code and other code
-// used in conjunction with FRYSK except the Non-GPL Code covered by
-// this exception. If you modify this file, you may extend this
-// exception to your version of the file, but you are not obligated to
-// do so. If you do not wish to provide this exception without
-// modification, you must delete this exception statement from your
-// version and license this file solely under the GPL without
-// exception.
-
-#include <stdlib.h>
-#include <signal.h>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-
-int j;
-volatile int *k;
-
-void handler (int sig)
-{
-  signal (SIGSEGV, SIG_IGN);
-}
-
-typedef union {
-  int16_t val;
-  char ch[2];
-} union16_t;
-
-typedef union {
-  int32_t val;
-  char ch[4];
-} union32_t;
-
-typedef union {
-  int64_t val;
-  char ch[8];
-} union64_t;
-
-int
-main (int argc, char **argv)
-{
-  int i;
-  FILE *fp;
-  char arr[17016];
-  char *arrPtr = arr;
-  char ch_array[] = "abcdefghijklmnopqrstuvwxyz";
-  union16_t x;
-  union32_t y;
-  union64_t z;
-
-  memset (arr, 0xff, sizeof (arr));
-
-  /* Write out the memory area address (and its size) so frysk
-     can modify the memory without having to know the architecture.  */
-  fp = fopen ("memAddr.file", "wb");
-  if (fwrite (&arrPtr, sizeof (arrPtr), 1, fp) != 1) {
-    perror ("fwrite");
-    abort ();
-  }
-  fclose (fp);
- 
-  /* Signal to frysk that memory address is accessible via special file.  */ 
-  signal (SIGSEGV, &handler);
-  kill (getpid (), SIGSEGV);
-
-  /* Verify modifications.  */
-
-  /* Start with individual bytes across a typical page boundary.  */
-  for (i = 0; i < 4097; ++i) {
-     if (arr[i] != ch_array[i % 26]) {
-     	printf ("char %d was %x instead of %x\n", i, arr[i], 
-		 ch_array[i%26]);
-	abort ();
-     }
-  }
-
-  /* Next verify 16-bit int values (some negative) across the next page.  */
-  for (i = 0; i < 100; ++i) {
-     int16_t val = *((int16_t *) (arr + 8000 + i * 2));
-     if (val != 50 - i) {
-     	printf ("short %d was %hx instead of %hx\n", i, val, 50 - i);
-	abort ();
-     }
-  }
-
-  /* Verify a 16-bit value that is unaligned.  */
-  x.ch[0] = arr[9999];
-  x.ch[1] = arr[10000];
-
-  if (x.val != (int16_t) 0xdeaf) {
-     printf ("unaligned int16_t value was %hx instead of %hx\n", 
-	     x.val, (int16_t) 0xdeaf);
-     abort ();
-  }
-
-  /* Next verify 32-bit int values (some negative) across the next page.  */
-  for (i = 0; i < 100; ++i) {
-     int32_t val = *((int32_t *) (arr + 12096 + i * 4));
-     if (val != 50 - i) {
-     	printf ("int value %d is <%x> instead of <%x>\n", i, val, 50 - i);
-	abort ();
-     }
-  }
-
-  /* Verify a 32-bit value that is unaligned.  */
-  memcpy (y.ch, arr + 14001, 4);
-  if (y.val != (int32_t) 0xabcdef01) {
-     printf ("unaligned int32_t value is incorrect\n");
-     abort ();
-  }
-
-  /* Next verify 64-bit int values (some negative) across the next page.  */
-  for (i = 0; i < 100; ++i) {
-     int64_t val = *((int64_t *) (arr + 16192 + i * 8));
-     if (val != (int64_t) (50 - i)) {
-     	printf ("int64_t value %d is incorrect\n", i);
-	abort ();
-     }
-  }
-
-  /* Verify a 64-bit value that is unaligned.  */
-  memcpy (z.ch, arr + 17003, 8);
-  if (z.val != (int64_t) 0xabcdef0123456789LL) {
-     printf ("unaligned int64_t value is incorrect");
-     abort ();
-  }
-
-  exit (0);
-}
-
-
diff --git a/frysk-core/frysk/proc/ChangeLog b/frysk-core/frysk/proc/ChangeLog
index ca3c0d6..96d84d5 100644
--- a/frysk-core/frysk/proc/ChangeLog
+++ b/frysk-core/frysk/proc/ChangeLog
@@ -1,5 +1,7 @@
 2008-03-11  Andrew Cagney  <cagney@redhat.com>
 
+	* TestMemory.java: Delete.
+
 	* SyscallExaminer.java: Delete.
 
 	* Proc.java (getMainTask()): Make abstract.
diff --git a/frysk-core/frysk/proc/TestMemory.java b/frysk-core/frysk/proc/TestMemory.java
deleted file mode 100644
index eeef900..0000000
--- a/frysk-core/frysk/proc/TestMemory.java
+++ /dev/null
@@ -1,211 +0,0 @@
-// This file is part of the program FRYSK.
-//
-// Copyright 2005, 2006, 2007, 2008, Red Hat Inc.
-//
-// FRYSK is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// FRYSK is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with FRYSK; if not, write to the Free Software Foundation,
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-// 
-// In addition, as a special exception, Red Hat, Inc. gives You the
-// additional right to link the code of FRYSK with code not covered
-// under the GNU General Public License ("Non-GPL Code") and to
-// distribute linked combinations including the two, subject to the
-// limitations in this paragraph. Non-GPL Code permitted under this
-// exception must only link to the code of FRYSK through those well
-// defined interfaces identified in the file named EXCEPTION found in
-// the source code files (the "Approved Interfaces"). The files of
-// Non-GPL Code may instantiate templates or use macros or inline
-// functions from the Approved Interfaces without causing the
-// resulting work to be covered by the GNU General Public
-// License. Only Red Hat, Inc. may make changes or additions to the
-// list of Approved Interfaces. You must obey the GNU General Public
-// License in all respects for all of the FRYSK code and other code
-// used in conjunction with FRYSK except the Non-GPL Code covered by
-// this exception. If you modify this file, you may extend this
-// exception to your version of the file, but you are not obligated to
-// do so. If you do not wish to provide this exception without
-// modification, you must delete this exception statement from your
-// version and license this file solely under the GPL without
-// exception.
-
-package frysk.proc;
-
-import frysk.config.Config;
-import java.util.Observer;
-import frysk.isa.signals.Signal;
-import java.util.Observable;
-import inua.eio.ArrayByteBuffer;
-import inua.eio.ByteBuffer;
-import frysk.testbed.TestLib;
-import frysk.testbed.TaskObserverBase;
-import frysk.testbed.DaemonBlockedAtEntry;
-
-/**
- * Check that memory can be modified.
- *
- * This test case has frysk run a C program that opens a file and
- * records a memory address inside.  A SIGSEGV is generated by the
- * program so that frysk can know when the file is ready.  Frysk gets
- * the address, modifies the program's memory and finally continues
- * the C program.  The C program verifies that the memory has been
- * changed as expected and either exits cleanly or aborts.
- */
-
-public class TestMemory
-   extends TestLib
-{
-    /**
-     * Timers, observers, counters, etc.. needed for the test.
-     *
-     * XXX: Please do not copy.  This came from the most evilly
-     * complex code and needs to be rewriten.
-     */
-    class TestModifyXXX {
-	volatile int stoppedTaskEventCount;
-	volatile boolean exited;
-	volatile int exitedTaskEventStatus;
-	boolean openingTestFile;
-	boolean testFileOpened;
-	boolean expectedRcFound;
-	String memAddrFileName = "memAddr.file";
-	
-	// Need to add task observers to the process the moment it is
-	// created, otherwize the creation of the very first task is
-	// missed (giving a mismatch of task created and deleted
-	// notifications.)
-	class TaskEventObserver extends TaskObserverBase
-	    implements TaskObserver.Signaled
-	{
-	    public Action updateSignaled(Task task, Signal sig) {
-		if (sig.intValue() == frysk.sys.Signal.SEGV.intValue()) {
-		    ByteBuffer b;
-		    long memAddr;
-		    long addr;
-		    
-		    // At this point, the program has signalled us to let
-		    // us know that a file exists with the int size and
-		    // memory address to modify.
-		    try {
-			java.io.FileInputStream memAddrFile
-			    = new java.io.FileInputStream (memAddrFileName);
-			byte[] buf = new byte[16];
-			int len = memAddrFile.read (buf);
-			b = new ArrayByteBuffer (buf, 0, len);
-			b.order (task.getISA().order());
-			b.wordSize (task.getISA().wordSize());
-			memAddrFile.close ();
-			// Make sure file is deleted.
-			java.io.File f = new java.io.File (memAddrFileName);
-			f.delete ();
-		    }
-		    catch (Exception x) {
-			throw new RuntimeException (x);
-		    }
-		    memAddr = b.getUWord ();
-		    addr = memAddr;
-		    String chString = "abcdefghijklmnopqrstuvwxyz";
-            
-            ByteBuffer memory = task.getMemory();
-		    // Modify byte values across a page boundary.
-		    for (int i = 0; i < 4097; ++i)
-			memory.putByte (addr + i, 
-					     (byte) chString.charAt (i % 26));
-		    // Modify short values across a page boundary.
-		    addr = memAddr + 8000;
-		    for (int i = 0; i < 100; ++i)
-			memory.putShort (addr + i * 2, 
-					      (short) (50 - i));
-		    // Modify an unaligned short value.
-		    addr = memAddr + 9999;
-		    memory.putShort (addr, (short) 0xdeaf);
-		    // Modify int values across a page boundary.
-		    addr = memAddr + 12096;
-		    for (int i = 0; i < 100; ++i)
-			memory.putInt (addr + i * 4, 
-					    (int) (50 - i));
-		    // Modify an unaligned int value.
-		    addr = memAddr + 14001;
-		    memory.putInt (addr, (int) 0xabcdef01);
-		    // Modify long values across a page boundary.
-		    addr = memAddr + 16192;
-		    for (int i = 0; i < 100; ++i)
-			memory.putLong (addr + i * 8, 
-					     (long) (50 - i));
-		    // Modify an unaligned int value.
-		    addr = memAddr + 17003;
-		    memory.putLong (addr, (long) 0xabcdef0123456789L);
-		}
-		return Action.CONTINUE;
-	    }
-	}
-	
-	TaskEventObserver taskEventObserver = new TaskEventObserver ();
-	
-	class ProcRemovedObserver
-	    implements Observer
-	{
-	    volatile int count;
-	    public void update (Observable o, Object obj)
-	    {
-		Proc process = (Proc) obj;
-		if (isChildOfMine (process)) {
-		    Manager.eventLoop.requestStop ();
-		}
-	    }
-	}
-	
-	class TaskTerminatedObserver
-	    extends TaskObserverBase
-	    implements TaskObserver.Terminated
-	{
-	    public Action updateTerminated(Task task, Signal signal,
-					   int value) {
-		if (signal == null) {
-		    exitedTaskEventStatus = value;
-		    exited = true;
-		}
-		return Action.CONTINUE;
-	    }
-	}
-
-	TestModifyXXX ()
-	{
-	    host.observableTaskAddedXXX.addObserver (new Observer ()
-		{
-		    public void update (Observable o, Object obj)
-		    {
-			Task task = (Task) obj;
-			if (!isChildOfMine (task.getProc()))
-			    return;
-			task.requestAddTerminatedObserver (new TaskTerminatedObserver ());
-			task.requestAddSignaledObserver (taskEventObserver);
-		    }
-		});
-	    host.observableProcRemovedXXX.addObserver
-		(new ProcRemovedObserver ());
-	}
-    }
-	
-    public void testMemoryReadWrite ()
-    {
-	if (unresolved(3725))
-	    return;
-	TestModifyXXX t = new TestModifyXXX ();
-	// Create program making syscalls
-	new DaemonBlockedAtEntry (Config.getPkgLibFile("funit-memory"))
-	    .requestRemoveBlock ();
-
-	assertRunUntilStop ("run \"modify\" to exit");
-
-	assertTrue ("proc exit confirmed", t.exited);
-   }
-}


hooks/post-receive
--
frysk system monitor/debugger


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-11 14:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-11 14:02 [SCM] master: Delete long disabled memory test; resolve 3725 cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).