mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
ci(tools): Avoiding full rebuilds where not needed to improve performance
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import logging
|
||||
@@ -8,7 +8,10 @@ import shutil
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from test_build_system_helpers import EnvDict, IdfPyFunc, append_to_file, replace_in_file
|
||||
from test_build_system_helpers import EnvDict
|
||||
from test_build_system_helpers import IdfPyFunc
|
||||
from test_build_system_helpers import append_to_file
|
||||
from test_build_system_helpers import replace_in_file
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('test_app_copy')
|
||||
@@ -30,15 +33,21 @@ def test_partition_nearly_full_warning(idf_py: IdfPyFunc, test_app_copy: Path, d
|
||||
logging.info('Warning is given if smallest partition is nearly full')
|
||||
ret = idf_py('build')
|
||||
# Build a first time to get the binary size and to check that no warning is issued.
|
||||
assert 'partition is nearly full' not in ret.stdout, 'Warning for nearly full smallest partition was given when the condition is not fulfilled'
|
||||
assert 'partition is nearly full' not in ret.stdout, (
|
||||
'Warning for nearly full smallest partition was given when the condition is not fulfilled'
|
||||
)
|
||||
# Get the size of the binary, in KB. Convert it to next multiple of 4.
|
||||
# The goal is to create an app partition which is slightly bigger than the binary itself
|
||||
updated_file_size = int((os.stat(test_app_copy / 'build' / 'build_test_app.bin').st_size + 4095) / 4096) * 4
|
||||
idf_path = Path(default_idf_env['IDF_PATH'])
|
||||
shutil.copy2(idf_path / 'components' / 'partition_table' / 'partitions_singleapp.csv', test_app_copy / 'partitions.csv')
|
||||
replace_in_file(test_app_copy / 'partitions.csv',
|
||||
'factory, app, factory, , 1M',
|
||||
f'factory, app, factory, , {updated_file_size}K')
|
||||
(test_app_copy / 'sdkconfig').write_text('\n'.join(['CONFIG_PARTITION_TABLE_CUSTOM=y', 'CONFIG_FREERTOS_SMP=n']))
|
||||
shutil.copy2(
|
||||
idf_path / 'components' / 'partition_table' / 'partitions_singleapp.csv', test_app_copy / 'partitions.csv'
|
||||
)
|
||||
replace_in_file(
|
||||
test_app_copy / 'partitions.csv',
|
||||
'factory, app, factory, , 1M',
|
||||
f'factory, app, factory, , {updated_file_size}K',
|
||||
)
|
||||
append_to_file(test_app_copy / 'sdkconfig', '\n'.join(['CONFIG_PARTITION_TABLE_CUSTOM=y', 'CONFIG_FREERTOS_SMP=n']))
|
||||
ret = idf_py('build', check=False)
|
||||
assert 'partition is nearly full' in ret.stdout
|
||||
|
||||
Reference in New Issue
Block a user