Merge branch 'ci/add_base_size_metric_apps' into 'master'

ci(size_metrics): add base size metric test apps

See merge request espressif/esp-idf!46208
This commit is contained in:
Marius Vikhammer
2026-07-29 20:50:13 +08:00
52 changed files with 259 additions and 3 deletions
@@ -49,8 +49,14 @@
#
# Entries below define the apps that publish size metrics:
examples/get-started/hello_world:
tools/test_apps/size_metrics/minimal_baseline:
libs: all
bootloader: true
configs:
- default
components/esp_timer/test_apps/size_metrics:
libs: all
configs:
- minimal
- full
@@ -0,0 +1,8 @@
# Shared production-style defaults for apps that publish size metrics
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y
CONFIG_COMPILER_NO_MERGE_CONSTANTS=y
CONFIG_LOG_DEFAULT_LEVEL_WARN=y
CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y
@@ -0,0 +1,7 @@
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
tools/test_apps/size_metrics/minimal_baseline:
disable_test:
- if: IDF_TARGET == "linux"
temporary: true
reason: Not a real hardware target
@@ -0,0 +1,12 @@
# This is the project CMakeLists.txt file for the minimal_baseline size metrics test app
cmake_minimum_required(VERSION 3.22)
list(PREPEND SDKCONFIG_DEFAULTS
"$ENV{IDF_PATH}/tools/test_apps/configs/sdkconfig.size_metrics"
"sdkconfig.defaults")
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(minimal_baseline)
@@ -0,0 +1,35 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 |
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- | --------- |
# Minimal Baseline Size Metrics App
This is a **build-only** integration app for size metrics tracking. It exercises the absolute minimum SDK stack:
- `app_main()` entry point
- `esp_system` and its core dependencies
## Purpose
Establish a floor measurement for the core ESP-IDF SDK and detect regressions in:
- Toolchain changes (compiler, linker)
- newlib updates
- Linker script changes
- Core system component dependencies
## Source Frozen
This app is **source-frozen**. The application code should never change unless forced by SDK API changes (e.g., breaking API changes at major version boundaries). Any size change detected in CI is attributable to SDK changes, not application code evolution.
## Configuration
- Built with `-Os` (size optimization)
- Disables WDT, assertions, and other noise-inducing features
- Trimmed build: only includes `main` component and its dependencies
- Targets: ESP32 (Xtensa) and ESP32-C6 (RISC-V)
## Metrics Tracked
- Total flash usage
- Total DRAM usage
- Total IRAM usage
Metrics are collected from the `.map` file using `esp_idf_size` and uploaded via `esp-metrics-cli`.
@@ -0,0 +1,2 @@
idf_component_register(SRCS "main.c"
WHOLE_ARCHIVE)
@@ -0,0 +1,26 @@
/*
* SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#include <stdio.h>
/**
* Minimal baseline integration app for size metrics.
*
* This app exercises only the absolute minimum SDK stack - app_main + esp_system.
* It establishes a floor measurement for the core SDK and catches regressions in:
* - Toolchain changes
* - newlib updates
* - Linker script changes
* - Core esp_system dependencies
*
* This app keeps runtime behavior minimal and source-frozen.
* Any size change is attributable to SDK changes, not application code changes.
*/
void app_main(void)
{
printf("minimal_baseline app_main started\n");
}
@@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0
import pytest
from pytest_embedded_idf.dut import IdfDut
from pytest_embedded_idf.utils import idf_parametrize
@pytest.mark.generic
@pytest.mark.parametrize('config', ['default'], indirect=True)
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
def test_minimal_baseline_boots(dut: IdfDut) -> None:
dut.expect_exact('minimal_baseline app_main started', timeout=30)
@@ -0,0 +1 @@
# App-specific defaults for minimal_baseline size metrics