Opened 12 years ago

Last modified 10 years ago

#9224 closed enhancement

Unify sage-test and sage-ptest — at Version 9

Reported by: Mitesh Patel Owned by: Minh Van Nguyen
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: doctest coverage Keywords: testlong maketest parallel race condition unique doctest directories
Cc: Carl Witty, Dan Drake, David Kirkby, John Palmieri, Leif Leonhardy, wjp Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Mitesh Patel)

We currently have separate single and multi-threaded Sage doctest scripts. In particular, sage -t ... invokes SAGE_ROOT/local/bin/sage-test and sage -tp ... invokes sage-ptest. These files share many lines of almost functionally identical identical code. Unifying these scripts should make it easier to maintain and extend the Sage doctest system.

Related: #2379, #7993, #7995, #8641, #9225, #9243, #9316.

Change History (10)

comment:1 Changed 12 years ago by Mitesh Patel

It seems the merger is overdue, although I doubt I can work on it in the immediate future, e.g., before #8641 closes.

What if we start with mapping sage -t ... to sage -tp 1 ...?

comment:2 in reply to:  1 Changed 12 years ago by Dan Drake

Replying to mpatel:

What if we start with mapping sage -t ... to sage -tp 1 ...?

This sounds great to me. It immediately removes the code duplication and is very easy to implement. Perhaps it's worth asking on sage-devel about this, in case anyone knows of a substantive difference between "-t" and "-tp 1", but I think this is a good idea.

comment:3 Changed 12 years ago by Dan Drake

I'm looking at this, and it might be a bit trickier than I thought. Doing "sage -tp 1 ..." tests to see if Sage starts, which we don't want. That's easy to fix, though. What might be harder is that sage-ptest has some awful code in it. The test_file function, according to comments, is supposed to return a 4-tuple, but sometimes it returns a 3-tuple (line 122); there's a bare "except", which is probably not a good idea; the function that processes the tuples just mentioned does this:

  F = result[0]
  ret = result[1]
  finished_time = result[2]
  ol = result[3]

The "result" usually is a 4-tuple: (filename, return_code, time, some_string). But sometimes it returns a 3-tuple: (-5, 0, some_string). So the code above sometimes gets a filename for F, and sometimes gets the integer -5. Then there's this:

  if ol!="" and (not ol.isspace()):
        if (ol[len(ol)-1]=="\n"):
        print ol

Why is that not

  if ol and not ol.isspace():
    print ol.rstrip()

? There is some strange stuff in sage-ptest.

comment:4 Changed 12 years ago by Dan Drake

See #9243 for a related ticket -- it feels weird to be or'ing return codes together when the basic return codes are not powers of 2.

comment:5 Changed 12 years ago by Mitesh Patel

Description: modified (diff)

comment:6 Changed 12 years ago by Mitesh Patel

Description: modified (diff)

I've opened #9225 for possible new [optional] doctesting features. Feel free to make suggestions.

comment:7 Changed 12 years ago by Leif Leonhardy

Cc: Leif Leonhardy added

Changed 12 years ago by Mitesh Patel

Attachment: added

Doctester class pseudo-interface. Not a patch.

comment:8 Changed 12 years ago by Mitesh Patel

I've attached a first take on an interface for a Sage Doctester class. Please see this comment at #9225 for possible uses. I'm not sure whether to put this in the Sage library (under misc/) or in SAGE_LOCAL/bin. But I think we'll need to add sage-doctest to the unification efforts.


comment:9 Changed 12 years ago by Mitesh Patel

Description: modified (diff)

If the interface above (or a variation) is reasonable, we could populate with most of the non-parsing-related, non-redundant parts of sage-doctest and sage-(p)test. To ensure that we test regularly, I suggest we put it in the sage repository, under misc/. Then we'd put just the command-line parsing code in a sage-test in the scripts repository. This script would import sage.misc.doctest and instantiate/call a Doctester object to run the tests.

More keyword arguments for Doctester's constructor: timeout, timeout_long, testdir, and various Valgrind settings.

Note: See TracTickets for help on using tickets.