HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/samba/tests/__pycache__/usage.cpython-310.pyc
o

eF�c�3�@szddlZddlZddlZddlmZmZddlmZddlZddl	Z	dej
vr-ej
dZnej�
ej�ej�e�d��Zgd�Zhd�Zhd�Zhd	�Zd
d�Ze�Zedddefdd
�Zdd�Zdd�ZiZdd�Ze�d�jZiZdd�Z e�d�jZ!iZ"dd�Z#Gdd�de�Z$Gdd�de�Z%Gdd�de�Z&Gd d!�d!e&�Z'Gd"d#�d#e&�Z(e$�)�e%�)�e'�)�e(�)�dS)$�N)�TestCase�check_help_consistency)�	TestSuite�
SRCDIR_ABSz../../..)�	bootstrap�testdata�ctdb�
dfs_server�pidl�auth�	packaging�python�include�nsswitch�libcli�coverityzrelease-scripts�	testprogs�bin�source3zdocs-xml�
buildtools�file_server�	dynconfig�source4�tests�libds�selftest�lib�script�traffic�	testsuite�libgpo�wintest�librpc>/�bin/gen_output.py�selftest/tests.py�buildtools/bin/waf�script/autobuild.py�script/bisect-test.py�script/show_test_time�bin/samba_downgrade_db�selftest/filter-subunit�selftest/format-subunit�source3/selftest/tests.py�source4/selftest/tests.py�lib/ldb/tests/python/api.py�python/samba/subunit/run.py�lib/ldb/tests/python/index.py�ctdb/utils/etcd/ctdb_etcd_lock�bin/python/samba/subunit/run.py� python/samba/tests/smb-notify.py� source4/scripting/bin/subunitrun�"python/samba/tests/krb5/kcrypto.py�#python/samba/tests/krb5/test_rpc.py�#python/samba/tests/krb5/test_smb.py�#source4/scripting/bin/gen_output.py�$python/samba/tests/krb5/kdc_tests.py�$python/samba/tests/krb5/s4u_tests.py�$python/samba/tests/krb5/spn_tests.py�$python/samba/tests/krb5/test_ldap.py�%python/samba/tests/krb5/fast_tests.py�%python/samba/tests/krb5/rodc_tests.py�%python/samba/tests/krb5/salt_tests.py�&python/samba/tests/krb5/alias_tests.py�&python/samba/tests/krb5/etype_tests.py�&python/samba/tests/krb5/test_ccache.py�'python/samba/tests/krb5/as_req_tests.py�'python/samba/tests/krb5/simple_tests.py�'python/samba/tests/krb5/xrealm_tests.py�(python/samba/tests/krb5/kdc_base_test.py�(python/samba/tests/krb5/kdc_tgs_tests.py�(python/samba/tests/krb5/kpasswd_tests.py�(source4/scripting/bin/samba_downgrade_db�)python/samba/tests/dcerpc/raw_protocol.py�)python/samba/tests/krb5/test_idmap_nss.py�,python/samba/tests/krb5/rfc4120_constants.py�.python/samba/tests/krb5/compatability_tests.py�.python/samba/tests/krb5/test_min_domain_uid.py�4python/samba/tests/krb5/as_canonicalization_tests.py�@python/samba/tests/krb5/ms_kile_client_principal_lookup_tests.py�selftest/tap2subunit>�wintest/test-s3.py�wintest/test-s4-howto.pyrQ>�bin/ab�python/examples�source3/script/tests�bin/python/samba/tests�source4/dsdb/tests/python�bin/python/samba/tests/krb5�bin/python/samba/tests/dcerpcc	Cs\t�}tjddtddgtjd�}|jdkr+|j�d�D]}|�t	j
�t|�d���q|j
S)	zUGenerate a function that quickly answers the question:
    'is this a git file?'
    �gitz-Czls-filesz-z)�stdoutr��utf-8)�set�
subprocess�run�BASEDIR�PIPE�
returncoder\�split�add�os�path�join�decode�__contains__)�git_file_cache�p�fn�ro�3/usr/lib/python3/dist-packages/samba/tests/usage.py�_init_git_file_finder�s��
rqc
Cs`|s�t�d�j}|D]�}tj�||�}tj|dd�D]�\}}	}
|
D]�}|�d�r)q!|�d�r/q!tj�||�}zt�|�}
Wn	t	yFYq!w|
j
tj@sNq!|dksWt|�sWq!|dur`||�s`q!|dur�zt
|d�}Wnty�}ztd||f�WYd}~q!d}~ww|�d	�}|��||�s�q!|d
|�}||vr�|d
7}||vs�|||<q!qq
|��S)Nz\W+F)�followlinks�~z.instr�rbzcould not open %s: %s�(�_)�re�compile�subrgrhri�walk�endswith�stat�FileNotFoundError�st_mode�S_IXUSR�is_git_file�open�OSError�print�read�close�items)�d�cache�shebang_filter�filename_filter�subdirs�safename�subdir�sd�root�dirs�filesrn�ffn�s�f�e�line�namerororp�script_iterator�sV

���

�
��$r�cCs*|�d�d}|od|vod|vod|vS)Nzbin/��/�test�ldb)�	partition)rnrororp�
elf_file_name�sr�cCs|dd�dkS)N�sELFro)�xrororp�elf_shebang�sr�cCstttttdgd�S)Nr)r�r�r�)r�rb�	elf_cacher�r�rorororp�elf_iterator�s
�r�s#!.+perlcC�tttt�S�N)r�rb�perl_script_cache�perl_shebangrorororp�perl_script_iterator��r�s
#!.+pythoncCr�r�)r�rb�python_script_cache�python_shebangrorororp�python_script_iterator�r�r�c@�eZdZdZedd��ZdS)�PerlScriptUsageTestszgPerl scripts run without arguments should print a usage string,
        not fail with a traceback.
    cCst�D]	\}}t||�qdSr�)r�r�)�clsr��filenamerororp�
initialise�s�zPerlScriptUsageTests.initialiseN��__name__�
__module__�__qualname__�__doc__�classmethodr�rorororpr���r�c@r�)�PythonScriptUsageTestsziPython scripts run without arguments should print a usage string,
        not fail with a traceback.
    cCsvt�D]5\}}|�td��d�}|tvrtd|�qtj�|�t	vr*td|�q|fdd�}t
|d||�qdS)N�r�zskipping %s (EXCLUDE_USAGE)�skipping %s (EXCLUDE_DIRS)c
Ss�t|�ztjd|gtjtjd�}|jdd�\}}Wn2ty3}z
|�d|�WYd}~nd}~wtjyL}z
|�d|�WYd}~nd}~ww|�d�}|�d�}|�	d|�|�
d	|��|��d
||f�dS)N�python3��stderrr\���timeout�	Error: %s�Subprocess error: %sr^�	Traceback�usagezstdout:
%s
stderr:
%s)r�r`�Popenrc�communicater��fail�SubprocessErrorrj�assertNotIn�assertIn�lower)�selfr�rm�out�errr�rororp�_fs(
����


�z-PythonScriptUsageTests.initialise.<locals>._f�test_%s)r��replacerb�lstrip�
EXCLUDE_USAGEr�rgrh�dirname�EXCLUDE_DIRS�setattr�r�r�r�rnr�rororpr��s�z!PythonScriptUsageTests.initialiseNr�rorororpr��r�r�c@sDeZdZdZdZdZdZdZdZdZ	dZ
dZdd�Ze
dd��ZdS)	�
HelpTestSuper�`Python scripts run with -h or --help should print a help string,
    and exit with success.
    TFNcCstd��)Nz+Subclass this and add an iterator function!)�NotImplementedError)r�rororp�iterator)szHelpTestSuper.iteratorcCsx|��D]5\}}|�td��d�}|tvrtd|�qtj�|�t	vr+td|�q|fdd�}t
|d||�qdS)Nr�r�zskipping %s (EXCLUDE_HELP)r�c
Sslt|�dD]�}||g}|jr|�d|j�ztj|tjtjd�}|jdd�\}}Wn2tyC}z
|�d|�WYd}~nd}~wtj	y\}z
|�d|�WYd}~nd}~ww|�
d�}|�
d�}|jrpd	||f}|dd
���}|j
r�t||j|j�}	|	dur�|�|	�|jr�|�|jdd|||j||f�|jr�|�d|d
�|jr�|�d|d�qdS)N)z--helpz-hrr�r�r�r�r�r^z%s
%si�z1%s %s
returncode should not be %d
err:
%s
out:
%sr�zlacks "Usage:"
�
zexpected multi-line output)r��interpreter�insertr`r�rcr�r�r�r�rj�check_merged_out_and_errr��check_consistencyr�
options_start�options_end�check_return_code�assertEqualrd�check_contains_usager��check_multiline)
r�r��h�cmdrmr�r�r��outl�errorsrororpr�=sT����

�

����z$HelpTestSuper.initialise.<locals>._fr�)r�r�rbr��EXCLUDE_HELPr�rgrhr�r�r�r�rororpr�-s4�zHelpTestSuper.initialise)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rorororpr�sr�c@seZdZdZeZdZdS)�PythonScriptHelpTestsr�r�N)r�r�r�r�r�r�r�rorororpr�tsr�c@seZdZdZeZdZdZdS)�ElfHelpTestsz^ELF binaries run with -h or --help should print a help string,
    and exit with success.
    FTN)r�r�r�r�r�r�r�r�rorororpr�|s
r�)*rg�sysr`�samba.testsrr�unittestrrwr|�environrbrh�abspathrir��__file__�	TEST_DIRSr�r�r�rqr�r�r�r�r�r�rx�matchr�r�r�r�r�r�r�r�r�r�r�r�rorororp�<module>sT
�#2
�/+Y