#9739: Handle duplicate file basenames when testing multiple files in parallel
-------------------------------+--------------------------------------------
   Reporter:  mpatel           |       Owner:  mvngu          
       Type:  defect           |      Status:  needs_work     
   Priority:  blocker          |   Milestone:  sage-4.6.2     
  Component:  doctest          |    Keywords:  doctest scripts
     Author:  Mitesh Patel     |    Upstream:  N/A            
   Reviewer:  Robert Bradshaw  |      Merged:                 
Work_issues:                   |  
-------------------------------+--------------------------------------------

Comment(by leif):

 While we are at it, I have some more comments on `sage-ptest` I'll also
 post here with an inline patch:

 {{{
 #!diff
 diff --git a/sage-ptest b/sage-ptest
 --- a/sage-ptest
 +++ b/sage-ptest
 @@ -81,12 +81,18 @@
      Returns true if the file should not be tested
      """
      if not os.path.exists(F):
 +        # XXX IMHO this should never happen; in case it does, it's
 certainly
 +        #     an error to be reported (either filesystem, or bad name
 specified
 +        #     on the command line). -leif
          return True
      G = abspath(F)
      i = G.rfind(os.path.sep)
 +    # XXX The following should IMHO be performed in populatefilelist():
 +    #     (Currently, populatefilelist() only looks for "__nodoctest__".)
      if os.path.exists(os.path.join(G[:i], 'nodoctest.py')):
          printmutex.acquire()
          print "%s (skipping) -- nodoctest.py file in directory"%abs(F)
 +        sys.stdout.flush()
          printmutex.release()
          return True
      filenm = os.path.split(F)[1]
 @@ -95,6 +101,7 @@
          return True
      if G.find(os.path.join('doc', 'output')) != -1:
          return True
 +    # XXX The following is (also/already) handled in populatefilelist():
      if not (os.path.splitext(F)[1] in ['.py', '.pyx', '.tex', '.pxi',
 '.sage', '.rst']):
          return True
      return False
 @@ -115,6 +122,7 @@
      for i in range(0,numiteration):
          os.chdir(os.path.dirname(F))
          command = os.path.join(SAGE_ROOT, 'local', 'bin', 'sage-%s' %
 cmd)
 +        # FIXME: Why call bash here? (Also, we use 'shell=True' below
 anyway.)
          s = 'bash -c "%s %s > %s" ' % (command, filestr, outfile.name)
          try:
              t = time.time()
 @@ -161,10 +169,12 @@
          print sage_test_cmd(F[len(CUR)+1:])
      else:
          print abs(F)
 +    sys.stdout.flush()
      if ol!="" and (not ol.isspace()):
          if (ol[len(ol)-1]=="\n"):
              ol=ol[0:len(ol)-1]
          print ol
 +        sys.stdout.flush()
      time_dict[abs_sage_path(F)] = finished_time
      if XML_RESULTS:
          t = finished_time
 @@ -192,6 +202,7 @@
          """.strip() % locals())
          f.close()
      print "\t [%.1f s]"%(finished_time)
 +    sys.stdout.flush()

  def infiles_cmp(a,b):
      """
 @@ -231,7 +242,14 @@
                  base, ext = os.path.splitext(F)
                  if not (ext in ['.sage', '.py', '.pyx', '.tex', '.pxi',
 '.rst']):
                      continue
 -                elif '__nodoctest__' in files:
 +                elif '__nodoctest__' in files: # XXX Shouldn't this be
 'lfiles'?
 +                    # Also, this test should IMHO be in the outer loop (1
 level).
 +                    # Furthermore, the current practice is to put
 "nodoctest.py"
 +                    # files in the directories that should be skipped,
 not
 +                    # "__nodoctest__". (I haven't found a single instance
 of the
 +                    # latter in Sage 4.6.1.alpha3.)
 +                    # "nodoctest.py" is handled in skip() (!), to also be
 fixed.
 +                    # -leif
                      continue
                  appendstr = os.path.join(root,F)
                  if skip(appendstr):
 @@ -252,6 +270,9 @@
      argv = [X for X in argv if X[0] != '-']

      try:
 +        # FIXME: Nice, but <NUMTHREADS> should immediately follow '-tp'
 etc.,
 +        #        i.e., be the next argument. We might have file or
 directory
 +        #        names that properly convert to an int...
          numthreads = int(argv[1])
          infiles = argv[2:]
      except ValueError: # can't convert first arg to an integer: arg was
 probably omitted
 }}}
 (This is against Sage 4.6.1.alpha3.)

 The comments all refer to inconsistencies; the only actual change is
 flushing the output since it currently comes in bursts, which is IMHO odd
 for watching it. I don't think this measurably slows down doctesting...

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9739#comment:32>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to