Your IP : 216.73.216.213


Current Path : /proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/test_ioctl.cpython-34.pyo

�
g f��@s}ddlZddlZddlmZmZmZddlZddlZed�Zed�Z	ee	d�ye
dd�ZWn!ek
r�ej
d��YnuXejee	jd	�Zej�ejd
e�dZeej�ejd�fkrej
d��n[[[yddlZWnek
rFdZYnXGdd
�d
ej�Zedkryej�ndS)�N)�run_unittest�
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)�
IoctlTestscCsutj�tjd�f}tdd��E}tj|tjd�}tj	d|�d}|j
||�WdQXdS)Nrz/dev/ttyrz    r	)�os�getpgrp�getsid�openr�ioctlrr�struct�unpack�assertIn)�self�ids�tty�r�rpgrp�r�4/opt/alt/python34/lib64/python3.4/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�}WdQX|d}|j|d�|j||�dS)Nr	ri90z/dev/ttyr�i���)�array�itemsizerrr
�extendZassertEqual�len�appendrrrrrr)	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��ntj�\}}z�tjdkrUtj}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.supportrrrrrrrrr�OSErrorr+rrrr-rrrr
r)�ImportErrorZTestCaser
r/�mainrrrr�<module>s.


!	
>