
    daf                     <   d dl Z d dlZd dlmZ d dlmZ d dlZd dlZ ed      Z ed      Z	 ee	d       	  e
dd      Ze5  ej                  ee	j                  d	      Zddd        ej                  d
e      d    Ze ej"                          ej$                  d       fvr ej&                  d      [[[	 d dlZ G d dej.                        Zedk(  r ej4                          yy# 1 sw Y   xY w# e$ r  ej&                  d      w xY w# e$ r dZY ]w xY w)    N)get_attribute)import_modulefcntltermios	TIOCGPGRP/dev/ttyrb    izBNeither the process group nor the session are attached to /dev/ttyzUnable to open /dev/ttyc                   2    e Zd Zd ZddZd Zd Zd Zd Zy)	
IoctlTestsc                 8   t        j                         t        j                  d      f}t        dd      5 }t        j                  |t        j                  d      }t        j                  d|      d   }| j                  ||       d d d        y # 1 sw Y   y xY w)Nr   r   r	   r
   r   )osgetpgrpgetsidopenr   ioctlr   r   structunpackassertIn)selfidsttyrrpgrps        */root/Python-3.12.4/Lib/test/test_ioctl.py
test_ioctlzIoctlTests.test_ioctl   sx     zz|RYYq\**d# 	&sC!2!2F;AMM#q)!,EMM%%	& 	& 	&s   ABBNc                    t        j                   d      }|j                  }t        j                         t        j                  d      f}d}|7|j                  |g||z  z         | j                  t        |      |z  |       n|j                  |       t        dd      5 }t        j                  |t        j                  |d      }d d d        |d   }| j                  d       | j                  ||       y # 1 sw Y   3xY w)Nr   r   ir   r	   T)arrayitemsizer   r   r   extendassertEquallenappendr   r   r   r   r   r   )	r   nbytesbufintsizer   fillr   r   r   s	            r   _check_ioctl_mutate_lenz"IoctlTests._check_ioctl_mutate_len'   s    kk#,,zz|RYYq\*JJv7!234SX/8JJt*d# 	?sC!2!2C>A	?AAeS!		? 	?s   #'C<<Dc                 $    | j                          y Nr)   r   s    r   test_ioctl_mutatezIoctlTests.test_ioctl_mutate9   s    $$&    c                 &    | j                  d       y )Ni   r,   r-   s    r   test_ioctl_mutate_1024z!IoctlTests.test_ioctl_mutate_1024<   s     	$$T*r/   c                 &    | j                  d       y )Ni   r,   r-   s    r   test_ioctl_mutate_2048z!IoctlTests.test_ioctl_mutate_2048A   s    $$T*r/   c                    t         st        j                  d      t        j                         \  }}	 t        j
                  dk  r$t        j
                  }t        j
                  dz  }nJt        j
                  }t        j                  dt        j                  dt        j
                              \  }t        j                  ddddd      }t        j                  |||      }t        j                  |||      }t        j                  |       t        j                  |       y # t        j                  |       t        j                  |       w xY w)	Nzpty module requiredr   l    r   IHHHHP      )ptyunittestSkipTestopenptyr   
TIOCSWINSZr   r   packr   r   r   close)r   mfdsfdset_winsz_opcode_maybe_negset_winsz_opcode_pos	our_winsz	new_winszs          r   %test_ioctl_signed_unsigned_code_paramz0IoctlTests.test_ioctl_signed_unsigned_code_paramE   s    ##$9::;;=S	!!A%-4-?-?*'.'9'9J'F$'.'9'9$.4mmCC););</>+* F2b15IC)=yIIC)CYOIHHSMHHSM HHSMHHSMs   CD' ',Er+   )	__name__
__module____qualname__r   r)   r.   r1   r3   rF    r/   r   r   r      s     &"$'+
+r/   r   __main__)r   r:   test.supportr   test.support.import_helperr   r   r   r   r   r   r   r   r   r   r   r   r   r   r;   OSErrorr9   ImportErrorTestCaser   rG   mainrJ   r/   r   <module>rR      s=     & 4 g
	
" g{ #
z4
 C 
 8KKW..78 FMM#q!!$EZRZZ\9299Q<00h !; < 	<Q;"" ;| zHMMO Y8 8  7
(

5
667  
Cs)   	C6 C*9D *C36DDD