fix(run_tests.sh): fix gcov versions mismatch issue (#9652)
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Install LVGL using CMake / build-examples (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled

Signed-off-by: lijianjun <lijianjun@xiaomi.com>
This commit is contained in:
lion2tomato
2026-01-29 11:02:09 +08:00
committed by GitHub
parent f82604392f
commit 9cff942265
+27 -5
View File
@@ -70,18 +70,40 @@ fi
# Get versions of g++, gcc, and gcov
gpp_version=$(g++ -dumpversion)
gcc_version=$(gcc -dumpversion)
gcov_version=$(gcov -dumpversion | grep -oP '\d+\.\d+.\d+' | head -n 1 | cut -d'.' -f1) # only major version
# Check if g++, gcc, and gcov versions are the same
if [ "$gpp_version" != "$gcc_version" ] || [ "$gcc_version" != "$gcov_version" ]; then
# Prefer the gcov that matches the active gcc major version (e.g. gcov-13)
gcc_major=$(echo "$gcc_version" | cut -d'.' -f1)
gcov_cmd="gcov"
if command -v "gcov-${gcc_major}" >/dev/null 2>&1; then
gcov_cmd="gcov-${gcc_major}"
fi
# Export for downstream scripts/tools (gcovr respects GCOV)
export GCOV="$gcov_cmd"
# Determine gcov major version (robust against different output formats)
# - Some distros print just "13" for -dumpversion
# - Others may print a banner like "gcov (Ubuntu 13.2.0-...) 13.2.0"
gcov_version=$($gcov_cmd -dumpversion 2>&1 | head -n 1 | grep -oE '[0-9]+' | head -n 1)
if [ -z "$gcov_version" ]; then
echo "gcov not found or not working (tried: $gcov_cmd)."
echo "Install a matching gcov (e.g. gcc-$gcc_major package) or ensure it is in PATH."
exit 1
fi
# Check if g++, gcc, and gcov versions are the same (major version match)
gpp_major=$(echo "$gpp_version" | cut -d'.' -f1)
if [ "$gpp_major" != "$gcc_major" ] || [ "$gcc_major" != "$gcov_version" ]; then
echo "Versions mismatch detected:"
echo "g++ version: $gpp_version"
echo "gcc version: $gcc_version"
echo "gcov command: $gcov_cmd"
echo "gcov version: $gcov_version"
echo "g++, gcc, and gcov must have the same version."
echo "g++, gcc, and gcov must have the same major version."
exit 1
else
echo "g++, gcc, and gcov versions match: $gpp_version"
echo "g++, gcc, and gcov versions match (major): $gcc_major (gcov: $gcov_cmd)"
fi
if [ "$skip_tests" = true ]; then