<commit_before>*** Settings ***
Documentation     This resource file contains, or imports, all general variables and keywords used by the running side of Robot Framework acceptance tests.
Library           OperatingSystem
Library           Process
Library           Collections
Library           String
Library           TestCheckerLibrary
Library           TestHelper
Library           XML
Library           read_interpreter.py
Variables         atest_variables.py

*** Variables ***
${OUTDIR}         %{TEMPDIR}/output
${OUTFILE}        ${OUTDIR}${/}output.xml
${SET SYSLOG}     True
${SYSLOG FILE}    ${OUTDIR}${/}syslog.txt
${SYSLOG LEVEL}   INFO
${STDOUT FILE}    ${OUTDIR}${/}stdout.txt
${STDERR FILE}    ${OUTDIR}${/}stderr.txt
${OUTFILE COPY}   %{TEMPDIR}/output-copy.xml
${SUITE}          Set by TestCheckerLibrary.Process Output
${ERRORS}         -- ;; --
${USAGE_TIP}      \n\nTry --help for usage information.
${TESTNAME}       ${EMPTY}    # Used when not running test
${COMMON DEFAULTS}
...               --ConsoleColors OFF
...               --output ${OUTFILE}
...               --report NONE
...               --log NONE
${RUNNER DEFAULTS}
...               --ConsoleMarkers OFF
...               --PYTHONPATH "${CURDIR}${/}..${/}testresources${/}testlibs"
...               --PYTHONPATH "${CURDIR}${/}..${/}testresources${/}listeners"

*** Keywords ***
Run Tests
    [Arguments]    ${options}=    ${sources}=    ${output}=${OUTFILE}    ${default options}=TRUE
    [Documentation]    *OUTDIR:* file://${OUTDIR} (regenerated for every run)
    @{arguments} =    Get Execution Arguments    ${options}    ${sources}    ${default options}    ${RUNNER DEFAULTS}
    ${result} =    Execute    @{INTERPRETER.runner}    @{arguments}
    Process Output    ${output}
    Log Many    RC: ${result.rc}    STDERR:\n${result.stderr}    STDOUT:\n${result.stdout}
    [Return]    ${result}

Run Tests Without Processing Output
    [Arguments]    ${options}=    ${sources}=
    ${result} =    Run Tests    ${options}    ${sources}    output=NONE
    [Return]    ${result}

Run Tests Without Defaults
    [Arguments]    ${options}=    ${sources}=
    ${result} =    Run Tests    ${options}    ${sources}    output=NONE    default options=FALSE
    [Return]    ${result}

Run Rebot
    [Arguments]    ${options}=    ${sources}=    ${output}=${OUTFILE}    ${default options}=True
    [Documentation]    *OUTDIR:* file://${OUTDIR} (regenerated for every run)
    @{arguments} =    Get Execution Arguments    ${options}    ${sources}    ${default options}
    ${result} =    Execute    @{INTERPRETER.rebot}    @{arguments}
    Process Output    ${output}
    Log Many    RC: ${result.rc}    STDERR:\n${result.stderr}    STDOUT:\n${result.stdout}
    [Return]    ${result}

Run Rebot Without Processing Output
    [Arguments]    ${options}=    ${sources}=
    ${result} =    Run Rebot    ${options}    ${sources}    output=NONE
    [Return]    ${result}

Run Rebot Without Defaults
    [Arguments]    ${options}=    ${sources}=
    ${result} =    Run Rebot    ${options}    ${sources}    output=NONE    default options=FALSE
    [Return]    ${result}

Get Execution Arguments
    [Arguments]    ${options}    ${sources}    ${use defaults}    ${extra defaults}=
    ${use defaults} =    Convert To Boolean    ${use defaults}
    ${defaults} =    Set Variable If    ${use defaults}    ${COMMON DEFAULTS} ${extra defaults}    ${EMPTY}
    @{options} =    Command line to list    --outputdir ${OUTDIR} ${defaults} ${options}
    @{sources} =    Command line to list    ${sources}
    @{sources} =    Join Paths    ${DATADIR}    @{sources}
    [Return]    @{options}    @{sources}

Execute
    [Arguments]    @{command}
    Set Execution Environment
    ${result} =    Run Process    @{command}    stdout=${STDOUTFILE}    stderr=${STDERRFILE}
    ...    timeout=5min    on_timeout=terminate
    [Return]    ${result}

Set Execution Environment<commit_msg>atests: Refactoring "Run Tests/Rebot (Without ...)". #2091<commit_after>*** Settings ***
Documentation     This resource file contains, or imports, all general variables and keywords used by the running side of Robot Framework acceptance tests.
Library           OperatingSystem
Library           Process
Library           Collections
Library           String
Library           TestCheckerLibrary
Library           TestHelper
Library           XML
Library           read_interpreter.py
Variables         atest_variables.py

*** Variables ***
${OUTDIR}         %{TEMPDIR}/output
${OUTFILE}        ${OUTDIR}${/}output.xml
${SET SYSLOG}     True
${SYSLOG FILE}    ${OUTDIR}${/}syslog.txt
${SYSLOG LEVEL}   INFO
${STDOUT FILE}    ${OUTDIR}${/}stdout.txt
${STDERR FILE}    ${OUTDIR}${/}stderr.txt
${OUTFILE COPY}   %{TEMPDIR}/output-copy.xml
${SUITE}          Set by TestCheckerLibrary.Process Output
${ERRORS}         -- ;; --
${USAGE_TIP}      \n\nTry --help for usage information.
${TESTNAME}       ${EMPTY}    # Used when not running test
${COMMON DEFAULTS}
...               --ConsoleColors OFF
...               --output ${OUTFILE}
...               --report NONE
...               --log NONE
${RUNNER DEFAULTS}
...               ${COMMON DEFAULTS}
...               --ConsoleMarkers OFF
...               --PYTHONPATH "${CURDIR}${/}..${/}testresources${/}testlibs"
...               --PYTHONPATH "${CURDIR}${/}..${/}testresources${/}listeners"

*** Keywords ***
Run Tests
    [Arguments]    ${options}=    ${sources}=    ${output}=${OUTFILE}
    [Documentation]    *OUTDIR:* file://${OUTDIR} (regenerated for every run)
    ${result} =    Execute    ${INTERPRETER.runner}   ${options}    ${sources}    ${RUNNER DEFAULTS}
    Log Many    RC: ${result.rc}    STDERR:\n${result.stderr}    STDOUT:\n${result.stdout}
    Process Output    ${output}
    [Return]    ${result}

Run Tests Without Processing Output
    [Arguments]    ${options}=    ${sources}=
    [Documentation]    *OUTDIR:* file://${OUTDIR} (regenerated for every run)
    ${result} =    Execute    ${INTERPRETER.runner}   ${options}    ${sources}    ${RUNNER DEFAULTS}
    Log Many    RC: ${result.rc}    STDERR:\n${result.stderr}    STDOUT:\n${result.stdout}
    [Return]    ${result}

Run Tests Without Defaults
    [Arguments]    ${options}=    ${sources}=
    [Documentation]    *OUTDIR:* file://${OUTDIR} (regenerated for every run)
    ${result} =    Execute    ${INTERPRETER.runner}   ${options}    ${sources}    defaults=${EMPTY}
    Log Many    RC: ${result.rc}    STDERR:\n${result.stderr}    STDOUT:\n${result.stdout}
    [Return]    ${result}

Run Rebot
    [Arguments]    ${options}=    ${sources}=    ${output}=${OUTFILE}
    [Documentation]    *OUTDIR:* file://${OUTDIR} (regenerated for every run)
    ${result} =    Execute    ${INTERPRETER.rebot}   ${options}    ${sources}
    Log Many    RC: ${result.rc}    STDERR:\n${result.stderr}    STDOUT:\n${result.stdout}
    Process Output    ${output}
    [Return]    ${result}

Run Rebot Without Processing Output
    [Arguments]    ${options}=    ${sources}=
    [Documentation]    *OUTDIR:* file://${OUTDIR} (regenerated for every run)
    ${result} =    Execute    ${INTERPRETER.rebot}   ${options}    ${sources}
    Log Many    RC: ${result.rc}    STDERR:\n${result.stderr}    STDOUT:\n${result.stdout}
    [Return]    ${result}

Run Rebot Without Defaults
    [Arguments]    ${options}=    ${sources}=
    [Documentation]    *OUTDIR:* file://${OUTDIR} (regenerated for every run)
    ${result} =    Execute    ${INTERPRETER.rebot}   ${options}    ${sources}    defaults=${EMPTY}
    Log Many    RC: ${result.rc}    STDERR:\n${result.stderr}    STDOUT:\n${result.stdout}
    [Return]    ${result}

Execute
    [Arguments]    ${executor}    ${options}    ${sources}    ${defaults}=${COMMON DEFAULTS}
    Set Execution Environment
    @{arguments} =    Get Execution Arguments    ${options}    ${sources}    ${defaults}
    ${result} =    Run Process    @{executor}    @{arguments}
    ...    stdout=${STDOUTFILE}    stderr=${STDERRFILE}    timeout=5min    on_timeout=terminate
    [Return]    ${result}

Get Execution Arguments
    [Arguments]    ${options}    ${sources}    ${defaults}
    @{options} =    Command line to list    --outputdir ${OUTDIR} ${defaults} ${options}
    @{sources} =    Command line to list    ${sources}
    @{sources} =    Join Paths    ${DATADIR}    @{sources}
    [Return]    @{options}    @{sources}

Set Execution Environment
{'fraction_non_alphanumeric': 0.15441176470588236, 'fraction_numerical': 0.0007115749525616698, 'mean_word_length': 2.5373322147651005, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4211156', 'n_tokens_mistral': 2550, 'n_tokens_neox': 2495, 'n_words': 661}