From bd0044e562f27dbd630bbfb1f94b46e1f20dbb7c Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Tue, 13 Sep 2022 06:28:50 -0700 Subject: [PATCH] Update scripts build_coverage.sh for Ubuntu 22.04 LTS/macOS 10.15 and later versions (#22569) --- scripts/build_coverage.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/build_coverage.sh b/scripts/build_coverage.sh index 9beca4a6304760..441f727b5e6bd8 100755 --- a/scripts/build_coverage.sh +++ b/scripts/build_coverage.sh @@ -18,8 +18,28 @@ set -e +_install_lcov() { + if ! lcov --version >/dev/null 2>&1; then + echo "lcov not installed. Installing..." + case "$(uname)" in + "Darwin") + brew install lcov + ;; + "Linux") + sudo apt-get update + sudo apt-get install -y lcov + ;; + *) + die + ;; + esac + fi +} + +_install_lcov + _normpath() { - python -c "import os.path; print(os.path.normpath('$@'))" + python3 -c "import os.path; print(os.path.normpath('$@'))" } CHIP_ROOT=$(_normpath "$(dirname "$0")/..")