mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'ci/add_download_custom_apps_fixture' into 'master'
test: fix custom additional app for multicore test cases Closes IDFCI-1948 See merge request espressif/esp-idf!28507
This commit is contained in:
commit
c1ee790341
@ -123,6 +123,11 @@ class BuildReportDownloader:
|
|||||||
def download_app(
|
def download_app(
|
||||||
self, app_build_path: str, artifact_type: ArtifactType = ArtifactType.BUILD_DIR_WITHOUT_MAP_AND_ELF_FILES
|
self, app_build_path: str, artifact_type: ArtifactType = ArtifactType.BUILD_DIR_WITHOUT_MAP_AND_ELF_FILES
|
||||||
) -> None:
|
) -> None:
|
||||||
|
if app_build_path not in self.app_presigned_urls_dict:
|
||||||
|
raise ValueError(f'No presigned url found for {app_build_path}. '
|
||||||
|
f'Usually this should not happen, please re-trigger a pipeline.'
|
||||||
|
f'If this happens again, please report this bug to the CI channel.')
|
||||||
|
|
||||||
url = self.app_presigned_urls_dict[app_build_path][artifact_type.value]
|
url = self.app_presigned_urls_dict[app_build_path][artifact_type.value]
|
||||||
|
|
||||||
logging.debug('Downloading app from %s', url)
|
logging.debug('Downloading app from %s', url)
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import typing as t
|
import typing as t
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from zipfile import ZIP_DEFLATED, ZipFile
|
from zipfile import ZIP_DEFLATED
|
||||||
|
from zipfile import ZipFile
|
||||||
|
|
||||||
import minio
|
import minio
|
||||||
from artifacts_handler import ArtifactType, get_minio_client, getenv
|
from artifacts_handler import ArtifactType
|
||||||
|
from artifacts_handler import get_minio_client
|
||||||
|
from artifacts_handler import getenv
|
||||||
from idf_build_apps import App
|
from idf_build_apps import App
|
||||||
from idf_build_apps.utils import rmdir
|
from idf_build_apps.utils import rmdir
|
||||||
from idf_ci_utils import IDF_PATH
|
from idf_ci_utils import IDF_PATH
|
||||||
@ -103,7 +105,7 @@ class AppUploader:
|
|||||||
try:
|
try:
|
||||||
self._client.stat_object(getenv('IDF_S3_BUCKET'), obj_name)
|
self._client.stat_object(getenv('IDF_S3_BUCKET'), obj_name)
|
||||||
except minio.error.S3Error as e:
|
except minio.error.S3Error as e:
|
||||||
raise SystemExit(
|
raise RuntimeError(
|
||||||
f'No such file on minio server: {obj_name}. '
|
f'No such file on minio server: {obj_name}. '
|
||||||
f'Probably the build failed or the artifacts got expired. '
|
f'Probably the build failed or the artifacts got expired. '
|
||||||
f'Full error message: {str(e)}'
|
f'Full error message: {str(e)}'
|
||||||
@ -112,7 +114,7 @@ class AppUploader:
|
|||||||
self._client.fget_object(getenv('IDF_S3_BUCKET'), obj_name, zip_filename)
|
self._client.fget_object(getenv('IDF_S3_BUCKET'), obj_name, zip_filename)
|
||||||
print(f'Downloaded to {zip_filename}')
|
print(f'Downloaded to {zip_filename}')
|
||||||
except minio.error.S3Error as e:
|
except minio.error.S3Error as e:
|
||||||
raise SystemExit('Shouldn\'t happen, please report this bug in the CI channel' + str(e))
|
raise RuntimeError('Shouldn\'t happen, please report this bug in the CI channel' + str(e))
|
||||||
|
|
||||||
with ZipFile(zip_filename, 'r') as zr:
|
with ZipFile(zip_filename, 'r') as zr:
|
||||||
zr.extractall()
|
zr.extractall()
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
# SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
# SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
# SPDX-License-Identifier: CC0-1.0
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from artifacts_handler import ArtifactType
|
||||||
|
from idf_ci_utils import IDF_PATH
|
||||||
from pytest_embedded import Dut
|
from pytest_embedded import Dut
|
||||||
|
|
||||||
|
|
||||||
@ -12,12 +13,17 @@ from pytest_embedded import Dut
|
|||||||
@pytest.mark.esp32p4
|
@pytest.mark.esp32p4
|
||||||
@pytest.mark.generic
|
@pytest.mark.generic
|
||||||
@pytest.mark.parametrize('config', ['multicore'], indirect=True)
|
@pytest.mark.parametrize('config', ['multicore'], indirect=True)
|
||||||
def test_multicore_app_and_unicore_bootloader(dut: Dut) -> None:
|
def test_multicore_app_and_unicore_bootloader(dut: Dut, app_downloader) -> None: # type: ignore
|
||||||
dut.expect('Multicore bootloader')
|
dut.expect('Multicore bootloader')
|
||||||
dut.expect('Multicore app')
|
dut.expect('Multicore app')
|
||||||
dut.expect('App is running')
|
dut.expect('App is running')
|
||||||
|
|
||||||
path_to_unicore_build = os.path.join(dut.app.app_path, f'build_{dut.target}_unicore')
|
path_to_unicore_build = os.path.join(dut.app.app_path, f'build_{dut.target}_unicore')
|
||||||
|
if app_downloader:
|
||||||
|
app_downloader.download_app(
|
||||||
|
os.path.relpath(path_to_unicore_build, IDF_PATH), ArtifactType.BUILD_DIR_WITHOUT_MAP_AND_ELF_FILES
|
||||||
|
)
|
||||||
|
|
||||||
dut.serial.bootloader_flash(path_to_unicore_build)
|
dut.serial.bootloader_flash(path_to_unicore_build)
|
||||||
dut.expect('Unicore bootloader')
|
dut.expect('Unicore bootloader')
|
||||||
dut.expect('Multicore app')
|
dut.expect('Multicore app')
|
||||||
@ -29,13 +35,18 @@ def test_multicore_app_and_unicore_bootloader(dut: Dut) -> None:
|
|||||||
@pytest.mark.esp32p4
|
@pytest.mark.esp32p4
|
||||||
@pytest.mark.generic
|
@pytest.mark.generic
|
||||||
@pytest.mark.parametrize('config', ['unicore'], indirect=True)
|
@pytest.mark.parametrize('config', ['unicore'], indirect=True)
|
||||||
def test_unicore_app_and_multicore_bootloader(dut: Dut) -> None:
|
def test_unicore_app_and_multicore_bootloader(dut: Dut, app_downloader) -> None: # type: ignore
|
||||||
dut.expect('Unicore bootloader')
|
dut.expect('Unicore bootloader')
|
||||||
dut.expect('Unicore app')
|
dut.expect('Unicore app')
|
||||||
dut.expect('App is running')
|
dut.expect('App is running')
|
||||||
|
|
||||||
path_to_unicore_build = os.path.join(dut.app.app_path, f'build_{dut.target}_multicore')
|
path_to_multicore_build = os.path.join(dut.app.app_path, f'build_{dut.target}_multicore')
|
||||||
dut.serial.bootloader_flash(path_to_unicore_build)
|
if app_downloader:
|
||||||
|
app_downloader.download_app(
|
||||||
|
os.path.relpath(path_to_multicore_build, IDF_PATH), ArtifactType.BUILD_DIR_WITHOUT_MAP_AND_ELF_FILES
|
||||||
|
)
|
||||||
|
|
||||||
|
dut.serial.bootloader_flash(path_to_multicore_build)
|
||||||
dut.expect('Multicore bootloader')
|
dut.expect('Multicore bootloader')
|
||||||
dut.expect('Unicore app')
|
dut.expect('Unicore app')
|
||||||
dut.expect('App is running')
|
dut.expect('App is running')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user