public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* Need help with a 64 bit vs 32 bit isa test.
@ 2006-11-30 18:17 Nurdin Premji
  2006-11-30 20:29 ` Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Nurdin Premji @ 2006-11-30 18:17 UTC (permalink / raw)
  To: Frysk Hackers

I have written a test case that tries to check that the isa changes if a
64 bit program executes a 32 bit application and I'm having trouble
getting it to execute.

The testcase is just to run 
/frysk-core/frysk/pkglibexecdir/funit-exec $$ SIGUSR1
5 /frysk-core/frysk/pkglibexecdir/arch32/funit-exec $$ SIGUSR1 5 echo
hello

and send it a SIGUSR1 to execute the 32 bit program.
This seems to work on the command line but it isn't working in the test
case.

The problem is sending the process the SIGUSR1 doesn't cause it to exec
like it should.

Here is the test case code, anyone want to tell me where I'm going
wrong? (All inside a class that extends frysk.proc.TestLib)

class AttachedObserver
      extends TaskObserverBase
      implements TaskObserver.Attached
  {
    public Action updateAttached (Task task)
    {
      assertNotNull("task isa initialized", task.lazyGetIsa());
      assertNotNull("Task memory initialized", task.memory);
      assertNotNull("Task register bank initialized",
task.registerBank);
      Manager.eventLoop.requestStop();
      return Action.CONTINUE;
    }
  }

  public class AckExecProc
      extends Child
  {
    protected AckExecProc (Sig sig, String[] argv)
    {
      super(sig, argv);
      // TODO Auto-generated constructor stub
    }

    protected int startChild (String stdin, String stdout, String
stderr,
                              String[] argv)
    {
      return Fork.exec (stdin, stdout, stderr, argv);
    }

  }

  public void test64To32Isa ()
  {
    String[] command = new String[] { getExecPrefix() + "funit-exec",
                                     String.valueOf(Pid.get()),
                                     String.valueOf(Sig.USR1_), "5",
                                     getExecPrefix() +
"arch32/funit-exec",
                                     String.valueOf(Pid.get()),
                                     String.valueOf(Sig.USR1_), "5",
                                     "echo hello" };

    Child ackProc = new AckExecProc(childAck, command);

    Proc proc = ackProc.findProcUsingRefresh(true);

    Task task = proc.getMainTask();
    
    AttachedObserver attacher = new AttachedObserver();
    
    task.requestAddAttachedObserver(attacher);
    assertRunUntilStop("Attaching to proc");

    Isa isa64 = null;
    try
      {
        assertNotNull("64 bit isa", task.getIsa());

        isa64 = task.getIsa();
      }
    catch (TaskException e)
      {
        fail("TaskException");
        e.printStackTrace();
      }

    class ExecuteObserver
        extends TaskObserverBase
        implements TaskObserver.Execed
    {

      public void addedTo (Object o)
      {
        Manager.eventLoop.requestStop();
      }

      public Action updateExeced (Task task)
      {
        Manager.eventLoop.requestStop();
        return Action.CONTINUE;
      }

    }

    ExecuteObserver executer = new ExecuteObserver();

    proc.getMainTask().requestAddExecedObserver(executer);
    assertRunUntilStop("Adding observer");

    //AckHandler ack = new AckHandler(Sig.USR1, "assertExec");
    ackProc.signal(ackProc.getPid(), Sig.USR1);
    //ack.await();

     assertRunUntilStop("Executing");
    try
      {
        assertNotNull("32 bit isa", task.getIsa());
        assertNotSame("32 bit and 64 bit isa", task.getIsa(), isa64);
      }
    catch (TaskException e)
      {
        fail("TaskException");
        e.printStackTrace();
      }

    // funit-exec $$ 0 5 /usr/libexec/frysk/64/funit-exec $$ 0 5
    // /usr/libexec/frysk/32/funit-exec $$ 0
5 /usr/libexec/frysk/64/funit-exit
    // 0
  }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Need help with a 64 bit vs 32 bit isa test.
  2006-11-30 18:17 Need help with a 64 bit vs 32 bit isa test Nurdin Premji
@ 2006-11-30 20:29 ` Andrew Cagney
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2006-11-30 20:29 UTC (permalink / raw)
  To: Nurdin Premji; +Cc: Frysk Hackers

Nurdin Premji wrote:
> I have written a test case that tries to check that the isa changes if a
> 64 bit program executes a 32 bit application and I'm having trouble
> getting it to execute.
>
>     String[] command = new String[] { getExecPrefix() + "funit-exec",
>                                      String.valueOf(Pid.get()),
>   
Isn't there a Sig.USR.method() for that, hmm create a bug against inua :-)
>                                      String.valueOf(Sig.USR1_), "5",
>                                      getExecPrefix() +
> "arch32/funit-exec",
>                                      String.valueOf(Pid.get()),
>                                      String.valueOf(Sig.USR1_), "5",
>   
this should be two separate parameters:

>                                      "echo hello" };
>   

In playing with funit-exec I noticed a few bugs at least with

- forgot the timeout parameter and it exited normally!
- it doesn't exit when the timeout expires

once that is fixed, perhaps create a bug with a trace-log attachment os 
its possible to see what is happening.

Andrew

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-11-30 20:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-30 18:17 Need help with a 64 bit vs 32 bit isa test Nurdin Premji
2006-11-30 20:29 ` Andrew 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).