mò
­fIc           @   sQ   d  k  l Z l Z l Z d k Z d k Z d k Z e i Z d „  Z e ƒ  d S(   (   s   verifys   vereqs   TESTFNNc       	   C   sO  t  i i t ƒ o t  i t ƒ n t t d ƒ } z…| i d t ƒ | i d ƒ | i d t d ƒ | i	 ƒ  t
 i
 | i ƒ  d t ƒ }
 | i ƒ  t |
 ƒ GHd G|
 i d ƒ t t ƒ Gd GHt |
 i d ƒ t ƒ d Gt |
 ƒ t t ƒ Gd GHt t |
 ƒ d t ƒ d	 Gt |
 d
 ƒ GHt |
 d
 d ƒ d Gt |
 d
 d !ƒ GHt |
 d
 d !d ƒ d GHd |
 d
 <d |
 t d t d d +d	 Gt |
 d
 ƒ GHt |
 d
 d ƒ d Gt |
 d
 d !ƒ GHt |
 d
 d !d ƒ d Gt |
 t d t d !ƒ GHt |
 t d t d !d ƒ |
 i	 ƒ  t i d |
 ƒ } | d( j o	 d GHnU | i d
 ƒ \ } }  |  | } d G| t t ƒ G| GHt | t ƒ t |  t d ƒ |
 i d
 d
 ƒ d GHt |
 i ƒ  d
 ƒ |
 i d d ƒ d GHt |
 i ƒ  d ƒ |
 i d
 d ƒ d GHt |
 i ƒ  t |
 ƒ ƒ d GHy |
 i d ƒ Wn t j
 o n Xt d
 d ƒ d  GHy |
 i d d ƒ Wn t j
 o n Xt d
 d ƒ d GHy |
 i t |
 ƒ d d ƒ Wn t j
 o n Xt d
 d ƒ d! GHy |
 i  d" ƒ Wn t! j
 o n· Xt t |
 ƒ d" j d# t |
 ƒ f ƒ y |
 i d$ d
 ƒ Wn t j
 o n Xt d
 d% ƒ t t ƒ } | i d
 d ƒ t | i ƒ  d" j d& ƒ | i ƒ  t |
 i" ƒ  d" j d' ƒ |
 i ƒ  Wd( y | i ƒ  Wn t# j
 o n Xy t  i t ƒ Wn t# j
 o n XXzKd) }	 d* G|	 Gd+ GHt t d, ƒ i d- |	 ƒ d. GHt t d/ ƒ } t
 i
 | i ƒ  |	 d0 t
 i% ƒ}
 t |
 d- |	 j d1 ƒ d2 GHy d3 |	 |
 (Wn t& j
 o n Xt d
 d4 ƒ d5 GHy d3 |
 d
 <Wn t& j
 o n Xt d
 d4 ƒ d6 GHy! |
 i d
 d
 ƒ |
 i d7 ƒ Wn t& j
 o n Xt d
 d4 ƒ d8 GHy! |
 i d
 d
 ƒ |
 i' d9 ƒ Wn t& j
 o n Xt d
 d4 ƒ d: GHy |
 i  d |	 ƒ Wn% t! j
 o n! t& j
 o n Xt d
 d; ƒ ~
 ~ t t t d/ ƒ i( ƒ  d- |	 j d< ƒ d= GHd( k) } t t d> ƒ } y  t
 i
 | i ƒ  |	 d ƒ }
 Wn7 t j
 o+ | i* i+ d? ƒ o t d
 d@ ƒ q£n0 X| i* i+ d? ƒ p t d
 dA ƒ n |
 i ƒ  | i ƒ  | i* i+ d? ƒ o* t t d> ƒ } | i, |	 ƒ | i ƒ  n dB GHt t d> ƒ } t
 i
 | i ƒ  |	 d0 t
 i- ƒ}
 dC GHdD |	 |
 (t |
 dD |	 j dE ƒ |
 i	 ƒ  |
 i ƒ  | i ƒ  t t d/ ƒ } | i( ƒ  } | i ƒ  t | dD |	 j dF ƒ dG GHt t d> ƒ } t
 i
 | i ƒ  |	 d0 t
 i/ ƒ}
 dH GHd9 |	 |
 (t |
 d9 |	 j dI ƒ |
 i	 ƒ  t t t d/ ƒ i( ƒ  dD |	 j dJ ƒ y dK GH|
 i  d |	 ƒ Wn t& j
 o n Xt d
 dL ƒ ~
 ~ y6 dM GHt t d> ƒ } t
 i
 | i ƒ  |	 d0 dN ƒ}
 Wn t j
 o n Xt d
 dO ƒ t  i0 dP j ow t t d> ƒ } y7 t
 i
 | i ƒ  |	 dQ t
 i1 dR t
 i2 d0 t
 i- ƒ}
 Wn t j
 o n Xt d
 dS ƒ | i ƒ  n Wd( y t  i t ƒ Wn t# j
 o n XXdT GHy t
 i
 d dU ƒ Wn t
 i3 j
 o n Xt d
 dV ƒ t t d ƒ } zØ dW } t | ƒ } | i | ƒ | i	 ƒ  t
 i
 | i ƒ  | ƒ }
 | i ƒ  x| t6 | d ƒ D]j } xa t6 | | d ƒ D]L } | | | !} t |
 i | ƒ | i | ƒ ƒ t |
 i | dX ƒ d ƒ qDWq*W|
 i ƒ  Wd( t  i t ƒ Xt t d ƒ } zr | i d dY d- ƒ | i ƒ  t t ƒ } t
 i
 | i ƒ  d dY d0 t
 i% ƒ} | i ƒ  | i ƒ  | i ƒ  Wd( t  i t ƒ XdZ GHd( S([   s,   Test mmap module on Unix systems and Windowss   w+t    t   fooi   i   s     Position of foo:t   pagess     Length of file:s     Contents of byte 0:i    s     Contents of first 3 bytes:t      s   
  Modifying file's content...t   3t   bart   3  s     Contents of second page:i   i   t    foobar s	   [A-Za-z]+s$     ERROR: regex match on mmap failed!s4     Regex match on mmap (page start, length of match):i   s     Seek to zeroth bytei*   s     Seek to 42nd bytes     Seek to last bytes%     Try to seek to negative position...iÿÿÿÿs(   expected a ValueError but did not get its#     Try to seek beyond end of mmap...s     Attempting resize()i   s   len(m) is %d, but expecting 512i  s   Could seek beyond the new sizes   Underlying file not truncateds   New size not reflected in fileNi
   s
     Creatings   byte test data file.t   wbt   as&     Opening mmap with access=ACCESS_READt   rbt   accesss#   Readonly memory map data incorrect.s6     Ensuring that readonly mmap can't be slice assigned.t   bs$   Able to write to readonly memory maps5     Ensuring that readonly mmap can't be item assigned.s2     Ensuring that readonly mmap can't be write() to.t   abcs7     Ensuring that readonly mmap can't be write_byte() to.t   ds/     Ensuring that readonly mmap can't be resized.s"   Able to resize readonly memory maps*   Readonly memory map data file was modifieds      Opening mmap with size too bigs   r+bt   wins0   Opening mmap with size+1 should work on Windows.s1   Opening mmap with size+1 should raise ValueError.s'     Opening mmap with access=ACCESS_WRITEs%     Modifying write-through memory map.t   cs5   Write-through memory map memory not updated properly.s8   Write-through memory map data file not updated properly.s&     Opening mmap with access=ACCESS_COPYs%     Modifying copy-on-write memory map.s4   Copy-on-write memory map data not written correctly.s4   Copy-on-write test data file should not be modified.s0     Ensuring copy-on-write maps cannot be resized.s2   Copy-on-write mmap resize did not raise exception.s5     Ensuring invalid access parameter raises exception.i   s1   Invalid access code should have raised exception.t   posixt   flagst   prots0   Incompatible parameters should raise ValueError.s&     Try opening a bad file descriptor...i   s(   expected a mmap.error but did not get itt   aabaac deef  aa t   xi   s    Test passed(:   t   ost   patht   existst   TESTFNt   unlinkt   opent   ft   writet   PAGESIZEt   flusht   mmapt   filenot   mt   closet   typet   findt   floatt   vereqt   lent   reprt   ret   searcht   matcht   Nonet   spant   startt   endt   lengtht   seekt   tellt
   ValueErrort   verifyt   resizet   SystemErrort   sizet   OSErrort   mapsizet   ACCESS_READt	   TypeErrort
   write_bytet   readt   syst   platformt
   startswitht   truncatet   ACCESS_WRITEt   stufft   ACCESS_COPYt   namet   MAP_PRIVATEt	   PROT_READt   errort   datat   nt   ranget   finisht   slicet   mf(   R0   R/   RO   R,   RM   R?   RN   RJ   R   R:   R"   RK   R1   RD   (    (    t+   /mit/python/lib/python2.4/test/test_mmap.pyt	   test_both   sæ    

 

	

 !	 

!



!
" 

  " 
%

 (	   t   test.test_supportR5   R'   R   R    R   R*   R   RQ   (   R'   R   R5   R*   RQ   R    R   R   (    (    RP   t   ?   s   			ÿ G