public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* How to send signals to test programs?
@ 2008-03-26  1:43 Nurdin Premji
  2008-03-26 12:36 ` Mark Wielaard
  2008-03-26 13:32 ` Andrew Cagney
  0 siblings, 2 replies; 3+ messages in thread
From: Nurdin Premji @ 2008-03-26  1:43 UTC (permalink / raw)
  To: frysk

Trying to create a test for stepping over and through signals. I have a 
simple the test program and I'm copying testcases from
frysk-core/frysk/stepping/TestStepping.java

How do I send a signal to my test program from the TestStepping test?

Thank you,
Nurdin

funit-signal.c:

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <signal.h>


volatile int j = 0;

void catch_usr (int sig_num)
{
        signal(SIGUSR1, 
catch_usr);                                             // 
_signalSigHandlerEntry_
        --j;
        ++j;
}

int
main ( int argc, char *argv[]) {

        signal(SIGUSR1, catch_usr);

        
--j;                                                                    
// _startTestEntry_
        ++j;
        return 0;
}


TestStepping.java addition:

public void testStepThroughSignal() {
        /** Variable setup */

        String source = Config.getRootSrcDir()
            + "frysk-core/frysk/pkglibdir/funit-signal.c";

        this.scanner = new TestfileTokenScanner(new File(source));

        /* The line number where the test begins */
        int start = this.scanner.findTokenLine("_startTestEntry_");

        /* The line number the test should end up at */
        int end = this.scanner.findTokenLine("_signalSigHandlerEntry_");

        /* The test process */
        SynchronizedOffspring process
            = new SynchronizedOffspring(Signal.USR1,
                                        new String[] {
                                            getExecPath("funit-signal")
                                        });
        this.testStarted = false;

        /** Test initialization */
        Task myTask = initTask(process, source, start, end);

        this.currentTest = new AssertLine(end, myTask);

        DebugInfoFrame frame = DebugInfoStackFactory
            .createDebugInfoStackTrace(myTask);
        assertTrue("Line information present", frame.getLine() != 
SourceLocation.UNKNOWN);

        /** The stepping operation */
        this.se.stepLine(myTask);

        /* TODO: Send Signal to myTask */

        this.testStarted = true;

        /** Run to completion */
        assertRunUntilStop("Running test");
        cleanup();
    }

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

end of thread, other threads:[~2008-03-26 13:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-26  1:43 How to send signals to test programs? Nurdin Premji
2008-03-26 12:36 ` Mark Wielaard
2008-03-26 13:32 ` 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).