From f512bda6608e8c61e7335827a7c5bcfed44be21e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Costa?= Date: Tue, 10 Jun 2025 13:56:46 +0200 Subject: [PATCH] test(perf): add perf test framework (#8064) --- .github/workflows/perf_tests.yml | 35 + tests/README.md | 35 + tests/main.py | 15 +- tests/perf.py | 552 ++++++++++ tests/src/lv_test_init.c | 2 +- tests/src/lv_test_perf_conf.h | 1318 ++++++++++++++++++++++++ tests/src/test_cases_perf/test_chart.c | 33 + tests/src/test_cases_perf/test_math.c | 9 + tests/unity/generate_test_runner.rb | 0 tests/unity/unity.c | 4 +- tests/unity/unity.h | 2 +- tests/unity/unity_internals.h | 2 +- tests/unity/unity_support.h | 33 +- 13 files changed, 2031 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/perf_tests.yml create mode 100755 tests/perf.py create mode 100644 tests/src/lv_test_perf_conf.h create mode 100644 tests/src/test_cases_perf/test_chart.c create mode 100644 tests/src/test_cases_perf/test_math.c mode change 100644 => 100755 tests/unity/generate_test_runner.rb diff --git a/.github/workflows/perf_tests.yml b/.github/workflows/perf_tests.yml new file mode 100644 index 0000000000..ed05b09eed --- /dev/null +++ b/.github/workflows/perf_tests.yml @@ -0,0 +1,35 @@ +name: Performance Tests CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency +# Ensure that only one commit will be running tests at a time on each PR +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + test-perf: + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + # A valid option parameter to the cmake file. + # See BUILD_OPTIONS in tests/perf.py. + build_option: ['OPTIONS_TEST_PERF_32B', + 'OPTIONS_TEST_PERF_64B'] + + name: Perf Tests ${{ matrix.build_option }} - Ubuntu + steps: + - uses: actions/checkout@v4 + - uses: ammaraskar/gcc-problem-matcher@master + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Building ${{ matrix.build_option }} + run: python tests/perf.py --build-option=${{ matrix.build_option }} test diff --git a/tests/README.md b/tests/README.md index 3a32faba4f..13c26151a2 100644 --- a/tests/README.md +++ b/tests/README.md @@ -44,6 +44,40 @@ docker run --rm -it -v $(pwd):/work lvgl_test_env "./tests/main.py" This ensures you are testing in a consistent environment with the same dependencies as the CI pipeline. +## Performance Tests + +### Requirements + +- **Docker** +- **Linux host machine** (WSL *may* work but is untested) + +### Running Tests + +The performance tests are run inside a Docker container that launches an ARM emulated environment using QEMU to ensure consistent timing across machines. Each test runs on a lightweight ARM-based OS ([SO3](https://github.com/smartobjectoriented/so3)) within this emulated environment. + +To run the tests: + +```bash +./perf.py [--clean] [--auto-clean] [--test-suite ] [--build-options