Files
openobserve/coverage.sh
T
e289762604 fix: typed dashboard structs (#466)
* WIP: introduce `DashboardXxx`; use it for `save_dashboard`

* service::db::dashboard::list: handle errors, don't unwrap

* [WIP] Update `service::db::dashboard::list`

* XXX The code compiles, but the Dashboards page shows nothing

* web: repair 'dashboards' page

Don't `JSON.parse` backend's response, it's JSON already.

* [WIP] Repair the "view dashboard" page

Saving panel(s) is still broken.

* meta::dashboards.rs: define `Panel` struct

* Fix `Panel` struct definition

* Use `crate::common::json` instead of `serde_json`

* remove json stringify for the dashboard

* Fixed dashboards

* WIP: introduce `DashboardXxx`; use it for `save_dashboard`

* service::db::dashboard::list: handle errors, don't unwrap

* [WIP] Update `service::db::dashboard::list`

* XXX The code compiles, but the Dashboards page shows nothing

* web: repair 'dashboards' page

Don't `JSON.parse` backend's response, it's JSON already.

* [WIP] Repair the "view dashboard" page

Saving panel(s) is still broken.

* meta::dashboards.rs: define `Panel` struct

* Fix `Panel` struct definition

* Use `crate::common::json` instead of `serde_json`

* remove json stringify for the dashboard

* Fixed dashboards

* Added all aggregate functions

* FIXED TESTS

* fixed integration tests

* Updated coverage threshold

---------

Co-authored-by: ktx-keshavi <keshavi.bhalani@kiara.tech>
Co-authored-by: oasisk <ashish.j.kolhe@gmail.com>
2023-03-31 17:03:34 +05:30

49 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
if [ -z $(cargo --list|grep llvm-cov) ]; then
cargo install -f cargo-llvm-cov
fi
# cargo llvm-cov >report.json && ls -l | grep TOTAL report.json | xargs > coverage.txt
RUSTFLAGS='-C target-cpu=native' cargo llvm-cov --features zo_functions,tmpcache --ignore-filename-regex job >report.json
if [ $? -ne 0 ]; then
echo "Failed to run cargo llvm-cov"
exit 1
fi
summary="$(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 "func_cov $func_cov"
echo "line_cov $line_cov"
echo "region_cov $region_cov"
# enable threshold
#COVERAGE_THRESHOLD=80
FUNC_COV_THRESHOLD=68
LINE_COV_THRESHOLD=57
REGION_COV_THRESHOLD=45
# 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