From cbc52e7d300a24762f959e2b155545b03cea47e2 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 9 Aug 2024 15:38:55 +0200 Subject: [PATCH] test(build_system): check reproducible builds with spaces in paths --- tools/test_build_system/test_spaces.py | 29 +++++++++++++++++++------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/tools/test_build_system/test_spaces.py b/tools/test_build_system/test_spaces.py index 7635f00a98..5a21214997 100644 --- a/tools/test_build_system/test_spaces.py +++ b/tools/test_build_system/test_spaces.py @@ -8,6 +8,7 @@ import sys from pathlib import Path import pytest +from test_build_system_helpers import IdfPyFunc from test_build_system_helpers import run_idf_py # In this test file the test are grouped into 3 bundles @@ -23,8 +24,6 @@ def clean_app_dir(app_path: Path) -> None: @pytest.mark.idf_copy('esp idf with spaces') def test_spaces_bundle1(idf_copy: Path) -> None: logging.info('Running test spaces bundle 1') - # test_build - run_idf_py('build', workdir=(idf_copy / 'examples' / 'get-started' / 'hello_world')) # test spiffsgen run_idf_py('build', workdir=(idf_copy / 'examples' / 'storage' / 'spiffsgen')) # test build ulp_fsm @@ -40,12 +39,6 @@ def test_spaces_bundle2(idf_copy: Path) -> None: run_idf_py('build', workdir=(idf_copy / 'examples' / 'security' / 'flash_encryption')) # test_x509_cert_bundle run_idf_py('build', workdir=(idf_copy / 'examples' / 'protocols' / 'https_x509_bundle')) - # test dfu - hello_world_app_path = (idf_copy / 'examples' / 'get-started' / 'hello_world') - run_idf_py('-DIDF_TARGET=esp32s2', 'dfu', workdir=hello_world_app_path) - clean_app_dir(hello_world_app_path) - # test uf2 - run_idf_py('uf2', workdir=hello_world_app_path) @pytest.mark.idf_copy('esp idf with spaces') @@ -69,6 +62,26 @@ def test_spaces_bundle3(idf_copy: Path) -> None: workdir=secure_boot_app_path) +# Use this bundle for tests which can be done with the default build_test_app +@pytest.mark.parametrize('dummy_', [ + # Dummy parameter with a space in it, used so that the test directory name contains a space + pytest.param('test spaces') +]) +@pytest.mark.idf_copy('esp idf with spaces') +@pytest.mark.usefixtures('idf_copy') +def test_spaces_bundle4(dummy_: str, idf_py: IdfPyFunc, test_app_copy: Path) -> None: + logging.info(f'Running test spaces bundle 4 in {test_app_copy}') + (test_app_copy / 'sdkconfig').write_text('CONFIG_APP_REPRODUCIBLE_BUILD=y') + idf_py('build') + (test_app_copy / 'sdkconfig').unlink() + + idf_py('set-target', 'esp32s2') + + idf_py('dfu') + + idf_py('uf2') + + @pytest.mark.skipif(sys.platform == 'win32', reason='Unix test') @pytest.mark.idf_copy('esp idf with spaces') def test_install_export_unix(idf_copy: Path) -> None: