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_systemtap.cpython-34.pyo

�
g fs#�@s�ddlZddlZddlZddlZddlZddlmZmZmZdej	d�krej
d��ny7ejddgdejd	ej�j
�\ZZWn!ek
r�ej
d
��YnXdd�Zd
Zeed�\ZZedkr#ej
de��ndddd�Zdej	d�kroej	d�ZdejefZn
dejZdeefjd�ZGdd�d�ZGdd�dej�Zdd�Zedkr�e�ndS) �N)�run_unittest�TESTFN�unlinkz--with-systemtap�CONFIG_ARGSz*Python was not configured --with-systemtap�stapz-V�stdout�stderrzCouldn't find stap on the pathcCs[tjdddd|gdtjdtjdtj�}|jd|�\}}||fS)	Nr�-z-vvz-c�stdinrr�input)�
subprocess�Popen�PIPE�communicate)�script�cmd�p�out�err�r�8/opt/alt/python34/lib64/python3.4/test/test_systemtap.py�invoke_systemtap_scripts		rs.probe begin { println("hello world") exit () }�trueshello world
z1Test systemtap script did not run; stderr was: %scCsh|rdtj|f}ndtj|f}tjjdd�}|r[d||}nt||�S)Nz%s %sz%s -c %r�LD_LIBRARY_PATH�zenv LD_LIBRARY_PATH=%s )�sys�
executable�os�environ�getr)r�
pythoncode�
pythonfileZ	pythoncmdrrrr�invoke_python_under_systemtap2sr"z--enable-shared�
INSTSONAMEzprocess("%s").library("%s")z
process("%s")a�
probe %s.mark("function__entry") {
    filename = user_string($arg1);
    funcname = user_string($arg2);
    lineno = $arg3;

    printf("%%s => %%s in %%s:%%d\n", thread_indent(1), funcname, filename, lineno);
}

probe %s.mark("function__return") {
    filename = user_string($arg1);
    funcname = user_string($arg2);
    lineno = $arg3;

    printf("%%s <= %%s in %%s:%%d\n", thread_indent(-1), funcname, filename, lineno);
}
zutf-8c@s4eZdZdd�Zdd�Zdd�ZdS)�ErrorDumpercCs||_||_dS)N)rr)�selfrrrrr�__init__�s	zErrorDumper.__init__cCsdS)Nr)r%rrr�	__enter__�szErrorDumper.__enter__cCs5|r1tdtj��tdtj��ndS)Nz
stdout: %sz
stderr: %s)�printr�decoder)r%Ztype_�value�	tracebackrrr�__exit__�szErrorDumper.__exit__N)�__name__�
__module__�__qualname__r&r'r,rrrrr$sr$c@s^eZdZdd�Zdd�Zdd�Zejej	�dkd�d	d
��Z
dS)�SystemtapTestsc
CsRtddd�\}}t||��%|jd|�|jd|�WdQXdS)Ns2probe begin { println("hello from stap") exit () }r zprint('hello from python')shello from stapshello from python)r"r$�assertIn)r%rrrrr�test_invoking_python�sz#SystemtapTests.test_invoking_pythoncCsLtt�\}}t||��%|jd|dd||f�WdQXdS)Ns=> <module> in <string>:1�msgzstdout: %s
stderr: %s
)r"�hierarchy_scriptr$r1)r%rrrrr�test_function_entry�s
z"SystemtapTests.test_function_entrycCs�t}z�t|�t|d�}|jdjd��|j�ttd|�\}}|jd�}t	||��U|j
d||�|j
d||�|j
d||�|j
d||�WdQXWdt|�XdS)	N�wbu�
# Sample script with non-ASCII filename, for use by test_systemtap.py
# Implicitly UTF-8

def 文字化け():
    '''Function with non-ASCII identifier; I believe this reads "mojibake"'''
    print("hello world!")

文字化け()
zutf-8r!z=> <module> in %s:5u => 文字化け in %s:5u <= 文字化け in %s:7z<= <module> in %s:9)rr�open�write�encode�closer"r4r)r$r1)r%r!�frr�out_utf8rrr�test_function_encoding�s 
	
	z%SystemtapTests.test_function_encoding�asciiz-the test filename is not encodable with ASCIIcCs�td}z�t|�t|d�}|jdjd��|j�ttd|�\}}|jd�}t	||��U|j
d||�|j
d||�|j
d||�|j
d	||�WdQXWdt|�XdS)
Nu_☠.pyr6z{
def foo():
    '''Function with non-ASCII identifier; I believe this reads "mojibake"'''
    print("hello world!")

foo()
zutf-8r!z=> <module> in %s:2z => foo in %s:2z <= foo in %s:4z<= <module> in %s:6)rrr7r8r9r:r"r4r)r$r1)r%r!r;rrr<rrr�test_filename_encoding�s 


	z%SystemtapTests.test_filename_encodingN)r-r.r/r2r5r=�unittestZskipIfr�getfilesystemencodingr?rrrrr0�s

r0cCstt�dS)N)rr0rrrr�	test_main�srB�__main__) rr�	sysconfigrr@Ztest.supportrrr�get_config_varZSkipTestr
rr�_Zstap_version�OSErrorrZTRIVIAL_STAP_SCRIPTrrr"r#rZprobe_prefixr9r4r$ZTestCaser0rBr-rrrr�<module>s:	
$
 W