ó
‹wÛjc           @   sÆ   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 m Z d d l m	 Z	 m
 Z
 m Z m Z e d ƒ Z e e d ƒ d e f d „  ƒ  YZ d	 „  Z e d
 k rÂ e ƒ  n  d S(   s.   This test checks for correct fork() behavior.
iÿÿÿÿN(   t   ForkWait(   t   run_unittestt   reap_childrent   get_attributet   import_modulet	   threadingt   forkt   ForkTestc           B   s   e  Z d  „  Z d „  Z RS(   c         C   sˆ   xL t  d ƒ D]> } t j | t j ƒ \ } } | | k r> Pn  t j d ƒ q W|  j | | ƒ |  j | d d | d @| d ?f ƒ d  S(   Ni
   g      ð?i    s   cause = %d, exit = %diÿ   i   (   t   ranget   ost   waitpidt   WNOHANGt   timet   sleept   assertEqual(   t   selft   cpidt   it   spidt   status(    (    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_fork1.pyt	   wait_impl   s    c            sô   t  j ƒ  ‰ d ‰ d ‰ d ‰  ‡  ‡ ‡ ‡ f d †  } t  j d | ƒ } | j ƒ  ˆ j ƒ  t j ƒ  } zY | s© t ˆ ƒ } | ˆ  k r™ t j d ƒ qÀ t j d ƒ n | j	 ƒ  |  j
 | ƒ Wd  y t j | t j ƒ Wn t k
 rî n XXd  S(   Ns   fake test modulet   partialt   completec              sI   t  j ƒ  ˆ t j ˆ <ˆ j ƒ  t j d ƒ ˆ  t j ˆ <t  j ƒ  d  S(   Ng{®Gáz„?(   t   impt   acquire_lockt   syst   modulest   setR   R   t   release_lock(    (   t   complete_modulet   fake_module_namet   import_startedt   partial_module(    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_fork1.pyt   importer$   s    

t   targeti    i   (   R   t   Eventt   Threadt   startt   waitR	   R   t
   __import__t   _exitt   joinR   t   killt   signalt   SIGKILLt   OSError(   R   R!   t   tt   pidt   m(    (   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_fork1.pyt   test_import_lock_fork   s*    


(   t   __name__t
   __module__R   R1   (    (    (    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_fork1.pyR      s   	c           C   s   t  t ƒ t ƒ  d  S(   N(   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_fork1.pyt	   test_mainB   s    
t   __main__(   t   __doc__R   R	   R+   R   R   t   test.fork_waitR    t   test.test_supportR   R   R   R   R   R   R4   R2   (    (    (    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_fork1.pyt   <module>   s   "0	