Opened 9 years ago

Closed 8 years ago

#10030 closed enhancement (fixed)

Interrupt testing

Reported by: jdemeyer Owned by: tba
Priority: major Milestone: sage-4.7
Component: c_lib Keywords: interrupt signal doctest
Cc: leif, wjp Merged in: sage-4.7.alpha1
Authors: Jeroen Demeyer Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

This ticket aims to provide a way to test interrupts and the sig_on()/sig_off() mechanism.

This also patches $SAGE_ROOT/local/bin/sage-doctest to check that all doctests have a balanced sig_on()/sig_off() count.

Patch chain: #9678, #10061, #10258, #10030, #10018, #9640

Attachments (3)

10030_scripts_doctest.patch (3.7 KB) - added by jdemeyer 9 years ago.
SCRIPTS patch, patch for sage-doctest
10030_interrupt_test.patch (27.1 KB) - added by jdemeyer 8 years ago.
SAGELIB patch
10030_kill_after_sig_on.patch (3.6 KB) - added by jdemeyer 8 years ago.
Additional SAGELIB patch

Download all attachments as: .zip

Change History (24)

comment:1 Changed 9 years ago by jdemeyer

  • Description modified (diff)

comment:2 Changed 9 years ago by jdemeyer

  • Description modified (diff)

comment:3 Changed 9 years ago by jdemeyer

  • Description modified (diff)

comment:4 Changed 9 years ago by jdemeyer

  • Description modified (diff)
  • Keywords signal added

comment:5 Changed 9 years ago by jdemeyer

  • Description modified (diff)

comment:6 Changed 9 years ago by jdemeyer

  • Description modified (diff)
  • Status changed from new to needs_work

comment:7 Changed 9 years ago by jdemeyer

  • Description modified (diff)

comment:8 Changed 9 years ago by jdemeyer

  • Description modified (diff)

comment:9 Changed 9 years ago by jdemeyer

  • Description modified (diff)

comment:10 Changed 9 years ago by jdemeyer

  • Milestone changed from sage-feature to sage-4.6.2
  • Status changed from needs_work to needs_review

comment:11 Changed 9 years ago by jdemeyer

  • Description modified (diff)

comment:12 Changed 9 years ago by jdemeyer

On OS X, I get doctest "failures"::

**********************************************************************
File "/Users/jdemeyer/sage-4.6.2.alpha0/devel/sage/sage/tests/interrupt.pyx", line 502:
    sage: print '---'; print Popen(['sage', '-c', cmd], stdout=PIPE, stderr=PIPE).communicate()[1]  # long time
Expected:
    ---
    ...
    ------------------------------------------------------------------------
    Unhandled SIGABRT: An abort() occurred in Sage.
    This probably occurred because a *compiled* component of Sage has a bug
    in it and is not properly wrapped with sig_on(), sig_off(). You might
    want to run Sage under gdb with 'sage -gdb' to debug this.
    Sage will now terminate.
    ------------------------------------------------------------------------
    ...
Got:
    ---
    <BLANKLINE>
    ------------------------------------------------------------------------
    Unhandled SIGABRT: An abort() occurred in Sage.
    This probably occurred because a *compiled* component of Sage has a bug
    in it and is not properly wrapped with sig_on(), sig_off(). You might
    want to run Sage under gdb with 'sage -gdb' to debug this.
    Sage will now terminate.
    ------------------------------------------------------------------------
    /Users/jdemeyer/sage-4.6.2.alpha0/local/bin/sage-sage: line 783: 61015 Abort trap              sage-eval "$@"
    <BLANKLINE>
**********************************************************************

It looks to me that the "Got" text matches the "Expected" text, so why is this a failure?

comment:13 Changed 9 years ago by jdemeyer

  • Cc wjp added

comment:14 Changed 9 years ago by vbraun

  • Reviewers set to Volker Braun
  • Status changed from needs_review to needs_work

I think the issue is that "..." expects to match something but does not match the empty line <BLANKLINE>. Note the difference between

  • Linux: will print stack backtrace before "Unhandled SIGABRT", and
  • OSX: does not print stack backtrace.

For example, changing

sage: print '---'; print Popen(['sage', '-c', cmd], stdout=PIPE, stderr=PIPE).communicate()[1]  # long time

to

sage: print '---'; print 'backtrace:'; print Popen(['sage', '-c', cmd], stdout=PIPE, stderr=PIPE).communicate()[1]  # long time

fixes the doctest on OSX, as now at least 'backtrace:' gets matched by the "...".

Changed 9 years ago by jdemeyer

SCRIPTS patch, patch for sage-doctest

comment:15 Changed 9 years ago by jdemeyer

  • Status changed from needs_work to needs_review

Okay, I didn't know that ... needs to match at least one non-blank character (apparently). I fixed it in the most simple way by replacing ---\n... by -...

comment:16 Changed 8 years ago by vbraun

  • Status changed from needs_review to positive_review

Looks good! I tested it on bsd.math and all doctests pass.

Changed 8 years ago by jdemeyer

SAGELIB patch

comment:17 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-4.6.2 to sage-4.7

comment:18 Changed 8 years ago by jdemeyer

  • Status changed from positive_review to needs_work

Changed 8 years ago by jdemeyer

Additional SAGELIB patch

comment:19 Changed 8 years ago by jdemeyer

  • Status changed from needs_work to needs_review

comment:20 Changed 8 years ago by vbraun

  • Status changed from needs_review to positive_review

Looks good.

comment:21 Changed 8 years ago by jdemeyer

  • Merged in set to sage-4.7.alpha1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.