From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1370 invoked by alias); 26 Mar 2008 13:32:55 -0000 Received: (qmail 1356 invoked by uid 22791); 26 Mar 2008 13:32:53 -0000 X-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_47,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 26 Mar 2008 13:32:27 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m2QDWOR2002025 for ; Wed, 26 Mar 2008 09:32:24 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m2QDWOEt029153; Wed, 26 Mar 2008 09:32:24 -0400 Received: from localhost.localdomain (sebastian-int.corp.redhat.com [172.16.52.221]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m2QDWOCd026059; Wed, 26 Mar 2008 09:32:24 -0400 Message-ID: <47EA502A.1040306@redhat.com> Date: Wed, 26 Mar 2008 13:32:00 -0000 From: Andrew Cagney User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: Nurdin Premji CC: frysk Subject: Re: How to send signals to test programs? References: <47E9AA37.3080908@redhat.com> In-Reply-To: <47E9AA37.3080908@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2008-q1/txt/msg00185.txt.bz2 Nurdin, For this sort of testing, determinism is the key, so you'll want to have the program directly generate the signal, two ways: -> cause an npe or similar -> execute the kill system-call instruction this can be done in assembler (see frysk-asm.h, and frysk-raise.S for example system calls). Andrew Nurdin Premji wrote: > 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 > #include > #include > #include > > > 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(); > } >