source: trunk/test/jobs/coredumps/coredump.tcl @ 743

Last change on this file since 743 was 743, checked in by mmc, 14 years ago

Added a test so we can simulate jobs that dump core mid-way through.
Also, a few minor tweaks to bug reporting. Now reports Rappture errors
in category "Rappture" and problem-launching-job errors as "Tools".

File size: 1.1 KB
Line 
1# ----------------------------------------------------------------------
2#  EXAMPLE: Rappture core dumps
3# ======================================================================
4#  AUTHOR:  Michael McLennan, Purdue University
5#  Copyright (c) 2004-2007  Purdue Research Foundation
6#
7#  See the file "license.terms" for information on usage and
8#  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9# ======================================================================
10package require Rappture
11
12# open the XML file containing the run parameters
13set driver [Rappture::library [lindex $argv 0]]
14
15set type [$driver get input.(jobtype).current]
16set sig [$driver get input.(signal).current]
17
18proc killjob {signal} {
19    set jobs [exec ps uxaw | grep -v grep | grep =[pid]]
20    exec kill -s $signal [lindex $jobs 1]
21}
22
23if {$type == "fail"} {
24    after [expr {int(rand()*5000)}] "killjob $sig"
25}
26
27if {[catch {Rappture::exec tclsh genoutput.tcl =[pid]} result]} {
28    puts $result
29    exit 1
30}
31
32$driver put output.log "Job succeeded:\n$result"
33
34Rappture::result $driver
35exit 0
Note: See TracBrowser for help on using the repository browser.