ci: always cleanup idf copy in ci

This commit is contained in:
Fu Hanxi 2024-04-16 14:11:31 +02:00
parent b5607cf43c
commit a4f691b88a
No known key found for this signature in database
GPG Key ID: 19399699CF3C4B16
2 changed files with 11 additions and 3 deletions

View File

@ -194,8 +194,12 @@ build_clang_test_apps_esp32c6:
- ${IDF_PATH}/tools/ci/test_configure_ci_environment.sh
- cd ${IDF_PATH}/tools/test_build_system
- python ${IDF_PATH}/tools/ci/get_known_failure_cases_file.py
- pytest --parallel-count ${CI_NODE_TOTAL:-1} --parallel-index ${CI_NODE_INDEX:-1}
--work-dir ${CI_PROJECT_DIR}/test_build_system --junitxml=${CI_PROJECT_DIR}/XUNIT_RESULT.xml
- pytest
--cleanup-idf-copy
--parallel-count ${CI_NODE_TOTAL:-1}
--parallel-index ${CI_NODE_INDEX:-1}
--work-dir ${CI_PROJECT_DIR}/test_build_system
--junitxml ${CI_PROJECT_DIR}/XUNIT_RESULT.xml
--ignore-result-files ${KNOWN_FAILURE_CASES_FILE_NAME}
pytest_build_system:

View File

@ -31,7 +31,7 @@ def pytest_runtest_makereport(item: typing.Any, call: typing.Any) -> typing.Gene
def should_clean_test_dir(request: FixtureRequest) -> bool:
# Only remove the test directory if the test has passed
return getattr(request.node, 'passed', False)
return getattr(request.node, 'passed', False) or request.config.getoption('cleanup_idf_copy', False)
def pytest_addoption(parser: pytest.Parser) -> None:
@ -40,6 +40,10 @@ def pytest_addoption(parser: pytest.Parser) -> None:
help='Directory for temporary files. If not specified, an OS-specific '
'temporary directory will be used.'
)
parser.addoption(
'--cleanup-idf-copy', action='store_true',
help='Always clean up the IDF copy after the test. By default, the copy is cleaned up only if the test passes.'
)
@pytest.fixture(scope='session')