ó
‹wÛjc           @   s?  d  Z  d d l m Z e j d ƒ Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 Z
 d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z e j j e j ƒ  e j d ƒ Z e j d d e ƒ d e j f d	 „  ƒ  YZ d
 e j f d „  ƒ  YZ d „  Z e d k r;e ƒ  n  d S(   s   Test posix functionsiÿÿÿÿ(   t   test_supportt   posixNs   -dummy-symlinkt   ignores   .* potential security risk .*t   PosixTesterc           B   s  e  Z d  „  Z d „  Z d „  Z e j e e d ƒ d ƒ d „  ƒ Z	 e j e e d ƒ d ƒ d „  ƒ Z
 e j e e d	 ƒ d
 ƒ d „  ƒ Z e j e e d	 ƒ d
 ƒ d „  ƒ Z e j e e d ƒ d ƒ d „  ƒ Z e j e e d ƒ d ƒ d „  ƒ Z e j e e d ƒ d ƒ d „  ƒ Z e j e e d ƒ d ƒ d „  ƒ Z e j e e d ƒ d ƒ d „  ƒ Z e j e e d ƒ d ƒ d „  ƒ Z e j e e d ƒ d ƒ d „  ƒ Z e j e e d  ƒ d! ƒ d" „  ƒ Z e j e e d# ƒ d$ ƒ d% „  ƒ Z d& „  Z e j e e d' ƒ d( ƒ d) „  ƒ Z e j e e d' ƒ d( ƒ d* „  ƒ Z e j e e d' ƒ oke j j d+ ƒ d( ƒ d, „  ƒ Z e j e e d- ƒ d. ƒ d/ „  ƒ Z e j e e d0 ƒ d1 ƒ d2 „  ƒ Z e j e e d3 ƒ d4 ƒ d5 „  ƒ Z e j e e d6 ƒ d7 ƒ d8 „  ƒ Z  e j e e d6 ƒ d7 ƒ e j e e d9 ƒ d: ƒ d; „  ƒ ƒ Z! d< „  Z" e j e e d= ƒ d> ƒ d? „  ƒ Z# e j e e d@ ƒ dA ƒ dB „  ƒ Z$ e j e e dC ƒ dD ƒ dE „  ƒ Z% e j e e dF ƒ dG ƒ dH „  ƒ Z& e j e e dI ƒ dJ ƒ dK „  ƒ Z' e j e e dL ƒ dM ƒ dN „  ƒ Z( e j e e dO ƒ dP ƒ dQ „  ƒ Z) e j e e dR ƒ dS ƒ dT „  ƒ Z* e j e e dU ƒ dV ƒ dW „  ƒ Z+ e j e e dX ƒ dY ƒ dZ „  ƒ Z, e j e e d[ ƒ d\ ƒ d] „  ƒ Z- e j e e d^ ƒ d_ ƒ d` „  ƒ Z. da „  Z/ e j e e db ƒ dc ƒ dd „  ƒ Z0 e j e e de ƒ df ƒ dg „  ƒ Z1 e j e e de ƒ df ƒ dh „  ƒ Z2 e j e e3 di ƒ dj ƒ dk „  ƒ Z4 e j e e dl ƒ dm ƒ dn „  ƒ Z5 e j e e3 do ƒ dp ƒ dq „  ƒ Z6 e7 j8 dr „  ƒ Z9 ds „  Z: RS(t   c         C   s/   t  t j d ƒ } | j ƒ  t j g |  _ d  S(   Ns   w+(   t   openR    t   TESTFNt   closet   teardown_files(   t   selft   fp(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   setUp   s    
c         C   s%   x |  j  D] } t j | ƒ q
 Wd  S(   N(   R   t   ost   unlink(   R   t   teardown_file(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   tearDown#   s    c         C   s©   d d d d d d d d d	 d
 d d d d d g } t  j ƒ  �d t  j d d t ƒ xI | D]A } t t | d  ƒ } | d  k	 rZ | ƒ  |  j t | d ƒ qZ qZ WWd  QXd  S(   Nt   ctermidt   getcwdt   getcwdut   unamet   timest
   getloadavgt   tmpnamt   getegidt   geteuidt   getgidt	   getgroupst   getpidt   getpgrpt   getppidt   getuidR   t    i   (	   t   warningst   catch_warningst   filterwarningst   DeprecationWarningt   getattrR   t   Nonet   assertRaisest	   TypeError(   R   t   NO_ARG_FUNCTIONSt   namet
   posix_func(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   testNoArgFunctions'   s    	t	   getresuids   test needs posix.getresuid()c         C   sG   t  j ƒ  } |  j t | ƒ d ƒ x | D] } |  j | d ƒ q) Wd  S(   Ni   i    (   R   R+   t   assertEqualt   lent   assertGreaterEqual(   R   t   user_idst   val(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_getresuid8   s    t	   getresgids   test needs posix.getresgid()c         C   sG   t  j ƒ  } |  j t | ƒ d ƒ x | D] } |  j | d ƒ q) Wd  S(   Ni   i    (   R   R2   R,   R-   R.   (   R   t	   group_idsR0   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_getresgid@   s    t	   setresuids   test needs posix.setresuid()c         C   sB   t  j ƒ  } |  j t  j | Œ  ƒ |  j t  j d d d ƒ ƒ d  S(   Niÿÿÿÿ(   R   R+   t   assertIsNoneR5   (   R   t   current_user_ids(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_setresuidH   s    c         C   sL   t  j ƒ  } d | k rH | d d d d f } |  j t t  j | Œ n  d  S(   Ni    i   iÿÿÿÿ(   R   R+   R%   t   OSErrorR5   (   R   R7   t   new_user_ids(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_setresuid_exceptionP   s    t	   setresgids   test needs posix.setresgid()c         C   sB   t  j ƒ  } |  j t  j | Œ  ƒ |  j t  j d d d ƒ ƒ d  S(   Niÿÿÿÿ(   R   R2   R6   R<   (   R   t   current_group_ids(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_setresgidY   s    c         C   sL   t  j ƒ  } d | k rH | d d d d f } |  j t t  j | Œ n  d  S(   Ni    i   iÿÿÿÿ(   R   R2   R%   R9   R<   (   R   R=   t   new_group_ids(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_setresgid_exceptiona   s    t
   initgroupss   test needs os.initgroups()c         C   s  |  j  t t j ƒ |  j  t t j d  ƒ |  j  t t j d d ƒ |  j  t t j d d t ƒ  ƒ t j ƒ  d k ry t j	 t j ƒ  ƒ j
 } Wn  t k
 r± t j d ƒ ‚ n Xy t j | d ƒ Wn) t k
 rñ } |  j | j t j ƒ qX|  j d ƒ n  d  S(   Ni   t   fooi    s   need a pwd entryi   s+   Expected OSError to be raised by initgroups(   R%   R&   R   RA   R$   t   objectR   R   t   pwdt   getpwuidt   pw_namet   KeyErrort   unittestt   SkipTestR9   R,   t   errnot   EPERMt   fail(   R   R(   t   e(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_initgroupsj   s    t   statvfss   test needs posix.statvfs()c         C   s   |  j  t j t j ƒ ƒ d  S(   N(   t
   assertTrueR   RO   R   t   curdir(   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_statvfsƒ   s    t   fstatvfss   test needs posix.fstatvfs()c         C   sA   t  t j ƒ } z  |  j t j | j ƒ  ƒ ƒ Wd  | j ƒ  Xd  S(   N(   R   R    R   RP   R   RS   t   filenoR   (   R   R	   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_fstatvfsˆ   s     t	   ftruncates   test needs posix.ftruncate()c         C   sU   t  t j d ƒ } z1 | j d ƒ | j ƒ  t j | j ƒ  d ƒ Wd  | j ƒ  Xd  S(   Ns   w+t   testi    (	   R   R    R   t   writet   flushR   RV   RT   R   (   R   R	   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_ftruncate‘   s    
t   dups   test needs posix.dup()c         C   sW   t  t j ƒ } z6 t j | j ƒ  ƒ } |  j | t ƒ t j	 | ƒ Wd  | j	 ƒ  Xd  S(   N(
   R   R    R   R   R[   RT   t   assertIsInstancet   intR   R   (   R   R	   t   fd(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_dup�   s    t   confstrs   test needs posix.confstr()c         C   s?   |  j  t t j d ƒ |  j t t j d ƒ ƒ d k t ƒ d  S(   Nt
   CS_garbaget   CS_PATHi    (   R%   t
   ValueErrorR   R`   R,   R-   t   True(   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_confstr¨   s    t   dup2s   test needs posix.dup2()c         C   sZ   t  t j ƒ } t  t j ƒ } z  t j | j ƒ  | j ƒ  ƒ Wd  | j ƒ  | j ƒ  Xd  S(   N(   R   R    R   R   Rf   RT   R   (   R   t   fp1t   fp2(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt	   test_dup2®   s     
c         G   s8   t  j t j t  j ƒ } t j | | Œ } | j ƒ  d  S(   N(   R   R   R    R   t   O_RDONLYR   t   fdopenR   (   R   t   argsR^   Rh   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   fdopen_helper¹   s    Rk   s   test needs posix.fdopen()c         C   s+   |  j  ƒ  |  j  d ƒ |  j  d d ƒ d  S(   Nt   rid   (   Rm   (   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_fdopen¾   s    
c         C   sª   y, t  j d t  j ƒ } |  j t  j | ƒ Wn6 t k
 rd } |  j | j t j ƒ |  j	 d ƒ n X|  j
 t ƒ � } t  j | d ƒ Wd  QX|  j | j j t j ƒ d  S(   Nt   .s   system cannot open directoriesRn   (   R   R   Rj   t
   addCleanupR   R9   R,   RJ   t   EACCESt   skipTestR%   t   IOErrorRk   t	   exceptiont   EISDIR(   R   R^   RM   t   cm(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_fdopen_directoryÅ   s    t   sunosc         C   sB   t  j t j t  j ƒ } |  j t t j | d ƒ t  j	 | ƒ d  S(   Nt   w(
   R   R   R    R   Rj   R%   R9   R   Rk   R   (   R   R^   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt#   test_fdopen_keeps_fd_open_on_errorsÒ   s    t   O_EXLOCKs   test needs posix.O_EXLOCKc         C   sÖ   t  j t j t  j t  j Bt  j Bƒ } |  j t t  j t j t  j t  j Bt  j	 Bƒ t  j
 | ƒ t t d ƒ rÒ t  j t j t  j t  j Bt  j Bƒ } |  j t t  j t j t  j t  j Bt  j	 Bƒ t  j
 | ƒ n  d  S(   Nt   O_SHLOCK(   R   R   R    R   t   O_WRONLYR|   t   O_CREATR%   R9   t
   O_NONBLOCKR   t   hasattrR   R}   (   R   R^   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_osexlockÚ   s    R}   s   test needs posix.O_SHLOCKc         C   sÜ   t  j t j t  j t  j Bt  j Bƒ } t  j t j t  j t  j Bt  j Bƒ } t  j | ƒ t  j | ƒ t t	 d ƒ rØ t  j t j t  j t  j Bt  j Bƒ } |  j
 t t  j t j t  j t  j Bt  j Bƒ t  j | ƒ n  d  S(   NR|   (   R   R   R    R   R~   R}   R   R   R�   R   R%   R9   Rj   R|   R€   (   R   t   fd1t   fd2R^   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_osshlockê   s    t   fstats   test needs posix.fstat()c         C   sA   t  t j ƒ } z  |  j t j | j ƒ  ƒ ƒ Wd  | j ƒ  Xd  S(   N(   R   R    R   RP   R   R†   RT   R   (   R   R	   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt
   test_fstatû   s     t   stats   test needs posix.stat()c         C   s   |  j  t j t j ƒ ƒ d  S(   N(   RP   R   Rˆ   R    R   (   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt	   test_stat  s    t   makedevs   test needs posix.makedev()c         C   sÂ  t  j t j ƒ } | j } |  j | t t f ƒ |  j | d ƒ t  j	 | ƒ } |  j | t t f ƒ |  j | d ƒ |  j
 t  j	 t | ƒ ƒ | ƒ |  j
 t  j	 t | ƒ ƒ | ƒ |  j t t  j	 t | ƒ ƒ |  j t t  j	 ƒ |  j t t f t  j	 d ƒ t  j | ƒ } |  j | t t f ƒ |  j | d ƒ |  j
 t  j t | ƒ ƒ | ƒ |  j
 t  j t | ƒ ƒ | ƒ |  j t t  j t | ƒ ƒ |  j t t  j ƒ |  j t t f t  j d ƒ t j j d ƒ rë| d k rë|  j d ƒ n  |  j
 t  j | | ƒ | ƒ |  j
 t  j t | ƒ t | ƒ ƒ | ƒ |  j
 t  j t | ƒ t | ƒ ƒ | ƒ |  j t t  j t | ƒ | ƒ |  j t t  j | t | ƒ ƒ |  j t t  j | ƒ |  j t t  j ƒ d  S(   Ni    iÿÿÿÿt   freebsdI       sE   bpo-31044: on FreeBSD CURRENT, minor() truncates 64-bit dev to 32-bit(   R   Rˆ   R    R   t   st_devR\   R]   t   longR.   t   majorR,   R%   R&   t   floatRc   t   OverflowErrort   minort   syst   platformt
   startswithRs   RŠ   (   R   t   stt   devRŽ   R‘   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_makedev	  s:    	((c   	         s  ‡  ‡ ‡ f d †  } t  j ƒ  } t  j ƒ  } | ˆ  | | ƒ | | | ƒ | ˆ  d | ƒ | | | ƒ | ˆ  | d ƒ | | | ƒ | d k rð d
 } | ˆ  | | ƒ | | | ƒ | ˆ  d d ƒ | | | ƒ | ˆ  | | ƒ | | | ƒ n« t j ƒ  d k rt j d ƒ ‚ n‡ ˆ j t | ˆ  d d ƒ | | | ƒ ˆ j t | ˆ  d d ƒ | | | ƒ d t  j	 ƒ  k r›ˆ j t | ˆ  d d ƒ | | | ƒ n  xl t
 t f D]^ } ˆ j t | ˆ  | | ƒ | ƒ | | | ƒ ˆ j t | ˆ  | | | ƒ ƒ | | | ƒ q¨Wd	 S(   s/   Common code for chown, fchown and lchown tests.c            sE   ˆ d  k	 rA ˆ ˆ  ƒ } ˆ j | j |  ƒ ˆ j | j | ƒ n  d  S(   N(   R$   R,   t   st_uidt   st_gid(   t   uidt   gidRˆ   (   t   first_paramR   t	   stat_func(    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt
   check_stat1  s    iÿÿÿÿi    i   i   s   HP-UXt   SunOSs1   Skipping because of non-standard chown() behaviorNI   €    (   s   HP-UXRŸ   (   R   R   R   R“   t   systemRH   RI   R%   R9   R   t   strR�   R&   (	   R   t
   chown_funcRœ   R�   Rž   Rš   R›   t	   big_valuet   t(    (   Rœ   R   R�   s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   _test_all_chown_common/  s>    t   chowns   test needs os.chown()c         C   sn   t  j t j ƒ |  j t t j t j d d ƒ t t j d ƒ j	 ƒ  |  j
 t j t j t t d d  ƒ ƒ d  S(   NiÿÿÿÿRz   Rˆ   (   R   R   R    R   R%   R9   R   R¦   R   R   R¥   R#   R$   (   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt
   test_chownj  s
    t   fchowns   test needs os.fchown()c         C   sf   t  j t j ƒ t t j d ƒ } z2 | j ƒ  } |  j t j | t	 t d d  ƒ ƒ Wd  | j ƒ  Xd  S(   NRz   R†   (   R   R   R    R   R   RT   R¥   R   R¨   R#   R$   R   (   R   t	   test_fileR^   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_fchownu  s    t   lchowns   test needs os.lchown()c         C   sL   t  j t j ƒ t  j t t j ƒ |  j t j t j t	 t d d  ƒ ƒ d  S(   Nt   lstat(   R   R   R    R   t   symlinkt   _DUMMY_SYMLINKR¥   R   R«   R#   R$   (   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_lchown‚  s    t   chdirs   test needs posix.chdir()c         C   s-   t  j t j ƒ |  j t t  j t j ƒ d  S(   N(   R   R°   R   RQ   R%   R9   R    R   (   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt
   test_chdirŠ  s    t   lsdirs   test needs posix.lsdir()c         C   s#   |  j  t j t j t j ƒ ƒ d  S(   N(   t   assertInR    R   R   R²   R   RQ   (   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt
   test_lsdir�  s    t   accesss   test needs posix.access()c         C   s#   |  j  t j t j t j ƒ ƒ d  S(   N(   RP   R   Rµ   R    R   R   t   R_OK(   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_access“  s    t   umasks   test needs posix.umask()c         C   s0   t  j d ƒ } |  j | t ƒ t  j | ƒ d  S(   Ni    (   R   R¸   R\   R]   (   R   t   old_mask(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt
   test_umask—  s    t   strerrors   test needs posix.strerror()c         C   s   |  j  t j d ƒ ƒ d  S(   Ni    (   RP   R   R»   (   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_strerror�  s    t   pipes   test needs posix.pipe()c         C   s0   t  j ƒ  \ } } t j | ƒ t j | ƒ d  S(   N(   R   R½   R   R   (   R   t   readert   writer(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt	   test_pipe¢  s    t   tempnams   test needs posix.tempnam()c         C   sr   t  j ƒ  �` t  j d d t ƒ |  j t j ƒ  ƒ |  j t j t j ƒ ƒ |  j t j t j d ƒ ƒ Wd  QXd  S(   NR   RÁ   t   blah(	   R   R    R!   R"   RP   R   RÁ   R   RQ   (   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_tempnam¨  s
    t   tmpfiles   test needs posix.tmpfile()c         C   s@   t  j ƒ  �. t  j d d t ƒ t j ƒ  } | j ƒ  Wd  QXd  S(   NR   RÄ   (   R   R    R!   R"   R   RÄ   R   (   R   R	   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_tmpfile±  s    t   utimes   test needs posix.utime()c         C   sÁ   t  j  ƒ  } t j t j d  ƒ |  j t t j t j d ƒ |  j t t j t j | d  f ƒ |  j t t j t j d  | f ƒ t j t j t | ƒ t | ƒ f ƒ t j t j | | f ƒ d  S(   N(   NN(	   t   timeR   RÆ   R    R   R$   R%   R&   R]   (   R   t   now(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt
   test_utime¹  s    ""%c   	      C   s  t  j | ƒ } |  j t | d ƒ ƒ y | | | j t j Bƒ Wn> t k
 r€ } | j t j k rj ‚  n  d } |  j	 | ƒ n Xzo t  j | ƒ } |  j
 | j t j B| j ƒ y t | d ƒ } Wn) t k
 rî } |  j
 | j t j ƒ n XWd  t j | | j ƒ Xd  S(   Nt   st_flagss2   chflag UF_IMMUTABLE not supported by underlying fss   w+(   R   Rˆ   RP   R�   RÊ   t   UF_IMMUTABLER9   RJ   t
   EOPNOTSUPPRs   R,   R   Rt   RK   R   t   chflags(	   R   t   chflags_funct   target_fileR•   t   errt   msgt   new_stR^   RM   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   _test_chflags_regular_fileÃ  s"    RÍ   s   test needs os.chflags()c         C   s   |  j  t j t j ƒ d  S(   N(   RÓ   R   RÍ   R    R   (   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_chflagsÚ  s    t   lchflagss   test needs os.lchflags()c         C   s   |  j  t j t j ƒ d  S(   N(   RÓ   R   RÕ   R    R   (   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_lchflags_regular_fileÞ  s    c         C   s,  t  j t j ƒ } |  j t | d ƒ ƒ t  j t j t ƒ |  j j	 t ƒ t  j
 t ƒ } y t j t | j t j Bƒ Wn> t k
 r¸ } | j t j k r¢ ‚  n  d } |  j | ƒ n XzX t  j t j ƒ } t  j
 t ƒ } |  j | j | j ƒ |  j | j t j B| j ƒ Wd  t j t | j ƒ Xd  S(   NRÊ   s2   chflag UF_IMMUTABLE not supported by underlying fs(   R   Rˆ   R    R   RP   R�   R­   R®   R   t   appendR¬   R   RÕ   RÊ   RË   R9   RJ   RÌ   Rs   R,   (   R   t	   testfn_stt   dummy_symlink_stRÐ   RÑ   t   new_testfn_stt   new_dummy_symlink_st(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_lchflags_symlinkâ  s(    	t   putenvs   requires os.putenv()c      	   C   sv   |  j  t ƒ � t j d d ƒ Wd  QX|  j  t ƒ � t j d d ƒ Wd  QX|  j  t ƒ � t j d d ƒ Wd  QXd  S(   Ns   FRUIT VEGETABLEt   cabbaget   FRUITs   orange VEGETABLE=cabbages   FRUIT=ORANGEt   lemon(   R%   R&   R   RÝ   Rc   (   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_putenv   s    R   s   test needs posix.getcwd()c            s¥   d } t  j ƒ  } t  j j t j ƒ d } y t  j | ƒ t  j | ƒ Wn ˆ j d ƒ n Xz# d ‡  ‡ f d † ‰  ˆ  | ƒ Wd  t  j | ƒ t	 j
 | ƒ Xd  S(   Ns8   getcwd-test-directory-0123456789abcdef-01234567890abcdefs   .getcwds#   cannot create directory for testingi    c            s5  y t  j |  ƒ Wn ˆ j d ƒ n Xt  j |  ƒ zÞ y8 t  j ƒ  | d k  ro ˆ  |  | t |  ƒ d ƒ n  WnŸ t k
 r} t j } d t	 j
 k pµ d t	 j
 k pµ d t	 j
 k } | rÊ t j } n  d t	 j
 k rû ˆ j | j t j t j f ƒ qˆ j | j | ƒ n XWd  t  j d ƒ t  j |  ƒ Xd  S(	   Ns?   mkdir cannot create directory sufficiently deep for getcwd testi  i   Ry   t   netbsdt   openbsdt   darwins   ..(   R   t   mkdirRs   R°   R   R-   R9   RJ   t   ENAMETOOLONGR’   R“   t   ERANGER³   t   ENOENTR,   t   rmdir(   t   dirnamet   current_path_lengthRM   t   expected_errnot   quirky_platform(   t   _create_and_do_getcwdR   (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyRî     s,     
"	"(   R   R   t   patht   abspathR    R   Rå   R°   Rs   t   shutilt   rmtree(   R   Rê   RQ   t	   base_path(    (   Rî   R   s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_getcwd_long_pathnames	  s    !R   s   test needs os.getegid()c         C   s  t  j d ƒ �% } | j ƒ  j ƒ  } | j ƒ  } Wd  QX| d  k sI | r[ t j d ƒ ‚ n  t j	 d k rÌ d d  l
 } | j d ƒ pˆ d } t d „  | j d ƒ d	 d
 !Dƒ ƒ d k  rÌ t j d ƒ ‚ qÌ n  |  j t g  | j ƒ  D] } t | ƒ ^ qâ ƒ t t j ƒ  t j ƒ  g ƒ ƒ d  S(   Ns   id -G 2>/dev/nulls   need working 'id -G'Rä   iÿÿÿÿt   MACOSX_DEPLOYMENT_TARGETs   10.0c         s   s   |  ] } t  | ƒ Vq d  S(   N(   R]   (   t   .0t   n(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pys	   <genexpr>K  s    Rp   i    i   i
   i   s$   getgroups(2) is broken prior to 10.6(   i
   i   (   R   t   popent   readt   stripR   R$   RH   RI   R’   R“   t	   sysconfigt   get_config_vart   tuplet   splitR,   t   setR]   R   R   R   (   R   t   idgt   groupst   retRû   t   dtt   x(    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_getgroups>  s    ,(c         C   s?  t  j } y | j t  j ƒ Wn$ t t f k
 rC |  j d ƒ n X| d } |  j t  j | ƒ t  j | ƒ d  } z6 |  j
 t ƒ �! t j | t j t j Bƒ } Wd  QXWd  | d  k	 rÉ t j | ƒ n  X|  j t j j | ƒ ƒ |  j
 t t j | ƒ |  j t j j | ƒ ƒ t | d ƒ j ƒ  |  j
 t t j | ƒ d  S(   Ns"   Requires unicode filenames supportu    t   wb(   R    t   TESTFN_UNICODEt   encodet   TESTFN_ENCODINGt   UnicodeErrorR&   Rs   Rq   R   R$   R%   R   R   R~   R   R   t   assertFalseRï   t   existsRå   Rˆ   (   R   t   fnt   fn_with_NULR^   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_path_with_null_unicodeV  s&    	
&c         C   s  t  j } | d } |  j t  j | ƒ t  j | ƒ d  } z6 |  j t ƒ �! t j | t j	 t j
 Bƒ } Wd  QXWd  | d  k	 rŽ t j | ƒ n  X|  j t j j | ƒ ƒ |  j t t j | ƒ |  j t j j | ƒ ƒ t | d ƒ j ƒ  |  j t t j | ƒ d  S(   Ns    R  (   R    R   Rq   R   R$   R%   R&   R   R   R~   R   R   R  Rï   R  Rå   Rˆ   (   R   R  R  R^   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_path_with_null_bytem  s    	
&(;   t   __name__t
   __module__R
   R   R*   RH   t
   skipUnlessR�   R   R1   R4   R8   R;   R>   R@   RN   RR   RU   RZ   R_   Re   Ri   Rm   Ro   Rx   R’   R“   R”   R{   R‚   R…   R‡   R‰   R—   R¥   R§   Rª   R¯   R±   R´   R·   Rº   R¼   RÀ   RÃ   RÅ   RÉ   RÓ   RÔ   RÖ   RÜ   R   Rá   Rô   R  R    t   requires_unicodeR  R  (    (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyR      s’   			

	'%	;$$$$$$$$$
	$$$$	4$t   PosixGroupsTesterc           B   sb   e  Z d  „  Z d „  Z e j e e d ƒ d ƒ d „  ƒ Z e j e e d ƒ d ƒ d „  ƒ Z	 RS(   c         C   sy   t  j ƒ  d k r$ t j d ƒ ‚ n  t t  d ƒ sE t j d ƒ ‚ n  t j d k rf t j d ƒ ‚ n  t  j ƒ  |  _ d  S(   Ni    s   not enough privilegesR   s   need posix.getgroupsRä   s   getgroups(2) is broken on OSX(	   R   R   RH   RI   R�   R’   R“   R   t   saved_groups(   R   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyR
   ‚  s    c         C   sg   t  t d ƒ r" t j |  j ƒ nA t  t d ƒ rc t j t j ƒ  ƒ j } t j | |  j d ƒ n  d  S(   Nt	   setgroupsRA   i    (	   R�   R   R  R  RD   RE   R   RF   RA   (   R   R(   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyR   ‹  s
    RA   s   test needs posix.initgroups()c         C   s^   t  |  j p d g ƒ d } t j t j ƒ  ƒ j } t j | | ƒ |  j | t j	 ƒ  ƒ d  S(   Ni    i   (
   t   maxR  RD   RE   R   R   RF   RA   R³   R   (   R   t   gR(   (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyRN   ’  s    R  s   test needs posix.setgroups()c         C   sG   x@ d g t  d ƒ g D]) } t j | ƒ |  j | t j ƒ  ƒ q Wd  S(   Ni    i   (   t   rangeR   R  t   assertListEqualR   (   R   R  (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   test_setgroupsœ  s    (
   R  R  R
   R   RH   R  R�   R   RN   R  (    (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyR  €  s   				c           C   s   t  j t t ƒ d  S(   N(   R    t   run_unittestR   R  (    (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt	   test_main¤  s    t   __main__(   t   __doc__RW   R    t   import_moduleR   RJ   R’   RÇ   R   R“   RD   Rñ   Rˆ   t   tempfileRH   R   Rï   t   joint
   gettempdirR   R®   R!   t   RuntimeWarningt   TestCaseR   R  R  R  (    (    (    s…   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_posix.pyt   <module>   s2   ÿ ÿ g$	