-í
è¶<c       sn  d  Z  d k Z d k Z d k Z d k Z d k Z d k Z d k Z d d „ Z e	 e	 d d d d d d d e	 d „
 Z
 d d d d	 d
 d g Z d d d d d d g Z e	 e e d „ Z e	 d „ Z d „  Z d „  Z d „  Z d d d „ Z d f  d „  ƒ  YZ h  d d <d d <d  d! <d" d# <d$ d% <d& d' <Z d( f  d) „  ƒ  YZ e d* j o e
 ƒ  n d S(+   s$  Regression test.

This will find all modules whose name is "test_*" in the test
directory, and run them.  Various command line options provide
additional facilities.

Command line options:

-v: verbose   -- run tests in verbose mode with output to stdout
-q: quiet     -- don't print anything except if a test fails
-g: generate  -- write the output file for a test instead of comparing it
-x: exclude   -- arguments are tests to *exclude*
-s: single    -- run only a single test (see below)
-r: random    -- randomize test execution order
-l: findleaks -- if GC is available detect tests that leak memory
-u: use       -- specify which special resource intensive tests to run
-h: help      -- print this text and exit

If non-option arguments are present, they are names for tests to run,
unless -x is given, in which case they are names for tests not to run.
If no test names are given, all tests are run.

-v is incompatible with -g and does not compare test output files.

-s means to run only a single test and exit.  This is useful when doing memory
analysis on the Python interpreter (which tend to consume to many resources to
run the full regression test non-stop).  The file /tmp/pynexttest is read to
find the next test to run.  If this file is missing, the first test_*.py file
in testdir or on the command line is used.  (actually tempfile.gettempdir() is
used instead of /tmp).

-u is used to specify which special resource intensive tests to run, such as
those requiring large file support or network connectivity.  The argument is a
comma-separated list of words indicating the resources to test.  Currently
only the following are defined:

    curses -    Tests that use curses and will modify the terminal's
                state and output modes.

    largefile - It is okay to run some test that may create huge files.  These
                tests can take a long time and may consume >2GB of disk space
                temporarily.

    network -   It is okay to run tests that use external network resource,
                e.g. testing SSL support for sockets.
Ns    c    s&   t  GH| o	 | GHn t i |  ƒ d  S(   N(   s   __doc__s   msgs   syss   exits   code(   s   codes   msg(    (    s#   /usr/lib/python2.2/test/regrtest.pys   usage; s     	i    c
 (   s¡  t  i t i ƒ yA t i t i d d d d d d d d d	 d
 d g	 ƒ \ }& } Wn% t i j
 o } t
 d | ƒ n X|	 t j o
 g  }	 n x |& D]˜\ }" } |" d d f j o t
 d ƒ nl|" d d f j o | d 7} nK|" d d f j o d } d } n(|" d d f j o
 d } n|" d d f j o
 d } nî |" d d f j o
 d } nÑ |" d d f j o
 d } n´ |" d d f j o
 d } n— |" d d f j oƒ g  i }# | i d  ƒ D] }' |# |' i ƒ  ƒ qÃ~# }% x9 |% D]1 }$ |$ d! d" d# f j o t
 d d$ | ƒ n qéW|	 i |% ƒ n q— W| o | o t
 d d% ƒ n g  } g  }
 g  } | o8 y d& k! } Wn t" j
 o d' GHd } n Xg  } n | ow d( k$ l% } t& i' i( | ƒ  d) ƒ } y8 t* | d* ƒ } | i, ƒ  i- ƒ  } | g }  | i0 ƒ  Wn t1 j
 o n Xn xL t2 t3 | ƒ ƒ D]8 }  | |  d+ t& i5 d, j o | |  d+  | |  <n q4Wt6 } t8 } | oC x, | D]$ } | | j o | i; | ƒ n qŒW| | d *g  } n |  p | p t< | | | ƒ }  | o |  d  }  n | o t> i? |  ƒ n | t  _ |	 t  _ t i@ iA ƒ  } x|  D]} | o	 | GHn tD | | | | | ƒ } | d j o | i | ƒ n, | d j o |
 i | ƒ n | i | ƒ | oI | iF ƒ  | iG o1 d- Gt3 | iG ƒ Gd. GH| i | iG ƒ | iG 2n n xE t i@ iA ƒ  D]4 } | | j o | iI d/ ƒ o t  iJ | ƒ n qWq=W| iK ƒ  |
 iK ƒ  | iK ƒ  | o | o\ |
 o | o t3 | ƒ d j o d0 Gn tL t3 | ƒ d1 ƒ Gd2 GH| o d3 GHd4 GHn n |
 o& tL t3 |
 ƒ d1 ƒ Gd5 GHtM |
 ƒ n | o | o³ tL t3 | ƒ d1 ƒ Gd6 GHtM | ƒ tN ƒ  } t iP } | iR ƒ  o\ tS | ƒ | iT ƒ  } | o. tL t3 | ƒ d7 ƒ Gd8 G| d9 GHtM | ƒ n d: G| d; GHn d< GHd= G| d; GHn | o´ t< | | | ƒ }! x› t2 t3 |! ƒ ƒ D]z }  |  d |! |  j o_ |  t3 |! ƒ d j o t& iW | ƒ n3 t* | d> ƒ } | iX |! |  d d? ƒ | i0 ƒ  Pn qõWt& iW | ƒ n t iY t3 |
 ƒ d j ƒ d& S(@   sI  Execute a test suite.

    This also parses command-line options and modifies its behavior
    accordingly.

    tests -- a list of strings containing test names (optional)
    testdir -- the directory in which to look for tests (optional)

    Users other than the Python test suite will certainly want to
    specify testdir; if it's omitted, the directory containing the
    Python test suite is searched for.

    If the tests argument is omitted, the tests listed on the
    command-line will be used.  If that's empty, too, then all *.py
    files beginning with test_ will be used.

    The other default arguments (verbose, quiet, generate, exclude, single,
    randomize, findleaks, and use_resources) allow programmers calling main()
    directly to set the values that would normally be set by flags on the
    command line.

    i   s
   hvgqxsrlu:s   helps   verboses   quiets   generates   excludes   singles   randoms	   findleakss   use=i   s   -hs   --helpi    s   -vs	   --verboses   -qs   --quiets   -gs
   --generates   -xs	   --excludes   -ss   --singles   -rs   --randomizes   -ls   --findleakss   -us   --uses   ,s   cursess	   largefiles   networks   Invalid -u/--use option: %ss   -g and -v don't go together!Ns%   No GC available, disabling findleaks.(   s
   gettempdirs
   pynexttests   riýÿÿÿs   pys   Warning: test createds   uncollectable object(s).s   test.s   Alls   tests   OK.s8   CAUTION:  stdout isn't compared in verbose mode:  a tests0   that passes in verbose mode may fail without it.s   failed:s   skipped:s   skips   unexpected ons   :s   Those skips are all expected ons   .s6   Ask someone to teach regrtest.py about which tests ares   expected to get skipped ons   ws   
(Z   s   test_supports   record_original_stdouts   syss   stdouts   getopts   argvs   optss   argss   errors   msgs   usages   use_resourcess   Nones   os   as   verboses   quiets   generates   excludes   singles	   randomizes	   findleakss   appends   _[1]s   splits   xs   lowers   us   rs   extends   goods   bads   skippeds   gcs   ImportErrors   found_garbages   tempfiles
   gettempdirs   oss   paths   joins   filenames   opens   fps   reads   strips   nexts   testss   closes   IOErrors   ranges   lens   is   extseps   STDTESTSs   stdtestss   NOTTESTSs   nottestss   args   removes	   findtestss   testdirs   randoms   shuffles   moduless   keyss   save_moduless   tests   runtests   oks   collects   garbages   modules
   startswiths   unloads   sorts   counts	   printlists   _ExpectedSkipss   es   platforms   plats   isvalids   _Sets   getexpecteds   surprises   alltestss   unlinks   writes   exit((   s   testss   testdirs   verboses   quiets   generates   excludes   singles	   randomizes	   findleakss   use_resourcess   bads   modules   skippeds   gcs   args   filenames   save_moduless   nottestss   stdtestss   nexts   msgs   found_garbages   fps   goods   surprises   argss   plats
   gettempdirs   tests   es   as   oks   is   alltestss   os   _[1]s   rs   us   optss   x(    (    s#   /usr/lib/python2.2/test/regrtest.pys   mainA s    .
 





  
		  

 		 	

 


#
		  
	s   test_grammars   test_opcodess   test_operationss   test_builtins   test_exceptionss
   test_typess   test_supports   test_b1s   test_b2s   test_future1s   test_future2s   test_future3c    s³   |  o t ƒ  }  n t i |  ƒ } g  } xp | D]h } | d  d j o | d t i d j o9 | d  } | | j o
 | | j o | i | ƒ n n q1 W| i ƒ  | | Sd S(   s-   Return a list of all applicable test modules.i   s   test_iýÿÿÿs   pyN(   s   testdirs   findtestdirs   oss   listdirs   namess   testss   names   extseps   modnames   stdtestss   nottestss   appends   sort(   s   testdirs   stdtestss   nottestss   namess   modnames   testss   name(    (    s#   /usr/lib/python2.2/test/regrtest.pys	   findtestss       )

c    sÐ  t  i |  ƒ | o t ƒ  } n t i i | d ƒ } t i i | |  ƒ }	 | o
 t } n t i ƒ  } y| t i }
 zb | o | t _ |  GHn t |  t ƒ  t ƒ  g  ƒ } t | d t ƒ } | t j	 o | ƒ  n Wd |
 t _ XWnÝ t t  i f j
 o* } | o d G|  Gd G| GHn d Sn§t j
 o
 ‚  n’t  i j
 o } d G|  Gd G| GHd Snft i ƒ  d	  \ } } d G|  Gd
 Gt  | ƒ d G| GH| o t! i" d t i ƒ n d SnX| o d Sn | i# ƒ  } | ok | |  d j o, t i i& |	 ƒ o d G|	 Gd GHn d Sn t' |	 d ƒ } | i) | ƒ | i* ƒ  d Sn t i i& |	 ƒ o) t' |	 d ƒ } | i+ ƒ  } | i* ƒ  n |  d } | | j o d Sn d G|  Gd GHt- | | ƒ d Sd S(   sK  Run a single test.
    test -- the name of the test
    generate -- if true, generate output, instead of running the test
    and comparing it to a previously created output file
    verbose -- if true, print more messages
    quiet -- if true, don't print 'skipped' messages (probably redundant)
    testdir -- test directory
    s   outputs	   test_mainNs   tests
   skipped --iÿÿÿÿs	   failed --i    i   s
   crashed --s   :s   filei   s   
s   output files)   is no longer needed; consider removing its   ws   rs   produced unexpected output:(.   s   test_supports   unloads   tests   testdirs   findtestdirs   oss   paths   joins	   outputdirs
   outputfiles   verboses   Nones   cfps   StringIOs   syss   stdouts   save_stdouts
   __import__s   globalss   localss
   the_modules   getattrs   indirect_tests   ImportErrors   TestSkippeds   msgs   quiets   KeyboardInterrupts
   TestFaileds   exc_infos   types   values   strs	   tracebacks	   print_excs   getvalues   outputs   generates   existss   opens   fps   writes   closes   reads   expecteds
   reportdiff(   s   tests   generates   verboses   quiets   testdirs
   the_modules   fps   types   msgs
   outputfiles   save_stdouts   values	   outputdirs   cfps   indirect_tests   outputs   expected(    (    s#   /usr/lib/python2.2/test/regrtest.pys   runtestst      
			 

c    s¾  d  k  } d d GH|  i d ƒ } | i d ƒ } | i d | d | ƒ }
 |
 i ƒ  } d „  } xQ| D]I\ } } } } }	 | d j o n$| d j o: d	 G| | | ƒ Gd
 GHx | | | !D] } d G| Gq» WnÝ | d j o^ d G| | | ƒ Gd Gd G| | |	 ƒ Gd GHx, | i | | | !| | |	 !ƒ D]
 } | Gq*Wnr | d j oL d	 G| | |	 ƒ Gd Gd Gt | ƒ d GHx | | |	 !D] } d G| GqWn d G| | | | |	 f GHqd Wd d GHd  S(   Ns   *iF   i   s   as   bc    s;   |  d 7}  |  | j o d t |  ƒ Sn d |  | f Sd  S(   Ni   s   line s   lines %d-%d(   s   x0s   x1s   str(   s   x0s   x1(    (    s#   /usr/lib/python2.2/test/regrtest.pys   pairqs    
s   equals   deletes   ***s   of expected output missing:s   -s   replaces   *** mismatch betweens   of expecteds
   output ands   of actual output:s   inserts   of actual output doesn't appears   in expected output after lines   :s   +s$   get_opcodes() returned bad tuple?!?!(   s   difflibs   expecteds
   splitliness   as   outputs   bs   SequenceMatchers   sms   get_opcodess   tupless   pairs   ops   a0s   a1s   b0s   b1s   lines   ndiffs   str(   s   expecteds   outputs   as   bs   difflibs   a1s   a0s   tupless   b0s   b1s   sms   pairs   lines   op(    (    s#   /usr/lib/python2.2/test/regrtest.pys
   reportdiffis8    			  +! ( c     sH   t  d j o t i d }  n t }  t i i |  ƒ p t i } | Sd  S(   Ns   __main__i    (
   s   __name__s   syss   argvs   files   __file__s   oss   paths   dirnames   curdirs   testdir(   s   files   testdir(    (    s#   /usr/lib/python2.2/test/regrtest.pys   findtestdir“s
    c    s1   |  d j o d |  | f Sn d |  | f Sd  S(   Ni   s   %d %ss   %d %ss(   s   ns   word(   s   ns   word(    (    s#   /usr/lib/python2.2/test/regrtest.pys   count›s    iF   i   c    s·   d | } xŠ t t |  ƒ D]y } t | ƒ t | ƒ } | d d j o
 d } n d } | d 7} | | j o | GHd | | } n | | | 7} q Wt | ƒ | j o	 | GHn d S(   sÐ   Print the elements of a sequence to stdout.

    Optional arg width (default 70) is the maximum line length.
    Optional arg indent (default 4) is the number of blanks with which to
    begin each line.
    s    iÿÿÿÿs    i   N(
   s   indents   lines   maps   strs   xs   ones   lens   ws   pads   width(   s   xs   widths   indents   ws   lines   pads   one(    (    s#   /usr/lib/python2.2/test/regrtest.pys	   printlist¡s     
 

s   _Setc      s;   t  Z g  d „ Z d „  Z d „  Z d „  Z d d „ Z RS(   Nc    s,   h  } |  _  x | D] } d | | <q Wd  S(   Ni   (   s   datas   selfs   seqs   x(   s   selfs   seqs   xs   data(    (    s#   /usr/lib/python2.2/test/regrtest.pys   __init__ºs     c    s   t  |  i ƒ Sd  S(   N(   s   lens   selfs   data(   s   self(    (    s#   /usr/lib/python2.2/test/regrtest.pys   __len__¿s    c    sS   t  ƒ  } |  i i ƒ  } | _ x) | i D] } | | j o | | =n q) W| Sd S(   s0   Return set of all elements in self not in other.N(   s   _Sets   results   selfs   datas   copys   others   x(   s   selfs   others   results   xs   data(    (    s#   /usr/lib/python2.2/test/regrtest.pys   __sub__Âs     	
 c    s   t  |  i ƒ Sd  S(   N(   s   iters   selfs   data(   s   self(    (    s#   /usr/lib/python2.2/test/regrtest.pys   __iter__Ës    i   c    s,   |  i i ƒ  } | o | i ƒ  n | Sd S(   s   Return _Set elements as a list.N(   s   selfs   datas   keyss   sorteds   sort(   s   selfs   sorteds   data(    (    s#   /usr/lib/python2.2/test/regrtest.pys   tolistÎs
     (   s   __name__s
   __module__s   __init__s   __len__s   __sub__s   __iter__s   tolist(    (    (    s#   /usr/lib/python2.2/test/regrtest.pys   _Set¹s
   				s  
        test_al
        test_cd
        test_cl
        test_commands
        test_crypt
        test_curses
        test_dbm
        test_dl
        test_fcntl
        test_fork1
        test_gdbm
        test_gl
        test_grp
        test_imgfile
        test_largefile
        test_linuxaudiodev
        test_mhlib
        test_nis
        test_openpty
        test_poll
        test_pty
        test_pwd
        test_signal
        test_socket_ssl
        test_socketserver
        test_sunaudiodev
        test_timing
        s   win32sM  
        test_al
        test_cd
        test_cl
        test_curses
        test_dl
        test_gl
        test_imgfile
        test_largefile
        test_nis
        test_ntpath
        test_socket_ssl
        test_socketserver
        test_sunaudiodev
        test_unicode_file
        test_winreg
        test_winsound
        s   linux2s«  
        test_al
        test_bsddb
        test_cd
        test_cl
        test_commands
        test_crypt
        test_curses
        test_dbm
        test_dl
        test_fcntl
        test_fork1
        test_gl
        test_grp
        test_imgfile
        test_largefile
        test_linuxaudiodev
        test_locale
        test_mmap
        test_nis
        test_ntpath
        test_openpty
        test_poll
        test_popen2
        test_pty
        test_pwd
        test_signal
        test_socket_ssl
        test_socketserver
        test_sunaudiodev
        test_sundry
        test_timing
        test_unicode_file
        test_winreg
        test_winsound
        s   macs³  
        test_al
        test_bsddb
        test_cd
        test_cl
        test_dl
        test_gl
        test_imgfile
        test_largefile
        test_linuxaudiodev
        test_minidom
        test_nis
        test_ntpath
        test_openpty
        test_pyexpat
        test_sax
        test_socketserver
        test_sunaudiodev
        test_sundry
        test_unicode_file
        test_winreg
        test_winsound
        s	   unixware5s$  
        test_al
        test_asynchat
        test_bsddb
        test_cd
        test_cl
        test_commands
        test_crypt
        test_dbm
        test_dl
        test_fcntl
        test_fork1
        test_gdbm
        test_gl
        test_grp
        test_imgfile
        test_largefile
        test_linuxaudiodev
        test_locale
        test_mmap
        test_nis
        test_ntpath
        test_openpty
        test_poll
        test_popen2
        test_pty
        test_pwd
        test_socket_ssl
        test_socketserver
        test_strop
        test_sunaudiodev
        test_sundry
        test_thread
        test_threaded_import
        test_threadedtempfile
        test_threading
        test_timing
        test_unicode_file
        test_winreg
        test_winsound
        s   riscoss¡  
        test_al
        test_cd
        test_cl
        test_curses
        test_dl
        test_gdbm
        test_gl
        test_imgfile
        test_largefile
        test_linuxaudiodev
        test_minidom
        test_nis
        test_ntpath
        test_poll
        test_socket_ssl
        test_socketserver
        test_sunaudiodev
        test_unicode_file
        test_winreg
        test_winsound
        s   darwins   _ExpectedSkipsc      s#   t  Z d „  Z d „  Z d „  Z RS(   Nc    sO   d |  _ t i t i ƒ o/ t t i } t | i ƒ  ƒ |  _	 d |  _ n d  S(   Ni    i   (
   s   selfs   valids   _expectationss   has_keys   syss   platforms   ss   _Sets   splits   expected(   s   selfs   s(    (    s#   /usr/lib/python2.2/test/regrtest.pys   __init__ˆs
    	c    s   |  i Sd S(   s@   Return true iff _ExpectedSkips knows about the current platform.N(   s   selfs   valid(   s   self(    (    s#   /usr/lib/python2.2/test/regrtest.pys   isvalids     c    s   |  i Sd S(   sn   Return set of test names we expect to skip on current platform.

        self.isvalid() must be true.
        N(   s   selfs   expected(   s   self(    (    s#   /usr/lib/python2.2/test/regrtest.pys   getexpected“s      (   s   __name__s
   __module__s   __init__s   isvalids   getexpected(    (    (    s#   /usr/lib/python2.2/test/regrtest.pys   _ExpectedSkips‡s   		s   __main__(   s   __doc__s   syss   oss   getopts	   tracebacks   randoms   StringIOs   test_supports   usages   Nones   mains   STDTESTSs   NOTTESTSs	   findtestss   runtests
   reportdiffs   findtestdirs   counts	   printlists   _Sets   _expectationss   _ExpectedSkipss   __name__(   s   test_supports   findtestdirs   _expectationss   randoms   runtests   _Sets   counts   syss   NOTTESTSs   StringIOs   STDTESTSs	   tracebacks	   printlists
   reportdiffs   _ExpectedSkipss	   findtestss   usages   getopts   mains   os(    (    s#   /usr/lib/python2.2/test/regrtest.pys   ?0 s,   							'º		O	*		<²