a
    xþd"*  ã                   @   sŒ   d dl Z d dlZd dlZd dlZd dlZd dlZd dlZejG dd„ dej	ƒƒZ
dd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Zdd„ Zdd„ ZdS )é    Nc                   @   s   e Zd ZdZdZdZdS )Ú	TestOrderZlexicalÚrandomZsmartN)Ú__name__Ú
__module__Ú__qualname__ZLEXICALÚRANDOMÚSMART© r	   r	   úY/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/lit/cl_arguments.pyr      s   r   c            
   
   C   s²  t jddd} | jddddd | jd	d
dtj d | jddddddttj ¡ d | jddddd | jddddddg d |  d ¡}|jd!d"d#d$d% |jd&d'd(d$d% |jd)d*d+d,d$d- |jd.d/d0d$d1d2 |jd3d4d5d6d$d- |jd7d8tj	j
d9d:d; |jd<d=d>d?d- d@dA„ tjj ¡ D ƒ}|D ]8}|jdB |j ¡ ¡dCdD |j ¡ |j¡dE|g dF q.|  dG¡}|jdHdIdg tjjdJ |jdKdLdMd$d- |jdNdOdPd$d- |jdQdRdSdTdg d |jdUdVd$d% |jdWdXdYd$d- |jdZtj	jd[d\ |jd]tj	jd^d\ |jd_tj	jd`d\ |jdadbdctdd |jdedftdg |jdhdid$d% |jdjdkd$dld2 |jdmdndod?d- |  dp¡}|jdqddrtds |jdtduddvtdw |jdxdydA„ tD ƒtjdzd{ |jd|d}d~dtjd€ |jdd‚dƒd$d% |jd„d…td†tj d‡dˆ¡d‰ |jdŠd…td‹tj dŒd¡d‰ |jdŽdtdtj d‘d’¡d‰ |jd“dtd”tj d•d’¡d‰ |jd–d—d˜d™ttj dš¡d |jd›dœddttj dž¡d |  dŸ¡}|jd d¡d$d% |jd¢d£d$d% |jd¤d¥d$d% |jd¦d§d$d% t  !tj d¨d’¡¡}t"j#d©d … | }|  $|¡}	|	j%r*dª|	_&|	j'r:t(d«ƒ |	j)sJ|	j*rŒ|	j)rZ|	j*sd|  +d¬¡ |	j*|	j)kr||  +d­¡ |	j*|	j)f|	_,nd |	_,t-d |	j.|	j/|	j0|	j1gƒ|	_	|	S )®NÚlitú@)ÚprogÚfromfile_prefix_charsZ
test_pathsú+Z	TEST_PATHz)File or path to include in the test suite)ÚnargsÚmetavarÚhelpz	--versionÚversionz	%(prog)s )Úactionr   z-jz	--threadsz	--workersÚworkersÚNz"Number of workers used for testing)Údestr   r   ÚtypeÚdefaultz--config-prefixZconfigPrefixÚNAMEzPrefix for 'lit' config files)r   r   r   z-Dz--paramZuser_paramszNAME=VALz1Add 'NAME' = 'VAL' to the user defined parametersÚappend)r   r   r   r   r   zOutput Formatz-qz--quietzSuppress no error outputÚ
store_true)r   r   z-sz
--succinctzbReduce amount of output. Additionally, show a progress bar, unless --no-progress-bar is specified.z-vz	--verboseÚ
showOutputzShow test output for failures)r   r   r   z-vvz--echo-all-commandsÚechoAllCommandszqEcho all commands as they are executed to stdout. In case of failure, last command shown will be the failing one.)r   r   r   z-az
--show-allZshowAllOutputz#Display all commandlines and outputz-oz--outputz'Write test results to the provided pathÚPATH)r   r   r   z--no-progress-barZuseProgressBarz$Do not use curses based progress barÚstore_falsec                 S   s   g | ]}|j s|‘qS r	   )Z	isFailure)Ú.0Úcr	   r	   r
   Ú
<listcomp>P   s   ÿzparse_args.<locals>.<listcomp>z	--show-{}Zshown_codeszShow {} tests ({})Úappend_const)r   r   r   Úconstr   zTest Executionz--pathz.Additional paths to add to testing environment)r   r   r   r   z--vgZuseValgrindzRun tests under valgrindz	--vg-leakZvalgrindLeakCheckz%Check for memory leaks under valgrindz--vg-argZvalgrindArgsZARGz&Specify an extra argument for valgrindz--time-testsz%Track elapsed wall time for each testz--no-executeZ	noExecutez%Don't execute any tests (assume PASS)z--xunit-xml-outputz=Write XUnit-compatible XML test reports to the specified file)r   r   z--resultdb-outputz9Write LuCI ResuldDB compatible JSON to the specified filez--time-trace-outputz:Write Chrome tracing compatible JSON to the specified filez	--timeoutZmaxIndividualTestTimez]Maximum time to spend running a single test (in seconds). 0 means no time limit. [Default: 0])r   r   r   z--max-failuresz2Stop execution after the given number of failures.)r   r   z--allow-empty-runsz1Do not fail the run if all tests are filtered outz--ignore-failZ
ignoreFailz-Exit with status zero even if some tests failz--no-indirectly-run-checkZindirectlyRunCheckzDo not error if a test would not be run if the user had specified the containing directory instead of naming the test directly.zTest Selectionz--max-testszMaximum number of tests to run)r   r   r   z
--max-timeÚtimeoutz*Maximum time to spend testing (in seconds))r   r   r   r   z--orderc                 S   s   g | ]
}|j ‘qS r	   )Úvalue)r!   Úxr	   r	   r
   r#       ó    z"Test order to use (default: smart))Úchoicesr   r   z	--shuffleÚorderz:Run tests in random order (DEPRECATED: use --order=random)Ústore_const)r   r   r   r%   z-iz--incrementalz6Run failed tests first (DEPRECATED: use --order=smart)z--filterZREGEXz?Only run tests with paths matching the given regular expressionZ
LIT_FILTERz.*)r   r   r   r   z--filter-outzAFilter out tests with paths matching the given regular expressionZLIT_FILTER_OUTz^$z--xfailÚLISTz6XFAIL tests with paths in the semicolon separated listZ	LIT_XFAILÚ z--xfail-notz=do not XFAIL tests with paths in the semicolon separated listZLIT_XFAIL_NOTz--num-shardsÚ	numShardsÚMz.Split testsuite into M pieces and only run oneZLIT_NUM_SHARDSz--run-shardÚrunShardzRun shard #N of the testsuiteZLIT_RUN_SHARDzDebug and Experimental Optionsz--debugz(Enable debugging (for 'lit' development)z--show-suitesz$Show discovered test suites and exitz--show-testsz"Show all discovered tests and exitz--show-used-featureszVShow all features used in the test suite (in XFAIL, UNSUPPORTED and REQUIRES) and exitZLIT_OPTSé   TzIWARNING: --incremental is deprecated. Failing tests now always run first.z2--num-shards and --run-shard must be used togetherz:--run-shard must be between 1 and --num-shards (inclusive))2ÚargparseÚArgumentParserÚadd_argumentr   Ú__version__Ú_positive_intÚutilZusable_core_countÚadd_argument_groupZreportsZ
JsonReportZTestZ
ResultCodeZ	all_codesÚformatÚnameÚlowerÚlabelÚosÚpathÚabspathZXunitReportZResultDBReportZTimeTraceReportÚ_non_negative_intr   r   r   Ú_case_insensitive_regexÚenvironÚgetÚ_semicolon_listÚshlexÚsplitÚsysÚargvÚ
parse_argsr   r   ÚincrementalÚprintr/   r1   ÚerrorZshardÚfilterÚoutputZxunit_xml_outputZresultdb_outputZtime_trace_output)
ÚparserZformat_groupZsuccess_codesÚcodeZexecution_groupZselection_groupZdebug_groupZenv_argsÚargsÚoptsr	   r	   r
   rJ      sÞ   ýþ
ûýû
þüýýýýýú

üýýûþýþþþüþþýû
ýüýüþüüüü
û
û
þþþþ


rJ   c                 C   s   t | ddd„ ƒS )NZpositivec                 S   s   | dkS ©Nr   r	   ©Úir	   r	   r
   Ú<lambda>õ   r)   z_positive_int.<locals>.<lambda>©Ú_int©Úargr	   r	   r
   r7   ô   s    r7   c                 C   s   t | ddd„ ƒS )Nznon-negativec                 S   s   | dkS rT   r	   rU   r	   r	   r
   rW   ù   r)   z#_non_negative_int.<locals>.<lambda>rX   rZ   r	   r	   r
   rA   ø   s    rA   c                 C   sH   d}zt | ƒ}W n ty.   t||| ƒ‚Y n0 ||ƒsDt||| ƒ‚|S )Nz#requires {} integer, but found '{}')ÚintÚ
ValueErrorÚ_error)r[   ÚkindÚpredÚdescrV   r	   r	   r
   rY   ü   s    rY   c              
   C   sP   dd l }z| | |j¡W S  |jyJ } ztd| |ƒ‚W Y d }~n
d }~0 0 d S )Nr   z$invalid regular expression: '{}', {})ÚreÚcompileÚ
IGNORECASErM   r^   )r[   rb   Úreasonr	   r	   r
   rB     s
    rB   c                 C   s
   |   d¡S )Nú;)rG   rZ   r	   r	   r
   rE     s    rE   c                 G   s   | j |Ž }t |¡S )N)r:   r3   ÚArgumentTypeError)ra   rR   Úmsgr	   r	   r
   r^     s    
r^   )r3   Úenumr>   rF   rH   Zlit.reportsr   Zlit.utilÚuniqueÚEnumr   rJ   r7   rA   rY   rB   rE   r^   r	   r	   r	   r
   Ú<module>   s     c