frysk.testbed
Class SlaveOffspring

java.lang.Object
  extended by frysk.testbed.Offspring
      extended by frysk.testbed.SynchronizedOffspring
          extended by frysk.testbed.SlaveOffspring

public class SlaveOffspring
extends SynchronizedOffspring

Create a process running the funit slave (a.k.a., funit-child). The slave can be manipulated using various signals and methods listed below.


Field Summary
private static Signal ADD_CLONE_SIG
           
private static Signal ADD_FORK_SIG
           
static Signal CHILD_ACK
           
private static Signal DEL_CLONE_SIG
           
private static Signal DEL_FORK_SIG
           
private static Signal[] EXEC_ACK
           
private static Signal EXEC_CLONE_SIG
           
private static Signal EXEC_SIG
           
static Signal PARENT_ACK
           
private static Signal[] SPAWN_ACK
           
private static Signal ZOMBIE_FORK_SIG
           
 
Fields inherited from class frysk.testbed.SynchronizedOffspring
START_ACK
 
Constructor Summary
private SlaveOffspring(OffspringType type)
          Create an ack process.
private SlaveOffspring(OffspringType type, boolean busy)
          Create an SlaveOffspring; if BUSY, the process will use a busy-loop, instead of suspending, when waiting for signal commands.
private SlaveOffspring(OffspringType type, String[] args)
          Create an ack process with args.
 
Method Summary
 SlaveOffspring assertSendAddClonesWaitForAcks(int count)
          Add many Tasks; wait for acknowledgement.
 void assertSendAddCloneWaitForAcks()
          Add a Task; wait for acknowledgement.
 void assertSendAddForkWaitForAcks()
          Add a child Proc; wait for acknowledgement
 void assertSendDelCloneWaitForAcks()
          Delete a Task.
 void assertSendDelForkWaitForAcks()
          Delete a child Proc.
 void assertSendExecCloneWaitForAcks()
          Request that the cloned task perform an exec.
 void assertSendExecWaitForAcks()
          Request that the main task perform an exec; wait for the acknowledge.
 void assertSendFryParentWaitForAcks()
          Kill the parent, expect an ack from the child (there had better be a child).
 void assertSendZombieForkWaitForAcks()
          Terminate a fork Proc (creates zombie).
static SlaveOffspring createAttachedChild()
          Create an attached slave-process that is a child of this process.
static SlaveOffspring createChild()
          Create a slave-process that is a child of this process.
static SlaveOffspring createDaemon()
          Create a slave-process that is a child of this process.
static SlaveOffspring createDaemon(boolean busy)
          Create a slave-process that is a child of this process.
static SlaveOffspring createDaemon(String[] args)
          Create a slave-process that is a child of this process with args.
private static String[] funitSlaveCommand(boolean busy, String[] argv)
          Build the slave command that should be run.
static File getExecutable()
          Return the program executable that will be run.
 void reap()
          Reap the process..
 Signal[] requestClone()
          Request that a task be added.
 Signal[] requestExec()
          Request that the main task perform an exec.
 Signal[] requestFork()
          Request that a child Proc be added.
private  void spawn(ProcessIdentifier tid, Signal sig, String why)
          Tell TID to create a new offspring.
 
Methods inherited from class frysk.testbed.SynchronizedOffspring
getPid
 
Methods inherited from class frysk.testbed.Offspring
assertIs, assertRunToFindProc, assertRunUntil, assertSendStop, findTaskUsingRefresh, kill, signal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHILD_ACK

public static final Signal CHILD_ACK

PARENT_ACK

public static final Signal PARENT_ACK

SPAWN_ACK

private static final Signal[] SPAWN_ACK

EXEC_ACK

private static final Signal[] EXEC_ACK

ADD_CLONE_SIG

private static final Signal ADD_CLONE_SIG

DEL_CLONE_SIG

private static final Signal DEL_CLONE_SIG

ADD_FORK_SIG

private static final Signal ADD_FORK_SIG

DEL_FORK_SIG

private static final Signal DEL_FORK_SIG

ZOMBIE_FORK_SIG

private static final Signal ZOMBIE_FORK_SIG

EXEC_SIG

private static final Signal EXEC_SIG

EXEC_CLONE_SIG

private static final Signal EXEC_CLONE_SIG
Constructor Detail

SlaveOffspring

private SlaveOffspring(OffspringType type)
Create an ack process.


SlaveOffspring

private SlaveOffspring(OffspringType type,
                       String[] args)
Create an ack process with args.


SlaveOffspring

private SlaveOffspring(OffspringType type,
                       boolean busy)
Create an SlaveOffspring; if BUSY, the process will use a busy-loop, instead of suspending, when waiting for signal commands.

Method Detail

funitSlaveCommand

private static String[] funitSlaveCommand(boolean busy,
                                          String[] argv)
Build the slave command that should be run.


spawn

private void spawn(ProcessIdentifier tid,
                   Signal sig,
                   String why)
Tell TID to create a new offspring. Wait for the acknowledgment.


assertSendAddCloneWaitForAcks

public void assertSendAddCloneWaitForAcks()
Add a Task; wait for acknowledgement.


requestClone

public Signal[] requestClone()
Request that a task be added.


assertSendAddClonesWaitForAcks

public SlaveOffspring assertSendAddClonesWaitForAcks(int count)
Add many Tasks; wait for acknowledgement.


assertSendDelCloneWaitForAcks

public void assertSendDelCloneWaitForAcks()
Delete a Task.


assertSendAddForkWaitForAcks

public void assertSendAddForkWaitForAcks()
Add a child Proc; wait for acknowledgement


requestFork

public Signal[] requestFork()
Request that a child Proc be added.


assertSendDelForkWaitForAcks

public void assertSendDelForkWaitForAcks()
Delete a child Proc.


assertSendZombieForkWaitForAcks

public void assertSendZombieForkWaitForAcks()
Terminate a fork Proc (creates zombie).


assertSendFryParentWaitForAcks

public void assertSendFryParentWaitForAcks()
Kill the parent, expect an ack from the child (there had better be a child).


assertSendExecWaitForAcks

public void assertSendExecWaitForAcks()
Request that the main task perform an exec; wait for the acknowledge.


requestExec

public Signal[] requestExec()
Request that the main task perform an exec.


assertSendExecCloneWaitForAcks

public void assertSendExecCloneWaitForAcks()
Request that the cloned task perform an exec.


reap

public void reap()
Reap the process.. Kill the process and then wait for and consume all of that processes waitpid events.


createChild

public static SlaveOffspring createChild()
Create a slave-process that is a child of this process.


createDaemon

public static SlaveOffspring createDaemon()
Create a slave-process that is a child of this process.


createDaemon

public static SlaveOffspring createDaemon(String[] args)
Create a slave-process that is a child of this process with args.


createDaemon

public static SlaveOffspring createDaemon(boolean busy)
Create a slave-process that is a child of this process.


createAttachedChild

public static SlaveOffspring createAttachedChild()
Create an attached slave-process that is a child of this process.


getExecutable

public static File getExecutable()
Return the program executable that will be run.