Skip to content

Commit

Permalink
[metric] add code coverage ci (#794)
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle authored Oct 14, 2024
1 parent 8f40d87 commit d7cedc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/linux_llvm_cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ jobs:
./easylog_test
./struct_pack_test
./struct_pack_test_with_optimize
./metric_test
./struct_pb_test
./reflection_test
llvm-profdata merge -sparse test_ylt-*.profraw -o test_ylt.profdata
llvm-cov show coro_io_test -object coro_rpc_test -object easylog_test -object struct_pack_test -object struct_pack_test_with_optimize -instr-profile=test_ylt.profdata -format=html -output-dir=../../.coverage_llvm_cov -ignore-filename-regex="thirdparty|asio|src" -show-instantiations=false
llvm-cov show coro_io_test -object coro_rpc_test -object easylog_test -object struct_pack_test -object struct_pack_test_with_optimize ./metric_test ./struct_pb_test ./reflection_test -instr-profile=test_ylt.profdata -format=html -output-dir=../../.coverage_llvm_cov -ignore-filename-regex="thirdparty|asio|src" -show-instantiations=false
echo "Done!"
- name: Upload Coverage Results
Expand Down
6 changes: 4 additions & 2 deletions include/ylt/metric/dynamic_metric.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ class dynamic_metric_impl : public dynamic_metric {
return map_.try_emplace_with_op(
view,
[](auto result) {
*const_cast<std::span<const std::string, N>*>(&result.first->first) =
result.first->second->label;
if (result.second) {
*const_cast<std::span<const std::string, N>*>(
&result.first->first) = result.first->second->label;
}
},
std::forward<Key>(key), std::forward<Args>(args)...);
}
Expand Down

0 comments on commit d7cedc7

Please sign in to comment.