Ignore:
Timestamp:
May 11, 2007, 1:06:36 PM (17 years ago)
Author:
mmc
Message:

Fixed the automatic bug reporting system to avoid reporting bugs caught
in a workspace, or in a tool with an explicit <reportJobFailures> set
to 0. We use this for tools like Spice3F4, where we expect lots of
pilot error.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/bugreport.tcl

    r727 r728  
    2525    -*-helvetica-bold-r-normal-*-12-* startupFile
    2626
    27 namespace eval Rappture::bugreport { # forward declaration }
     27namespace eval Rappture::bugreport {
     28    # assume that if there's a problem launching a job, we should know it
     29    variable reportJobFailures 1
     30}
    2831
    2932# ----------------------------------------------------------------------
     
    6366    .bugreport.details.info.text configure -state disabled
    6467
    65     if {[info exists env(RAPPTURE_VERSION)]
    66           && $env(RAPPTURE_VERSION) == "current"} {
     68    if {[shouldReport for oops]} {
    6769        pack forget .bugreport.details
    6870        pack forget .bugreport.expl
     
    195197proc Rappture::bugreport::register {stackTrace} {
    196198    global env tcl_platform
    197 
    198     # if this is a test version, do nothing
    199     if {![info exists env(RAPPTURE_VERSION)]
    200           || $env(RAPPTURE_VERSION) != "current"} {
    201         return
    202     }
    203199
    204200    package require http
     
    256252
    257253# ----------------------------------------------------------------------
     254# USAGE: shouldReport jobfailures <boolean>
     255# USAGE: shouldReport for ?oops|jobs?
     256#
     257# Used internally to determine whether or not this system should
     258# automatically report errors back to the hosting hub.  Returns 1
     259# if the tool should, and 0 otherwise.  The decision is made based
     260# on whether this is a current tool in production, whether it is
     261# being tested in a workspace, and whether the tool commonly generates
     262# problems (by pilot error in its input deck).
     263# ----------------------------------------------------------------------
     264proc Rappture::bugreport::shouldReport {option value} {
     265    global env
     266
     267    switch -- $option {
     268        jobfailures {
     269            variable reportJobFailures
     270            if {![string is boolean $value]} {
     271                error "bad value \"$value\": should be boolean"
     272            }
     273            set reportJobFailures $value
     274        }
     275        for {
     276            # is this a tool in production?
     277            if {![info exists env(RAPPTURE_VERSION)]
     278                  || $env(RAPPTURE_VERSION) != "current"} {
     279                return 0
     280            }
     281
     282            # is it being run within a workspace?
     283            set appname [Rappture::Tool::resources -appname]
     284            if {[string match {[Ww]orkspace*} $appname]} {
     285                return 0
     286            }
     287
     288            # if this is a problem launching a job and the tool
     289            # expects this, then don't bother with automatic reports.
     290            variable reportJobFailures
     291            if {"jobs" == $value && !$reportJobFailures} {
     292                return 0
     293            }
     294
     295            # this is a real problem -- report it!
     296            return 1
     297        }
     298        default {
     299            error "bad option \"$option\": should be jobfailures or for"
     300        }
     301    }
     302}
     303
     304# ----------------------------------------------------------------------
    258305# Build the bug reporting dialog
    259306# ----------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.