Your IP : 216.73.216.60


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_ioctl.cpython-35.opt-1.pyc



��Yf��@sqddlZddlZddlmZmZddlZddlZed�Zed�Zeed�ye	dd�Z
Wn!ek
r�ejd��YnrXej
e
ejd	�Ze
j�ejd
e�dZeej�ejd�fkr
ejd��[
[[yddlZWnek
r=dZYnXGdd
�d
ej�Zedkrmej�dS)�N)�
import_module�
get_attribute�fcntl�termios�	TIOCGPGRPz/dev/tty�rbzUnable to open /dev/ttyz    �izBNeither the process group nor the session are attached to /dev/ttyc@s[eZdZdd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�ZdS)�
IoctlTestscCsvtj�tjd�f}tdd��E}tj|tjd�}tj	d|�d}|j
||�WdQRXdS)Nrz/dev/ttyrz    r)�os�getpgrp�getsid�openr�ioctlrr�struct�unpack�assertIn)�self�ids�tty�r�rpgrp�r�4/opt/alt/python35/lib64/python3.5/test/test_ioctl.py�
test_ioctls
zIoctlTests.test_ioctlNc	Cs�tjd�}|j}tj�tjd�f}d}|dk	rz|j|g||�|jt|�||�n
|j|�t	dd��"}t
j|tj
|d�}WdQRX|d}|j|d�|j||�dS)Nrri90z/dev/ttyr�i���)�array�itemsizer
rr�extendZassertEqual�len�appendr
rrrrr)	r�nbytesZbufZintsizerZfillrrrrrr�_check_ioctl_mutate_len&s	
"
z"IoctlTests._check_ioctl_mutate_lencCs|j�dS)N)r!)rrrr�test_ioctl_mutate8szIoctlTests.test_ioctl_mutatecCs|jd�dS)Ni)r!)rrrr�test_ioctl_mutate_1024;sz!IoctlTests.test_ioctl_mutate_1024cCs|jd�dS)Ni)r!)rrrr�test_ioctl_mutate_2048@sz!IoctlTests.test_ioctl_mutate_2048cCs�tstjd��tj�\}}z�tjdkrRtj}tjd@}n-tj}tjdtjdtj��\}tjddddd�}t	j
|||�}t	j
|||�}Wdtj|�tj|�XdS)	Nzpty module requiredrl��r�IZHHHH�P�)
�pty�unittest�SkipTest�openptyrZ
TIOCSWINSZrrZpackrrr
�close)rZmfdZsfdZset_winsz_opcode_maybe_negZset_winsz_opcode_posZ	our_winszZ	new_winszrrr�%test_ioctl_signed_unsigned_code_paramDs			
z0IoctlTests.test_ioctl_signed_unsigned_code_param)	�__name__�
__module__�__qualname__rr!r"r#r$r-rrrrr	s	r	�__main__)rr)Ztest.supportrrr
rrrr
r�OSErrorr*rrrr,rrrrr(�ImportErrorZTestCaser	r.�mainrrrr�<module>s.


!	
>