ó
ŒwÛjc           @   sÔ  d  d l  Z  d  d l m 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 y d  d l Z Wn e k
 rÉ e Z n Xd  d l Z y d  d l Z Wn e k
 rÿ e Z n Xy d  d l Z Wn e k
 r)e Z n Xy d  d l Z Wn e k
 rSe Z n Xe j d k Z e rrd Z n d Z d e  j f d „  ƒ  YZ d e f d	 „  ƒ  YZ d
 e j f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ e  j  e d ƒ d e f d „  ƒ  Yƒ Z! e  j" e d ƒ d e f d „  ƒ  Yƒ Z# e  j" e$ e d e% ƒ d ƒ d e f d „  ƒ  Yƒ Z& d e  j f d „  ƒ  YZ' e  j" e d ƒ d e f d „  ƒ  Yƒ Z( d „  Z) e* d  k rÐe) ƒ  n  d S(!   iÿÿÿÿN(   t   test_supportt   win32s@   import msvcrt; msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY);t    t   BaseTestCasec           B   s&   e  Z d  „  Z d „  Z d d „ Z RS(   c         C   s   t  j ƒ  d  S(   N(   R    t   reap_children(   t   self(    (    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_subprocess.pyt   setUp2   s    c         C   sS   x t  j D] } | j ƒ  q
 Wt  j ƒ  |  j t  j d ƒ |  j ƒ  t j ƒ  d  S(   Ns   subprocess._active not empty(   t
   subprocesst   _activet   waitt   _cleanupt   assertFalset
   doCleanupsR    R   (   R   t   inst(    (    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_subprocess.pyt   tearDown7   s    

c         C   s,   t  j d d | ƒ } |  j | | | ƒ d  S(   Ns   \[\d+ refs\]\r?\n?$R   (   t   ret   subt   assertEqual(   R   t   stderrt   expectedt   msgt   actual(    (    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_subprocess.pyt   assertStderrEqual?   s    N(   t   __name__t
   __module__R   R   t   NoneR   (    (    (    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_subprocess.pyR   1   s   		t   PopenTestExceptionc           B   s   e  Z RS(    (   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_subprocess.pyR   G   s   t   PopenExecuteChildRaisesc           B   s   e  Z d  Z d „  Z RS(   se   Popen subclass for testing cleanup of subprocess.PIPE filehandles when
    _execute_child fails.
    c         O   s   t  d ƒ ‚ d  S(   Ns   Forced Exception for Test(   R   (   R   t   argst   kwargs(    (    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_subprocess.pyt   _execute_childO   s    (   R   R   t   __doc__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_subprocess.pyR   K   s   t   ProcessTestCasec           B   s\  e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z e j e j ƒ  d ƒ d „  ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z  d „  Z! d „  Z" d „  Z# d „  Z$ d  „  Z% d! „  Z& d" „  Z' d# „  Z( e j) e* j+ j, d$ e* j- ƒ  ƒ d% ƒ d& „  ƒ Z. d' „  Z/ d( „  Z0 d) „  Z1 d* „  Z2 d+ „  Z3 d, „  Z4 d- „  Z5 d. „  Z6 d/ „  Z7 d0 „  Z8 d1 „  Z9 e j e: d8 k d2 ƒ d3 „  ƒ Z< d4 „  Z= d5 „  Z> d6 „  Z? e j) e* j+ j, d$ e* j- ƒ  ƒ d% ƒ d7 „  ƒ Z@ RS(9   c         C   s/   t  j t j d d g ƒ } |  j | d ƒ d  S(   Ns   -cs   import sys; sys.exit(47)i/   (   R   t   callt   syst
   executableR   (   R   t   rc(    (    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_subprocess.pyt   test_call_seqU   s    c         C   s/   t  j t j d d g ƒ } |  j | d ƒ d  S(   Ns   -cs   import sys; sys.exit(0)i    (   R   t
   check_callR"   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_subprocess.pyt   test_check_call_zero[   s    c         C   sN   |  j  t j ƒ �  } t j t j d d g ƒ Wd  QX|  j | j j d ƒ d  S(   Ns   -cs   import sys; sys.exit(47)i/   (	   t   assertRaisesR   t   CalledProcessErrorR&   R"   R#   R   t	   exceptiont
   returncode(   R   t   c(    (    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_subprocess.pyt   test_check_call_nonzeroa   s    c         C   s/   t  j t j d d g ƒ } |  j d | ƒ d  S(   Ns   -cs   print 'BDFL't   BDFL(   R   t   check_outputR"   R#   t   assertIn(   R   t   output(    (    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_subprocess.pyt   test_check_outputh   s    c         C   sN   |  j  t j ƒ �  } t j t j d d g ƒ Wd  QX|  j | j j d ƒ d  S(   Ns   -cs   import sys; sys.exit(5)i   (	   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_subprocess.pyt   test_check_output_nonzeron   s    c         C   s8   t  j t j d d g d t  j ƒ} |  j d | ƒ d  S(   Ns   -cs$   import sys; sys.stderr.write('BDFL')R   R.   (   R   R/   R"   R#   t   STDOUTR0   (   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_subprocess.pyt   test_check_output_stderru   s    c         C   sg   |  j  t ƒ �8 } t j t j d d g d t j ƒ} |  j d ƒ Wd  QX|  j d | j	 j
 d ƒ d  S(   Ns   -cs   print 'will not be run't   stdouts-   Expected ValueError when stdout arg supplied.i    (   R(   t
   ValueErrorR   R/   R"   R#   R6   t   failR0   R*   R   (   R   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_subprocess.pyt   test_check_output_stdout_arg|   s    c         C   sN   t  j j ƒ  } d | d <t j t j d d g d | ƒ} |  j | d ƒ d  S(   Nt   bananat   FRUITs   -cs5   import sys, os;sys.exit(os.getenv("FRUIT")=="banana")t   envi   (   t   ost   environt   copyR   R!   R"   R#   R   (   R   t   newenvR$   (    (    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_subprocess.pyt   test_call_kwargs…   s    
		c      	   C   s�   t  j ƒ  �Y } |  j t t j d d ƒt j j j j } d g | d } |  j t t j | Œ Wd  QX|  j	 | j
 ƒ  d ƒ d  S(   Nt   invalid_arg_namei   i    R   (   R    t   captured_stderrR(   t	   TypeErrorR   t   Popent   __init__t   __code__t   co_argcountR   t   getvalue(   R   t   st   argcountt   too_many_args(    (    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_subprocess.pyt   test_invalid_args�   s    c         C   st   t  j t j d d g d t  j d t  j ƒ} |  j | j j ƒ |  j | j j ƒ | j	 ƒ  |  j
 | j d  ƒ d  S(   Ns   -cs   print "banana"R6   R   (   R   RE   R"   R#   t   PIPEt
   addCleanupR6   t   closeR   R	   R   t   stdinR   (   R   t   p(    (    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_subprocess.pyt   test_stdin_none™   s    
c         C   s›   d } t  j t j d | g d t  j d t  j ƒ} |  j | j j ƒ |  j | j j ƒ | j	 ƒ  \ } } |  j
 | j d | ƒ |  j
 | j ƒ  d ƒ d  S(   Ns±   import sys; from subprocess import Popen, PIPE;p = Popen([sys.executable, "-c", "print 'test_stdout_none'"],          stdin=PIPE, stderr=PIPE);p.wait(); assert p.stdout is None;s   -cR6   R   i    t   test_stdout_none(   R   RE   R"   R#   RN   RO   R6   RP   R   t   communicateR   R+   t   rstrip(   R   t   codeRR   t   outt   err(    (    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_subprocess.pyRT   ¢   s    c         C   st   t  j t j d d g d t  j d t  j ƒ} |  j | j j ƒ |  j | j j ƒ | j	 ƒ  |  j
 | j d  ƒ d  S(   Ns   -cs   print "banana"RQ   R6   (   R   RE   R"   R#   RN   RO   R6   RP   RQ   R	   R   R   R   (   R   RR   (    (    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_subprocess.pyt   test_stderr_none¹   s    
c         C   si   t  j j t  j j t j ƒ ƒ } t j d d d g d t j d | ƒ} | j ƒ  |  j	 | j
 d ƒ d  S(   Nt   somethingyoudonthaves   -cs   import sys; sys.exit(47)R#   t   cwdi/   (   R=   t   patht   dirnamet   realpathR"   R#   R   RE   R	   R   R+   (   R   t
   python_dirRR   (    (    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_subprocess.pyt   test_executable_with_cwdÂ   s    !	
s#   need an installed Python. See #7774c         C   sB   t  j d d d g d t j ƒ} | j ƒ  |  j | j d ƒ d  S(   NR[   s   -cs   import sys; sys.exit(47)R#   i/   (   R   RE   R"   R#   R	   R   R+   (   R   RR   (    (    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_subprocess.pyt   test_executable_without_cwdÊ   s
    	
c         C   sb   t  j t j d d g d t  j ƒ} | j j d ƒ | j j ƒ  | j ƒ  |  j	 | j
 d ƒ d  S(   Ns   -cs0   import sys; sys.exit(sys.stdin.read() == "pear")RQ   t   peari   (   R   RE   R"   R#   RN   RQ   t   writeRP   R	   R   R+   (   R   RR   (    (    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_subprocess.pyt   test_stdin_pipeÕ   s    	
c         C   s}   t  j ƒ  } | j ƒ  } t j | d ƒ t j | d d ƒ t j t j	 d d g d | ƒ} | j
 ƒ  |  j | j d ƒ d  S(   NRc   i    s   -cs0   import sys; sys.exit(sys.stdin.read() == "pear")RQ   i   (   t   tempfilet   TemporaryFilet   filenoR=   Rd   t   lseekR   RE   R"   R#   R	   R   R+   (   R   t   tft   dRR   (    (    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_subprocess.pyt   test_stdin_filedesß   s    		
c         C   sh   t  j ƒ  } | j d ƒ | j d ƒ t j t j d d g d | ƒ} | j ƒ  |  j	 | j
 d ƒ d  S(   NRc   i    s   -cs0   import sys; sys.exit(sys.stdin.read() == "pear")RQ   i   (   Rf   Rg   Rd   t   seekR   RE   R"   R#   R	   R   R+   (   R   Rj   RR   (    (    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_subprocess.pyt   test_stdin_fileobjë   s    		
c         C   sT   t  j t j d d g d t  j ƒ} |  j | j j ƒ |  j | j j	 ƒ  d ƒ d  S(   Ns   -cs&   import sys; sys.stdout.write("orange")R6   t   orange(
   R   RE   R"   R#   RN   RO   R6   RP   R   t   read(   R   RR   (    (    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_subprocess.pyt   test_stdout_pipeö   s
    	c         C   sv   t  j ƒ  } | j ƒ  } t j t j d d g d | ƒ} | j ƒ  t j	 | d d ƒ |  j
 t j | d ƒ d ƒ d  S(   Ns   -cs&   import sys; sys.stdout.write("orange")R6   i    i   Ro   (   Rf   Rg   Rh   R   RE   R"   R#   R	   R=   Ri   R   Rp   (   R   Rj   Rk   RR   (    (    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_subprocess.pyt   test_stdout_filedesþ   s    		
c         C   s^   t  j ƒ  } t j t j d d g d | ƒ} | j ƒ  | j d ƒ |  j | j	 ƒ  d ƒ d  S(   Ns   -cs&   import sys; sys.stdout.write("orange")R6   i    Ro   (
   Rf   Rg   R   RE   R"   R#   R	   Rm   R   Rp   (   R   Rj   RR   (    (    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_subprocess.pyt   test_stdout_fileobj	  s    		
c         C   sT   t  j t j d d g d t  j ƒ} |  j | j j ƒ |  j | j j	 ƒ  d ƒ d  S(   Ns   -cs*   import sys; sys.stderr.write("strawberry")R   t
   strawberry(
   R   RE   R"   R#   RN   RO   R   RP   R   Rp   (   R   RR   (    (    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_subprocess.pyt   test_stderr_pipe  s
    	c         C   sv   t  j ƒ  } | j ƒ  } t j t j d d g d | ƒ} | j ƒ  t j	 | d d ƒ |  j
 t j | d ƒ d ƒ d  S(   Ns   -cs*   import sys; sys.stderr.write("strawberry")R   i    i   Rt   (   Rf   Rg   Rh   R   RE   R"   R#   R	   R=   Ri   R   Rp   (   R   Rj   Rk   RR   (    (    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_subprocess.pyt   test_stderr_filedes  s    		
c         C   s^   t  j ƒ  } t j t j d d g d | ƒ} | j ƒ  | j d ƒ |  j | j	 ƒ  d ƒ d  S(   Ns   -cs*   import sys; sys.stderr.write("strawberry")R   i    Rt   (
   Rf   Rg   R   RE   R"   R#   R	   Rm   R   Rp   (   R   Rj   RR   (    (    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_subprocess.pyt   test_stderr_fileobj&  s    		
c         C   sv   t  j t j d d g d t  j d t  j ƒ} | j ƒ  \ } } |  j | d ƒ |  j | d ƒ |  j | j d ƒ d  S(   Ns   -cs›   import sys, subprocess;rc = subprocess.call([sys.executable, "-c",    "import sys;"    "sys.stderr.write('42')"],    stderr=subprocess.STDOUT);sys.exit(rc)R6   R   t   42R   i    (	   R   RE   R"   R#   RN   RU   R   R   R+   (   R   RR   R6   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_subprocess.pyt,   test_stderr_redirect_with_no_stdout_redirect0  s    		c         C   s]   t  j t j d d g d t  j d t  j ƒ} |  j | j j ƒ |  j	 | j j
 ƒ  d ƒ d  S(   Ns   -csR   import sys;sys.stdout.write("apple");sys.stdout.flush();sys.stderr.write("orange")R6   R   t   appleorange(   R   RE   R"   R#   RN   R4   RO   R6   RP   R   Rp   (   R   RR   (    (    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_subprocess.pyt   test_stdout_stderr_pipeE  s    		c         C   sd   t  j ƒ  } t j t j d d g d | d | ƒ} | j ƒ  | j d ƒ |  j | j	 ƒ  d ƒ d  S(   Ns   -csR   import sys;sys.stdout.write("apple");sys.stdout.flush();sys.stderr.write("orange")R6   R   i    Rz   (
   Rf   Rg   R   RE   R"   R#   R	   Rm   R   Rp   (   R   Rj   RR   (    (    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_subprocess.pyt   test_stdout_stderr_fileQ  s    		
c         C   s›   d } t  j t j d | g d t  j d t  j ƒ} |  j | j j ƒ |  j | j j ƒ | j	 ƒ  \ } } |  j
 | j d | ƒ |  j
 | j ƒ  d ƒ d  S(   Ns´   import sys, subprocess; rc = subprocess.call([sys.executable, "-c",     "import os, sys; sys.exit(os.write(sys.stdout.fileno(), 'test with stdout=1'))"], stdout=1); assert rc == 18s   -cR6   R   i    s   test with stdout=1(   R   RE   R"   R#   RN   RO   R6   RP   R   RU   R   R+   RV   (   R   RW   RR   RX   RY   (    (    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_subprocess.pyt   test_stdout_filedes_of_stdout_  s    c         C   s°   t  j ƒ  } t j ƒ  } t j | ƒ t j ƒ  } t j | ƒ t j t j d d g d t j	 d | ƒ} |  j
 | j j ƒ t j j } |  j | | j j ƒ  ƒ | | ƒ ƒ d  S(   Ns   -cs+   import sys,os;sys.stdout.write(os.getcwd())R6   R\   (   Rf   t
   gettempdirR=   t   getcwdt   chdirR   RE   R"   R#   RN   RO   R6   RP   R]   t   normcaseR   Rp   (   R   t   tmpdirR\   RR   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_subprocess.pyt   test_cwdr  s    			c         C   ss   t  j j ƒ  } d | d <t j t j d d g d t j d | ƒ} |  j | j	 j
 ƒ |  j | j	 j ƒ  d ƒ d  S(   NRo   R;   s   -cs2   import sys,os;sys.stdout.write(os.getenv("FRUIT"))R6   R<   (   R=   R>   R?   R   RE   R"   R#   RN   RO   R6   RP   R   Rp   (   R   R@   RR   (    (    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_subprocess.pyt   test_envƒ  s    
			c      	   C   sl   t  j d } |  j t ƒ � t j | d d g ƒ Wd  QX|  j t ƒ � t j t  j d d g ƒ Wd  QXd  S(   Ns    s   -ct   passs   pass# (   R"   R#   R(   RD   R   RE   (   R   t   cmd(    (    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_subprocess.pyt   test_invalid_cmdŽ  s
    c      
   C   sS  t  j j ƒ  } d | d <|  j t ƒ �$ t j t j d d g d | ƒWd  QXt  j j ƒ  } d | d <|  j t ƒ �$ t j t j d d g d | ƒWd  QXt  j j ƒ  } d | d	 <|  j t	 ƒ �$ t j t j d d g d | ƒWd  QXt  j j ƒ  } d
 | d <t j t j d d g d t j
 d | ƒ} | j ƒ  \ } } |  j | d
 ƒ d  S(   Nt   cabbages   FRUIT VEGETABLEs   -cR…   R<   s   orange VEGETABLE=cabbageR;   t   lemons   FRUIT=ORANGEs   orange=lemons3   import sys, os;sys.stdout.write(os.getenv("FRUIT"))R6   (   R=   R>   R?   R(   RD   R   RE   R"   R#   R7   RN   RU   R   (   R   R@   RR   R6   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_subprocess.pyt   test_invalid_env˜  s(    
%
%
%
			c         C   sH   t  j t j d d g d t  j ƒ} | j d ƒ |  j | j d ƒ d  S(   Ns   -cs/   import sys;sys.exit(sys.stdin.read() == "pear")RQ   Rc   i   (   R   RE   R"   R#   RN   RU   R   R+   (   R   RR   (    (    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_subprocess.pyt   test_communicate_stdin¶  s
    	c         C   sZ   t  j t j d d g d t  j ƒ} | j ƒ  \ } } |  j | d ƒ |  j | d  ƒ d  S(   Ns   -cs)   import sys; sys.stdout.write("pineapple")R6   t	   pineapple(   R   RE   R"   R#   RN   RU   R   R   (   R   RR   R6   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_subprocess.pyt   test_communicate_stdout¾  s    	c         C   sZ   t  j t j d d g d t  j ƒ} | j ƒ  \ } } |  j | d  ƒ |  j | d ƒ d  S(   Ns   -cs)   import sys; sys.stderr.write("pineapple")R   RŒ   (	   R   RE   R"   R#   RN   RU   R   R   R   (   R   RR   R6   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_subprocess.pyt   test_communicate_stderrÆ  s    	c         C   s¨   t  j t j d d g d t  j d t  j d t  j ƒ} |  j | j j ƒ |  j | j j ƒ |  j | j	 j ƒ | j
 d ƒ \ } } |  j | d ƒ |  j | d ƒ d  S(   Ns   -csN   import sys,os;sys.stderr.write("pineapple");sys.stdout.write(sys.stdin.read())RQ   R6   R   R:   RŒ   (   R   RE   R"   R#   RN   RO   R6   RP   R   RQ   RU   R   R   (   R   RR   R6   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_subprocess.pyt   test_communicateÎ  s    			s   /proc/%d/fds   Linux specificc         C   s¤   d t  j ƒ  } t t  j | ƒ ƒ } t j t j d d g d t j ƒ} | j	 ƒ  t t  j | ƒ ƒ } ~ t t  j | ƒ ƒ } |  j
 | | ƒ |  j
 | | ƒ d  S(   Ns   /proc/%d/fds   -cs	   print('')R6   (   R=   t   getpidt   lent   listdirR   RE   R"   R#   RN   RU   R   (   R   t   fd_directoryt   num_fds_before_popenRR   t   num_fds_after_communicatet   num_fds_after_destruction(    (    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_subprocess.pyt   test_communicate_pipe_fd_leakß  s    
c         C   sQ   t  j t j d d g ƒ } | j ƒ  \ } } |  j | d  ƒ |  j | d  ƒ d  S(   Ns   -cs   import sys; sys.exit(47)(   R   RE   R"   R#   RU   R   R   (   R   RR   R6   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_subprocess.pyt   test_communicate_returnsî  s
    c         C   só   t  j ƒ  \ } } t r! d } n t  j | d ƒ } t  j | ƒ t  j | ƒ t j t j d d | g d t j	 d t j	 d t j	 ƒ} |  j
 | j j ƒ |  j
 | j j ƒ |  j
 | j j ƒ d | } | j | ƒ \ } } |  j | | ƒ d  S(	   Ni   t   PC_PIPE_BUFs   -csp   import sys,os;sys.stdout.write(sys.stdin.read(47));sys.stderr.write("xyz"*%d);sys.stdout.write(sys.stdin.read())RQ   R6   R   t   abc(   R=   t   pipet	   mswindowst	   fpathconfRP   R   RE   R"   R#   RN   RO   R6   R   RQ   RU   R   (   R   t   xt   yt   pipe_bufRR   t   string_to_writeR6   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_subprocess.pyt   test_communicate_pipe_bufö  s$    	
		
c         C   s¸   t  j t j d d g d t  j d t  j d t  j ƒ} |  j | j j ƒ |  j | j j ƒ |  j | j	 j ƒ | j	 j
 d ƒ | j d ƒ \ } } |  j | d ƒ |  j | d	 ƒ d  S(
   Ns   -cs0   import sys,os;sys.stdout.write(sys.stdin.read())RQ   R6   R   R:   t   splitt   bananasplitR   (   R   RE   R"   R#   RN   RO   R6   RP   R   RQ   Rd   RU   R   R   (   R   RR   R6   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_subprocess.pyt   test_writes_before_communicate  s    			c         C   sŠ   t  j t j d d t d g d t  j d d ƒ} |  j | j j ƒ | j j	 ƒ  } t
 t d ƒ rv |  j | d ƒ n |  j | d	 ƒ d  S(
   Ns   -cs   import sys,os;s	  sys.stdout.write("line1\n");sys.stdout.flush();sys.stdout.write("line2\r");sys.stdout.flush();sys.stdout.write("line3\r\n");sys.stdout.flush();sys.stdout.write("line4\r");sys.stdout.flush();sys.stdout.write("\nline5");sys.stdout.flush();sys.stdout.write("\nline6");R6   t   universal_newlinesi   t   newliness#   line1
line2
line3
line4
line5
line6s%   line1
line2line3
line4
line5
line6(   R   RE   R"   R#   t	   SETBINARYRN   RO   R6   RP   Rp   t   hasattrt   fileR   (   R   RR   R6   (    (    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_subprocess.pyt   test_universal_newlines   s    
			
	c         C   s©   t  j t j d d t d g d t  j d t  j d d ƒ} |  j | j j ƒ |  j | j	 j ƒ | j
 ƒ  \ } } t t d ƒ r• |  j | d	 ƒ n |  j | d
 ƒ d  S(   Ns   -cs   import sys,os;s	  sys.stdout.write("line1\n");sys.stdout.flush();sys.stdout.write("line2\r");sys.stdout.flush();sys.stdout.write("line3\r\n");sys.stdout.flush();sys.stdout.write("line4\r");sys.stdout.flush();sys.stdout.write("\nline5");sys.stdout.flush();sys.stdout.write("\nline6");R6   R   R¦   i   R§   s#   line1
line2
line3
line4
line5
line6s%   line1
line2line3
line4
line5
line6(   R   RE   R"   R#   R¨   RN   RO   R6   RP   R   RU   R©   Rª   R   (   R   RR   R6   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_subprocess.pyt#   test_universal_newlines_communicate;  s    
		
	c      	   C   sp  t  s d } n d } g  } zx~ t | ƒ D]_ } y* | j t j t j t j t j Bƒ ƒ Wq+ t	 k
 r‰ } | j
 t
 j k r… ‚  n  Pq+ Xq+ W|  j d | ƒ x' t d ƒ D] } t j | j ƒ  ƒ q¬ Wxm t d ƒ D]_ } t j t j d d g d t j d	 t j d
 t j ƒ} | j d ƒ d } |  j | d ƒ qÖ WWd  x | D] } t j | ƒ qDWt j t j ƒ Xd  S(   Ni  i  s4   failed to reach the file descriptor limit (tried %d)i
   i   s   -cs-   import sys;sys.stdout.write(sys.stdin.read())RQ   R6   R   t   limei    (   Rœ   t   ranget   appendR=   t   openR    t   TESTFNt   O_WRONLYt   O_CREATt   OSErrort   errnot   EMFILEt   skipTestRP   t   popR   RE   R"   R#   RN   RU   R   t   unlink(   R   t   max_handlest   handlest   it   eRR   t   datat   h(    (    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_subprocess.pyt   test_no_leakingX  s8    						c         C   s  |  j  t j d d d g ƒ d ƒ |  j  t j d d d g ƒ d ƒ |  j  t j d d d g ƒ d	 ƒ |  j  t j d
 d d g ƒ d ƒ |  j  t j d d d g ƒ d ƒ |  j  t j d d d g ƒ d ƒ |  j  t j d d d g ƒ d ƒ |  j  t j d d g ƒ d ƒ d  S(   Ns   a b cRk   R½   s   "a b c" d es   ab"cs   \s	   ab\"c \ ds    \s   ab\"c " \\" ds   a\\\bs   de fgR¿   s   a\\\b "de fg" hs   a\"bR,   s
   a\\\"b c ds   a\\b cs   "a\\b c" d es   a\\b\ cs   "a\\b\ c" d et   abR   s   ab ""(   R   R   t   list2cmdline(   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_subprocess.pyt   test_list2cmdline~  s     c         C   s{   t  j t j d d g ƒ } d } x- | j ƒ  d  k rP t j d ƒ | d 7} q$ W|  j | d ƒ |  j	 | j ƒ  d ƒ d  S(   Ns   -cs   import time; time.sleep(1)i    gš™™™™™¹?i   i   (
   R   RE   R"   R#   t   pollR   t   timet   sleept   assertGreaterEqualR   (   R   RR   t   count(    (    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_subprocess.pyt	   test_poll‘  s    c         C   sK   t  j t j d d g ƒ } |  j | j ƒ  d ƒ |  j | j ƒ  d ƒ d  S(   Ns   -cs   import time; time.sleep(2)i    (   R   RE   R"   R#   R   R	   (   R   RR   (    (    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_subprocess.pyt	   test_wait¡  s    c         C   s6   |  j  t ƒ �! t j t j d d g d ƒ Wd  QXd  S(   Ns   -cR…   Ro   (   R(   RD   R   RE   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_subprocess.pyt   test_invalid_bufsize©  s    c         C   s…   x~ t  d ƒ D]p } |  j t ƒ �) } t j d g d t j d t j ƒWd  QX| j j t j t j	 t j
 f k r | j ‚ q q Wd  S(   Ni   t   nonexisting_i_hopeR6   R   (   R®   R(   t   EnvironmentErrorR   RE   RN   R*   Rµ   t   ENOENTt   ENOTDIRt   EACCES(   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_subprocess.pyt   test_leaking_fds_on_error¯  s    	$s   threading requiredc            sá   g  ‰  ‡  f d †  } t  j d | ƒ } | j ƒ  zE |  j t ƒ �0 t j d g d t j d t j d t j ƒWd  QXWd  | j ƒ  d  } x; ˆ  D]3 } y t
 j | ƒ Wq� t k
 rÂ } | } q� Xq� W| d  k	 rÜ | ‚ n  Xd  S(   Nc             s;   x4 t  d ƒ D]& }  ˆ  j t j ƒ  ƒ t j d ƒ q Wd  S(   Ni   gü©ñÒMbP?(   R®   t   extendR=   R›   RÅ   RÆ   (   R¼   (   t   fds(    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_subprocess.pyt   open_fdsÃ  s    t   targetRÌ   RQ   R6   R   (   t	   threadingt   Threadt   startR(   RÍ   R   RE   RN   t   joinR   R=   RP   R´   (   R   RÔ   t   tt   exct   fdR½   (    (   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_subprocess.pyt   test_double_close_on_error¿  s&    
		
c         C   s  t  j ƒ  \ } } t  j ƒ  \ } } t  j ƒ  \ } } y& t j d g d | d | d | ƒWn_ t k
 r½ t j | ƒ t j | ƒ t j | ƒ t j | ƒ t j | ƒ t j | ƒ n X|  j t j	 j
 | ƒ ƒ |  j t j	 j
 | ƒ ƒ |  j t j	 j
 | ƒ ƒ d  S(   Nt   *RQ   R6   R   (   Rf   t   mkstempR   RE   R´   R=   RP   t   removeR   R]   t   exists(   R   t   ifhandlet   ifnamet   ofhandlet   ofnamet   efhandlet   efname(    (    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_subprocess.pyt    test_handles_closed_on_exceptionÝ  s     c         C   s„   t  j t j d d g d t  j d t  j d t  j ƒ} |  j | j j ƒ |  j | j j ƒ |  j | j	 j ƒ | j
 d d	 ƒ d  S(
   Ns   -cR…   RQ   R6   R   Rž   i   i   i   (   R   RE   R"   R#   RN   RO   R6   RP   R   RQ   RU   (   R   RR   (    (    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_subprocess.pyt   test_communicate_epipeñ  s    		c         C   sY   t  j t j d d g d t  j ƒ} |  j | j j ƒ t j	 d ƒ | j
 d d ƒ d  S(   Ns   -cR…   RQ   i   Rž   i   i   (   R   RE   R"   R#   RN   RO   RQ   RP   RÅ   RÆ   RU   (   R   RR   (    (    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_subprocess.pyt!   test_communicate_epipe_only_stdinü  s
    c         C   s‰   d t  j ƒ  } t  j | ƒ } |  j t ƒ �6 t t j d d g d t j	 d t j	 d t j	 ƒWd QXt  j | ƒ } |  j
 | | ƒ d S(   s;   Test for the fork() failure fd leak reported in issue16327.s   /proc/%d/fds   -cR…   RQ   R6   R   N(   R=   R�   R’   R(   R   R   R"   R#   R   RN   R   (   R   R“   t   fds_before_popent   fds_after_exception(    (    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_subprocess.pyt!   test_failed_child_execute_fd_leak  s    N(A   R   R   R%   R'   R-   R2   R3   R5   R9   RA   RM   RS   RT   RZ   Ra   t   unittestt   skipIft	   sysconfigt   is_python_buildRb   Re   Rl   Rn   Rq   Rr   Rs   Ru   Rv   Rw   Ry   R{   R|   R}   Rƒ   R„   R‡   RŠ   R‹   R�   RŽ   R�   t
   skipUnlessR=   R]   t   isdirR�   R—   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_subprocess.pyR    S   sn   									
	
						
	
					
			
							
											&					!			
t   _SuppressCoreFilesc           B   sJ   e  Z d  Z d Z d „  Z d „  Z e j e	 e
 d ƒ d ƒ d „  ƒ Z RS(   s-   Try to prevent core files from being created.c         C   sÃ   t  d
 k	 rX y, t  j t  j ƒ |  _ t  j t  j d ƒ WqX t t  j f k
 rT qX Xn  t j	 d k r¿ t
 j d d d d g d t
 j ƒj ƒ  d } | j ƒ  d k r¿ d	 GHt j j ƒ  q¿ n  d
 S(   s3   Try to save previous ulimit, then set it to (0, 0).i    t   darwins   /usr/bin/defaultsRp   s   com.apple.CrashReportert
   DialogTypeR6   t	   developers;   this tests triggers the Crash Reporter, that is intentionalN(   i    i    (   t   resourceR   t	   getrlimitt   RLIMIT_COREt	   old_limitt	   setrlimitR7   t   errorR"   t   platformR   RE   RN   RU   t   stripR6   t   flush(   R   t   value(    (    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_subprocess.pyt	   __enter__  s    c         G   s]   |  j  d k r d St d k	 rY y t j t j |  j  ƒ WqY t t j f k
 rU qY Xn  d S(   s%   Return core file behavior to default.N(   Rû   R   Rø   Rü   Rú   R7   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_subprocess.pyt   __exit__5  s    t   SIGALRMs   Requires signal.SIGALRMc      
   C   sµ   d „  } t  j  t  j | ƒ } |  j t  j  t  j | ƒ t j d d g } xe d D]] } i t j | 6} t j | | � �3 } t  j d ƒ z | j	 ƒ  Wd  t  j d ƒ XWd  QXqP Wd  S(	   Nc         S   s   d  S(   N(    (   t   signumt   frame(    (    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_subprocess.pyt   handlerC  s    s   -cs   import time; time.sleep(2)R6   R   i   i    (   R6   R   (
   t   signalR  RO   R"   R#   R   RN   RE   t   alarmRU   (   R   R  t   old_handlerR   t   streamt   kwt   process(    (    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_subprocess.pyt   test_communicate_eintr?  s    	N(   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_subprocess.pyRô     s   		
s   POSIX specific testst   POSIXProcessTestCasec           B   s®  e  Z d  „  Z d „  Z d „  Z d e j f d „  ƒ  YZ e j	 e
 j j d ƒ d ƒ d „  ƒ Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z e j	 e j j d* ƒ d ƒ d „  ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z  d „  Z! d „  Z" d „  Z# d „  Z$ d „  Z% d  „  Z& d! „  Z' d" „  Z( d# „  Z) d$ „  Z* d% „  Z+ d& „  Z, e j- e. d+ k	 oše0 e. d' ƒ d( ƒ d) „  ƒ Z1 RS(,   c         C   sS   |  j  t ƒ �( } t j t j d d g d d ƒ} Wd  QX|  j d | j j ƒ d  S(   Ns   -cR   R\   s   /this/path/does/not/exists   os.chdir(	   R(   R´   R   RE   R"   R#   R0   R*   t   child_traceback(   R   R,   RR   (    (    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_subprocess.pyt   test_exceptionsX  s    c         C   sP   t  ƒ  �* t j t j d d g ƒ } | j ƒ  Wd  QX|  j | j t j	 ƒ d  S(   Ns   -cs   import os; os.abort()(
   Rô   R   RE   R"   R#   R	   R   R+   R  t   SIGABRT(   R   RR   (    (    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_subprocess.pyt   test_run_abort`  s
    
c         C   s]   t  j t j d d g d t  j d d „  ƒ} |  j | j j ƒ |  j | j j	 ƒ  d ƒ d  S(   Ns   -cs3   import sys, os;sys.stdout.write(os.getenv('FRUIT'))R6   t
   preexec_fnc           S   s   t  j d d ƒ S(   NR;   t   apple(   R=   t   putenv(    (    (    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_subprocess.pyt   <lambda>n  R   R  (
   R   RE   R"   R#   RN   RO   R6   RP   R   Rp   (   R   RR   (    (    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_subprocess.pyt   test_preexech  s    		t   _TestExecuteChildPopenc           B   s    e  Z d  Z d „  Z d „  Z RS(   s3   Used to test behavior at the end of _execute_child.c         O   s#   | |  _  t j j |  | | Ž d  S(   N(   t	   _testcaseR   RE   RF   (   R   t   testcaseR   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_subprocess.pyRF   t  s    	c         C   sÐ   zG t  j j |  | | | | | | | | |	 |
 | | | | | | | ƒ Wd  g  t d ƒ D] } t j d t j ƒ ^ qW } z1 x* | D]" } |  j j | | | | f ƒ q‚ WWd  x | D] } t j	 | ƒ q³ WXXd  S(   Ni   s	   /dev/zero(
   R   RE   R   R®   R=   R°   t   O_RDONLYR  t   assertNotInRP   (   R   R   R#   R  t	   close_fdsR\   R<   R¦   t   startupinfot   creationflagst   shellt   to_closet   p2creadt   p2cwritet   c2preadt   c2pwritet   errreadt   errwritet   _t   devzero_fdsRÜ   (    (    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_subprocess.pyR   x  s     		+	(   R   R   R   RF   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_subprocess.pyR  r  s   	s	   /dev/zeros   /dev/zero required.c         C   s`   d „  } |  j  t ƒ �B |  j |  t j d d g d t j d t j d t j d | ƒWd QXd S(	   s6   Issue16140: Don't double close pipes on preexec error.c           S   s   t  d ƒ ‚ d  S(   Ns-   force the _execute_child() errpipe_data path.(   t   RuntimeError(    (    (    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_subprocess.pyt   raise_it˜  s    s   -cR…   RQ   R6   R   R  N(   R(   R+  R  R"   R#   R   RN   (   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_subprocess.pyt0   test_preexec_errpipe_does_not_double_close_pipes”  s    	c         C   s“   t  j ƒ  \ } } t j | d ƒ t j | d t j ƒ t j | ƒ t j | d ƒ t j	 | ƒ } | j
 ƒ  t j | ƒ |  j | j d ƒ d  S(   Ns
   #!/bin/sh
s(   exec '%s' -c 'import sys; sys.exit(47)'
iÀ  i/   (   Rf   Rß   R=   Rd   R"   R#   RP   t   chmodR   RE   R	   Rà   R   R+   (   R   t   ft   fnameRR   (    (    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_subprocess.pyt   test_args_string¡  s    
c         C   sT   |  j  t t j t j d d g d d ƒ|  j  t t j t j d d g d d ƒd  S(   Ns   -cs   import sys; sys.exit(47)R  i/   R   (   R(   R7   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_subprocess.pyRM   ®  s    				c         C   sv   t  j j ƒ  } d | d <t j d g d d d t j d | ƒ} |  j | j j ƒ |  j	 | j j
 ƒ  j ƒ  d ƒ d  S(   NR  R;   s   echo $FRUITR!  i   R6   R<   (   R=   R>   R?   R   RE   RN   RO   R6   RP   R   Rp   Rÿ   (   R   R@   RR   (    (    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_subprocess.pyt   test_shell_sequence¹  s    
		c         C   ss   t  j j ƒ  } d | d <t j d d d d t j d | ƒ} |  j | j j ƒ |  j	 | j j
 ƒ  j ƒ  d ƒ d  S(   NR  R;   s   echo $FRUITR!  i   R6   R<   (   R=   R>   R?   R   RE   RN   RO   R6   RP   R   Rp   Rÿ   (   R   R@   RR   (    (    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_subprocess.pyt   test_shell_stringÃ  s    
		c         C   s†   t  j ƒ  \ } } t j | d ƒ t j | d t j ƒ t j | ƒ t j | d ƒ t j	 | ƒ } t j
 | ƒ |  j | d ƒ d  S(   Ns
   #!/bin/sh
s(   exec '%s' -c 'import sys; sys.exit(47)'
iÀ  i/   (   Rf   Rß   R=   Rd   R"   R#   RP   R.  R   R!   Rà   R   (   R   R/  R0  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_subprocess.pyt   test_call_stringÍ  s    c      	   C   s*  g  } xe d d d g D]T } xK d d g D]= } t  j j | | ƒ } t  j j | ƒ r) | j | ƒ q) q) Wq W| s„ |  j d ƒ n  d } t  j j | ƒ r¿ t  j j | ƒ r¿ | j | ƒ n  xd | D]\ } t j d d	 | d
 t	 d t j
 ƒ} |  j | j j ƒ |  j | j j ƒ  j ƒ  | ƒ qÆ Wd  S(   Ns   /bins	   /usr/bin/s   /usr/local/bint   basht   kshs"   bash or ksh required for this tests   /bin/shs   echo $0R#   R!  R6   (   R=   R]   RÙ   t   isfileR¯   R·   t   islinkR   RE   t   TrueRN   RO   R6   RP   R   Rp   Rÿ   (   R   t   shellst   prefixt   namet   shRR   (    (    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_subprocess.pyt   test_specific_shellÙ  s     %c      
   G   sc   t  j t j d d g d t d t  j d t  j d t  j ƒ} | j j d ƒ t | | ƒ | Œ  | S(   Ns   -csâ   if 1:
                             import sys, time
                             sys.stdout.write('x\n')
                             sys.stdout.flush()
                             time.sleep(30)
                             R  RQ   R6   R   i   (	   R   RE   R"   R#   R9  RN   R6   Rp   t   getattr(   R   t   methodR   RR   (    (    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_subprocess.pyt   _kill_processí  s    			t   netbsdt   openbsds"   Due to known OS bug (issue #16762)c      
   G   sz   t  j t j d d g d t d t  j d t  j d t  j ƒ} | j j d ƒ t j	 d ƒ t
 | | ƒ | Œ  | j ƒ  d  S(   Ns   -cs¶   if 1:
                             import sys, time
                             sys.stdout.write('x\n')
                             sys.stdout.flush()
                             R  RQ   R6   R   i   (   R   RE   R"   R#   R9  RN   R6   Rp   RÅ   RÆ   R?  RU   (   R   R@  R   RR   (    (    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_subprocess.pyt   _kill_dead_process   s    			c         C   sQ   |  j  d t j ƒ } | j ƒ  \ } } |  j d | ƒ |  j | j ƒ  d ƒ d  S(   Nt   send_signalt   KeyboardInterrupti    (   RA  R  t   SIGINTRU   R0   t   assertNotEqualR	   (   R   RR   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_subprocess.pyt   test_send_signal  s    c         C   sO   |  j  d ƒ } | j ƒ  \ } } |  j | d ƒ |  j | j ƒ  t j ƒ d  S(   Nt   killR   (   RA  RU   R   R   R	   R  t   SIGKILL(   R   RR   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_subprocess.pyt	   test_kill  s    c         C   sO   |  j  d ƒ } | j ƒ  \ } } |  j | d ƒ |  j | j ƒ  t j ƒ d  S(   Nt	   terminateR   (   RA  RU   R   R   R	   R  t   SIGTERM(   R   RR   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_subprocess.pyt   test_terminate#  s    c         C   s   |  j  d t j ƒ d  S(   NRE  (   RD  R  RG  (   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_subprocess.pyt   test_send_signal_dead)  s    c         C   s   |  j  d ƒ d  S(   NRJ  (   RD  (   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_subprocess.pyt   test_kill_dead-  s    c         C   s   |  j  d ƒ d  S(   NRM  (   RD  (   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_subprocess.pyt   test_terminate_dead1  s    c   	      C   s*  d } g  } x? | D]7 } t  j | ƒ } | j | ƒ | d k r | } q q Wz† x | D] } t  j | ƒ qX Wt j t j d d g d | d t j d t j ƒj	 ƒ  \ } } t
 j | ƒ } |  j | | f d	 ƒ Wd  x- t | | ƒ D] \ } } t  j | | ƒ qç Wx | D] } t  j | ƒ qWXd  S(
   Ni    s   -csR   import sys;sys.stdout.write("apple");sys.stdout.flush();sys.stderr.write("orange")RQ   R6   R   R  Ro   (   R  Ro   (   R=   t   dupR¯   RP   R   RE   R"   R#   RN   RU   R    t   strip_python_stderrR   t   zipt   dup2(	   R   RÓ   RQ   t   newfdst   at   bRÜ   RX   RY   (    (    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_subprocess.pyt   check_close_std_fds5  s*    		c         C   s   |  j  d g ƒ d  S(   Ni    (   RZ  (   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_subprocess.pyt   test_close_fd_0R  s    c         C   s   |  j  d g ƒ d  S(   Ni   (   RZ  (   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_subprocess.pyt   test_close_fd_1U  s    c         C   s   |  j  d g ƒ d  S(   Ni   (   RZ  (   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_subprocess.pyt   test_close_fd_2X  s    c         C   s   |  j  d d g ƒ d  S(   Ni    i   (   RZ  (   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_subprocess.pyt   test_close_fds_0_1[  s    c         C   s   |  j  d d g ƒ d  S(   Ni    i   (   RZ  (   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_subprocess.pyt   test_close_fds_0_2^  s    c         C   s   |  j  d d g ƒ d  S(   Ni   i   (   RZ  (   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_subprocess.pyt   test_close_fds_1_2a  s    c         C   s   |  j  d d d g ƒ d  S(   Ni    i   i   (   RZ  (   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_subprocess.pyt   test_close_fds_0_1_2d  s    c         C   sô  g  t  d ƒ D] } t j ƒ  ^ q } g  | D] \ } } | ^ q, } zŠx! | D] \ } } t j | ƒ qN Wg  t  d ƒ D] } t j | ƒ ^ qx }	 zÜ x* t | ƒ D] \ } }
 t j |
 | ƒ q£ Wt j | d ƒ t j	 | d d ƒ t
 j t j d d g d | d | d | ƒ} | j ƒ  x! | D] } t j	 | d d ƒ q$Wt j | d	 ƒ } t j t j | d	 ƒ ƒ } Wd  x7 t |	 ƒ D]) \ } } t j | | ƒ t j | ƒ qWX|  j | d
 ƒ |  j | d ƒ Wd  x | D] } t j | ƒ qØWXd  S(   Ni   t   STDINi    s   -csZ   import sys; got = sys.stdin.read();sys.stdout.write("got %s"%got); sys.stderr.write("err")RQ   R6   R   i   s	   got STDINRY   (   R®   Rf   Rß   R=   R¹   RS  t	   enumerateRV  Rd   Ri   R   RE   R"   R#   R	   Rp   R    RT  RP   R   (   R   t   stdin_not	   stdout_not	   stderr_noR¼   t   tempsRÜ   R0  t   temp_fdst	   saved_fdst   temp_fdRR   RX   RY   t   stdt   saved(    (    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_subprocess.pyt   check_swap_fdsi  s8    %(		
c         C   sv   |  j  d d d ƒ |  j  d d d ƒ |  j  d d d ƒ |  j  d d d ƒ |  j  d d d ƒ |  j  d d d ƒ d  S(   Ni    i   i   (   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_subprocess.pyt   test_swap_fds›  s    c         C   so   t  j d d d ƒ} t j t j | g d t j d t j ƒ} | j ƒ  \ } } |  j d | j	 d | ƒ d  S(   Ns   sigchild_ignore.pyt   subdirt   subprocessdataR6   R   i    s6   sigchild_ignore.py exited non-zero with this error:
%s(
   R    t   findfileR   RE   R"   R#   RN   RU   R   R+   (   R   t   sigchild_ignoreRR   R6   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_subprocess.pyt   test_wait_when_sigchild_ignored£  s    	c         C   s›   t  j t j d d g d t  j d t  j ƒ} |  j | j j ƒ |  j | j j ƒ t	 | ƒ } | j
 } ~ |  j | g  t  j D] } t	 | ƒ ^ q~ ƒ d  S(   Ns   -cs    import sys, time;time.sleep(0.2)R6   R   (   R   RE   R"   R#   RN   RO   R6   RP   R   t   idt   pidR0   R   (   R   RR   t   identRu  t   o(    (    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_subprocess.pyt   test_zombie_fast_process_del­  s    			c      
   C   sE  t  j t j d d g d t  j d t  j ƒ} |  j | j j ƒ |  j | j j ƒ t	 | ƒ } | j
 } ~ t j | t j ƒ |  j | g  t  j D] } t	 | ƒ ^ q‘ ƒ t j d ƒ |  j t ƒ �4 } t  j d g d t  j d t  j ƒ� } Wd  QXWd  QX|  j t t j | d ƒ |  j | g  t  j D] } t	 | ƒ ^ q(ƒ d  S(   Ns   -cs   import time;time.sleep(3)R6   R   gš™™™™™É?RÌ   i    (   R   RE   R"   R#   RN   RO   R6   RP   R   Rt  Ru  R=   RJ  R  RK  R0   R   RÅ   RÆ   R(   RÍ   R´   t   waitpidR  (   R   RR   Rv  Ru  Rw  R,   t   proc(    (    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_subprocess.pyt!   test_leak_fast_process_del_killed¿  s&    			,	c      
   C   sä   t  j t j d d g d t  j d t  j d t  j ƒ} t  j t j d d g  | j | j | j f D] } | j ƒ  ^ qa g d t  j d t  j d t  j d t	 ƒ} | j
 d ƒ | j
 ƒ  \ } } |  j | j d	 d
 t | ƒ ƒ d  S(   Ns   -cs   import os;os.read(0, 1)RQ   R6   R   s  if True:
                               import os, errno, sys
                               for fd in %r:
                                   try:
                                       os.close(fd)
                                   except OSError as e:
                                       if e.errno != errno.EBADF:
                                           raise
                                   else:
                                       sys.exit(1)
                               sys.exit(0)
                               R  t   fooi    s   Unexpected error: (   R   RE   R"   R#   RN   RQ   R6   R   Rh   t   FalseRU   R   R+   t   repr(   R   t   p1R/  t   p2R)  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_subprocess.pyt   test_pipe_cloexecß  s    	&t
   W_STOPCODEs   need _testcapi.W_STOPCODEc            s¬   t  j d d g } t j | ƒ } | j } t j | d ƒ \ } ‰  |  j ˆ  d ƒ t j	 d ƒ ‰  ‡  f d †  } t
 j t d | ƒ � | j ƒ  } Wd QX|  j | d ƒ d S(	   sA   Test wait() behavior when waitpid returns WIFSTOPPED; issue29335.s   -cR…   i    i   c            s
   |  ˆ  f S(   N(    (   Ru  t   flags(   t   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_subprocess.pyt   mock_waitpid  s    Ry  Niýÿÿÿ(   R"   R#   R   RE   Ru  R=   Ry  R   t	   _testcapiR‚  R    t	   swap_attrR	   (   R   R   Rz  Ru  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_subprocess.pyt   test_stoppedþ  s    	(   RB  RC  N(2   R   R   R  R  R  R   RE   R  Rî   Rï   R=   R]   Rá   R-  R1  RM   R2  R3  R4  R>  RA  R"   Rþ   t
   startswithRD  RI  RL  RO  RP  RQ  RR  RZ  R[  R\  R]  R^  R_  R`  Ra  Rm  Rn  Rs  Rx  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_subprocess.pyR  U  sJ   			
"(			
	
																		2		
		 	s   Windows specific testst   Win32ProcessTestCasec           B   s�   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sM   d } d } t  j ƒ  } | | _ | | _ t  j t j d d g d | ƒd  S(   Ni   i   s   -cs   import sys; sys.exit(0)R  (   R   t   STARTUPINFOt   dwFlagst   wShowWindowR!   R"   R#   (   R   t   STARTF_USESHOWWINDOWt   SW_MAXIMIZER  (    (    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_subprocess.pyt   test_startupinfo  s    		c         C   s4   d } t  j j d ƒ t j t  j d d | ƒd  S(   Ni   s'       a DOS box should flash briefly ...
s#    -c "import time; time.sleep(0.25)"R   (   R"   R   Rd   R   R!   R#   (   R   t   CREATE_NEW_CONSOLE(    (    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_subprocess.pyt   test_creationflags(  s
    c         C   s`   |  j  t t j t j d d g d d „  ƒ|  j  t t j t j d d g d t j d t ƒd  S(   Ns   -cs   import sys; sys.exit(47)R  c           S   s   d S(   Ni   (    (    (    (    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_subprocess.pyR  5  R   R6   R  (   R(   R7   R   R!   R"   R#   RN   R9  (   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_subprocess.pyRM   0  s    		
			c         C   s5   t  j t j d d g d t ƒ} |  j | d ƒ d  S(   Ns   -cs   import sys; sys.exit(47)R  i/   (   R   R!   R"   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_subprocess.pyt   test_close_fds<  s    		c         C   sp   t  j j ƒ  } d | d <t j d g d d d t j d | ƒ} |  j | j j ƒ |  j	 d | j j
 ƒ  ƒ d  S(   Nt   physalisR;   t   setR!  i   R6   R<   (   R=   R>   R?   R   RE   RN   RO   R6   RP   R0   Rp   (   R   R@   RR   (    (    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_subprocess.pyR2  C  s    
		c         C   sm   t  j j ƒ  } d | d <t j d d d d t j d | ƒ} |  j | j j ƒ |  j	 d | j j
 ƒ  ƒ d  S(   NR”  R;   R•  R!  i   R6   R<   (   R=   R>   R?   R   RE   RN   RO   R6   RP   R0   Rp   (   R   R@   RR   (    (    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_subprocess.pyR3  M  s    
		c         C   s*   t  j t j d ƒ } |  j | d ƒ d  S(   Ns    -c "import sys; sys.exit(47)"i/   (   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_subprocess.pyR4  W  s    
c         G   sÔ   t  j t j d d g d t  j d t  j d t  j ƒ} |  j | j j ƒ |  j | j j ƒ |  j | j	 j ƒ | j j
 d ƒ t | | ƒ | Œ  | j ƒ  \ } } |  j | d ƒ | j ƒ  } |  j | d ƒ d  S(	   Ns   -csâ   if 1:
                             import sys, time
                             sys.stdout.write('x\n')
                             sys.stdout.flush()
                             time.sleep(30)
                             RQ   R6   R   i   R   i    (   R   RE   R"   R#   RN   RO   R6   RP   R   RQ   Rp   R?  RU   R   R	   RH  (   R   R@  R   RR   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_subprocess.pyRA  ]  s    			c         G   sá   t  j t j d d g d t  j d t  j d t  j ƒ} |  j | j j ƒ |  j | j j ƒ |  j | j	 j ƒ | j j
 d ƒ t j d ƒ t | | ƒ | Œ  | j ƒ  \ } } |  j | d ƒ | j ƒ  } |  j | d ƒ d  S(	   Ns   -csà   if 1:
                             import sys, time
                             sys.stdout.write('x\n')
                             sys.stdout.flush()
                             sys.exit(42)
                             RQ   R6   R   i   R   i*   (   R   RE   R"   R#   RN   RO   R6   RP   R   RQ   Rp   RÅ   RÆ   R?  RU   R   R	   R   (   R   R@  R   RR   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_subprocess.pyRD  t  s    			c         C   s   |  j  d t j ƒ d  S(   NRE  (   RA  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_subprocess.pyRI  �  s    c         C   s   |  j  d ƒ d  S(   NRJ  (   RA  (   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_subprocess.pyRL  �  s    c         C   s   |  j  d ƒ d  S(   NRM  (   RA  (   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_subprocess.pyRO  “  s    c         C   s   |  j  d t j ƒ d  S(   NRE  (   RD  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_subprocess.pyRP  –  s    c         C   s   |  j  d ƒ d  S(   NRJ  (   RD  (   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_subprocess.pyRQ  ™  s    c         C   s   |  j  d ƒ d  S(   NRM  (   RD  (   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_subprocess.pyRR  œ  s    (   R   R   R�  R’  RM   R“  R2  R3  R4  RA  RD  RI  RL  RO  RP  RQ  RR  (    (    (    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_subprocess.pyRŠ    s   					
	
								t	   _has_polls   poll system call not supportedt   ProcessTestCaseNoPollc           B   s   e  Z d  „  Z d „  Z RS(   c         C   s   t  t _ 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_subprocess.pyR   £  s    	c         C   s   t  t _ t j |  ƒ d  S(   N(   R9  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_subprocess.pyR   §  s    	(   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_subprocess.pyR—     s   	t   HelperFunctionTestsc           B   s#   e  Z e j e d  ƒ d „  ƒ Z RS(   s(   errno and EINTR make no sense on windowsc            s€   g  ‰  ‡  f d †  } |  j  d t j | d d ƒ ƒ |  j  d g ˆ  ƒ |  j  d t j | d ƒ ƒ |  j  d d	 d
 g ˆ  ƒ d  S(   Nc             sD   ˆ  j  |  ƒ t ˆ  ƒ d k r4 t t j d ƒ ‚ n  t t |  ƒ ƒ S(   Ni   s   fake interrupted system call(   R¯   R‘   R´   Rµ   t   EINTRt   tuplet   reversed(   R   (   t   record_calls(    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_subprocess.pyt   fake_os_func°  s    iç  i   iš  (   iç  i   (   i   iç  (   iš  (   i   iç  (   iš  (   iš  (   R   R   t   _eintr_retry_call(   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_subprocess.pyt   test_eintr_retry_call­  s    		(   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_subprocess.pyR˜  ¬  s   s   mswindows onlyt   CommandsWithSpacesc           B   sG   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s[   t  t |  ƒ j ƒ  t j d d ƒ \ } } | j ƒ  |  _ t j | d ƒ t j	 | ƒ d  S(   Ns   .pys   te stsV   import sys;sys.stdout.write('%d %s' % (len(sys.argv), [a.lower () for a in sys.argv]))(
   t   superR   R   Rf   Rß   t   lowerR0  R=   Rd   RP   (   R   R/  R0  (    (    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_subprocess.pyR   Á  s
    c         C   s'   t  j |  j ƒ t t |  ƒ j ƒ  d  S(   N(   R=   Rà   R0  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_subprocess.pyR   Ê  s    c         O   s_   t  j | d <t  j | | Ž  } |  j | j j ƒ |  j | j j ƒ  j d ƒ d |  j	 ƒ d  S(   NR6   t   mbcss   2 [%r, 'ab cd'](
   R   RN   RE   RO   R6   RP   R   Rp   t   decodeR0  (   R   R   R   RR   (    (    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_subprocess.pyt   with_spacesÎ  s    c         C   s*   |  j  d t j |  j d f d d ƒd  S(   Ns   "%s" "%s" "%s"s   ab cdR!  i   (   R¥  R"   R#   R0  (   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_subprocess.pyt   test_shell_string_with_spaces×  s    c         C   s&   |  j  t j |  j d g d d ƒd  S(   Ns   ab cdR!  i   (   R¥  R"   R#   R0  (   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_subprocess.pyt   test_shell_sequence_with_spacesÜ  s    c         C   s$   |  j  d t j |  j d f ƒ d  S(   Ns   "%s" "%s" "%s"s   ab cd(   R¥  R"   R#   R0  (   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_subprocess.pyt   test_noshell_string_with_spacesà  s    c         C   s    |  j  t j |  j d g ƒ d  S(   Ns   ab cd(   R¥  R"   R#   R0  (   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_subprocess.pyt!   test_noshell_sequence_with_spaceså  s    (	   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_subprocess.pyR   ¾  s   								c          C   s3   t  t t t t t f }  t j |  Œ  t j ƒ  d  S(   N(	   R    R  RŠ  R—  R˜  R   R    t   run_unittestR   (   t
   unit_tests(    (    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_subprocess.pyt	   test_mainé  s    	t   __main__(+   Rî   t   testR    R   R"   Rþ   R  R=   Rµ   Rf   RÅ   R   Rð   t   textwrapt   ctypest   ImportErrorR   t   ctypes.utilRø   RÖ   R†  Rœ   R¨   t   TestCaseR   t	   ExceptionR   RE   R   R    t   objectRô   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_subprocess.pyt   <module>   sl   



	ÿ ÿ É;ÿ Á‰	
*	