mirror of
https://github.com/openobserve/openobserve.git
synced 2026-11-04 16:09:05 +00:00
* feat: support encode SQL * fix: add more unit tests * perf: improve inline
38 lines
1.4 KiB
Bash
Executable File
38 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# cargo llvm-cov >report.json && ls -l | grep TOTAL report.json | xargs > coverage.txt
|
|
summary="$(RUSTFLAGS='-C target-cpu=native' cargo llvm-cov --features zo_functions,tmpcache --ignore-filename-regex job >report.json && ls -l | grep TOTAL report.json | xargs)"
|
|
echo "Coverage Summary $summary %"
|
|
|
|
region_cov="$(cut -d' ' -f4 <<<"$summary")"
|
|
region_cov=${region_cov//%/}
|
|
func_cov="$(cut -d' ' -f7 <<<"$summary")"
|
|
func_cov=${func_cov//%/}
|
|
line_cov="$(cut -d' ' -f10 <<<"$summary")"
|
|
line_cov=${line_cov//%/}
|
|
|
|
echo "region_cov $region_cov"
|
|
echo "func_cov $func_cov"
|
|
echo "line_cov $line_cov"
|
|
|
|
# enable threshold
|
|
#COVERAGE_THRESHOLD=80
|
|
FUNC_COV_THRESHOLD=60
|
|
LINE_COV_THRESHOLD=53
|
|
REGION_COV_THRESHOLD=40
|
|
|
|
# clean up
|
|
# find ./target -name llvm-cov-target -type d|xargs rm -fR
|
|
# clean up finished
|
|
|
|
func_diff=$(echo "$func_cov < $FUNC_COV_THRESHOLD" | bc)
|
|
line_diff=$(echo "$line_cov < $LINE_COV_THRESHOLD" | bc)
|
|
region_diff=$(echo "$region_cov < $REGION_COV_THRESHOLD" | bc)
|
|
|
|
if [ $func_diff -eq 1 ] || [ $line_diff -eq 1 ] || [ $region_diff -eq 1 ]; then
|
|
echo "Coverage is below threshold of function coverage $FUNC_COV_THRESHOLD% or line coverage $LINE_COV_THRESHOLD% or region coverage $REGION_COV_THRESHOLD%"
|
|
exit 1
|
|
else
|
|
echo "Coverage is above threshold of function coverage $FUNC_COV_THRESHOLD% & line coverage $LINE_COV_THRESHOLD% & region coverage $REGION_COV_THRESHOLD%"
|
|
exit 0
|
|
fi |