Skip to content

Commit fe4b401

Browse files
committed
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>
1 parent ebc9d02 commit fe4b401

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed

.gitlab/ci/host-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ test_tools:
228228
- pytest --noconftest test_idf_qemu.py --junitxml=${IDF_PATH}/XUNIT_IDF_PY_QEMU.xml || stat=1
229229
- cd ${IDF_PATH}/tools/test_mkdfu
230230
- pytest --noconftest test_mkdfu.py --junitxml=${IDF_PATH}/XUNIT_MKDFU.xml || stat=1
231+
- cd ${IDF_PATH}/tools/test_idf_size
232+
- pytest --noconftest test_idf_size.py --junitxml=${IDF_PATH}/XUNIT_IDF_SIZE.xml || stat=1
231233
- cd ${IDF_PATH}
232234
- shellcheck -s sh tools/detect_python.sh || stat=1
233235
- shellcheck -s bash tools/detect_python.sh || stat=1

.gitlab/ci/rules.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
- "tools/test_idf_py/**/*"
8787

8888
- "tools/idf_size.py"
89+
- "tools/test_idf_size/**/*"
8990

9091
- "tools/tools.json"
9192
- "tools/tools_schema.json"

tools/test_idf_size/pytest.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[pytest]
2+
addopts = -s -p no:pytest_embedded
3+
4+
# log related
5+
log_cli = True
6+
log_cli_level = INFO
7+
log_cli_format = %(asctime)s %(levelname)s %(message)s
8+
log_cli_date_format = %Y-%m-%d %H:%M:%S
9+
10+
## log all to `system-out` when case fail
11+
junit_logging = stdout
12+
junit_log_passing_tests = False
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env python
2+
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
3+
# SPDX-License-Identifier: Apache-2.0
4+
import logging
5+
import os
6+
import sys
7+
from pathlib import Path
8+
from subprocess import DEVNULL
9+
from subprocess import run
10+
11+
12+
def test_idf_size() -> None:
13+
# Simple test to make sure that the idf_size.py wrapper is compatible
14+
# with idf.py minimum required python version.
15+
logging.info('idf_size.py python compatibility check')
16+
idf_size_path = Path(os.environ['IDF_PATH']) / 'tools' / 'idf_size.py'
17+
run([sys.executable, idf_size_path, '--help'], stdout=DEVNULL, stderr=DEVNULL, check=True)

0 commit comments

Comments
 (0)