Merge pull request #29208 from taosdata/feat/wangxu/setup_lcov

feat: add script to setup lcov
This commit is contained in:
xiangyang guo 2024-12-18 18:41:48 +08:00 committed by GitHub
commit 6a726b159e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 57 additions and 0 deletions

57
tests/setup-lcov.sh Normal file
View File

@ -0,0 +1,57 @@
#!/usr/bin/env bash
function usage() {
echo "Usage: $0 -v <version>"
echo "Example: $0 -v 1.14"
}
function download_lcov() {
local version=$1
local url="https://github.com/linux-test-project/lcov/releases/download/v${version}/lcov-${version}.tar.gz"
echo "Downloading lcov version ${version} from ${url}..."
curl -LO ${url}
tar -xzf lcov-${version}.tar.gz
echo "lcov version ${version} downloaded and extracted."
}
function install_lcov() {
echo -e "\nInstalling..."
local version=$1
cd lcov-${version}
sudo make uninstall && sudo make install
cd ..
echo "lcov version ${version} installed."
}
function verify_lcov() {
echo -e "\nVerify installation..."
lcov --version
}
function main() {
if [[ "$#" -ne 2 ]]; then
usage
exit 1
fi
while getopts "v:h" opt; do
case ${opt} in
v)
version=${OPTARG}
download_lcov ${version}
install_lcov ${version}
verify_lcov
;;
h)
usage
exit 0
;;
*)
usage
exit 1
;;
esac
done
}
main "$@"