ci: add simple test for idf_size.py python compatibility

This adds a simple test that tries to run idf_size.py help and check
if the process does not exit with error. This is just to make sure
that idf_size.py can be used with minimum required python version.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata 2024-05-08 13:38:19 +02:00
parent 9fe4ceafc7
commit 9df59a2193
4 changed files with 32 additions and 0 deletions

View File

@ -228,6 +228,8 @@ test_tools:
- pytest --noconftest test_idf_qemu.py --junitxml=${IDF_PATH}/XUNIT_IDF_PY_QEMU.xml || stat=1
- cd ${IDF_PATH}/tools/test_mkdfu
- pytest --noconftest test_mkdfu.py --junitxml=${IDF_PATH}/XUNIT_MKDFU.xml || stat=1
- cd ${IDF_PATH}/tools/test_idf_size
- pytest --noconftest test_idf_size.py --junitxml=${IDF_PATH}/XUNIT_IDF_SIZE.xml || stat=1
- cd ${IDF_PATH}
- shellcheck -s sh tools/detect_python.sh || stat=1
- shellcheck -s bash tools/detect_python.sh || stat=1

View File

@ -86,6 +86,7 @@
- "tools/test_idf_py/**/*"
- "tools/idf_size.py"
- "tools/test_idf_size/**/*"
- "tools/tools.json"
- "tools/tools_schema.json"

View File

@ -0,0 +1,12 @@
[pytest]
addopts = -s -p no:pytest_embedded
# log related
log_cli = True
log_cli_level = INFO
log_cli_format = %(asctime)s %(levelname)s %(message)s
log_cli_date_format = %Y-%m-%d %H:%M:%S
## log all to `system-out` when case fail
junit_logging = stdout
junit_log_passing_tests = False

View File

@ -0,0 +1,17 @@
#!/usr/bin/env python
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import logging
import os
import sys
from pathlib import Path
from subprocess import DEVNULL
from subprocess import run
def test_idf_size() -> None:
# Simple test to make sure that the idf_size.py wrapper is compatible
# with idf.py minimum required python version.
logging.info('idf_size.py python compatibility check')
idf_size_path = Path(os.environ['IDF_PATH']) / 'tools' / 'idf_size.py'
run([sys.executable, idf_size_path, '--help'], stdout=DEVNULL, stderr=DEVNULL, check=True)