[test] separate code coverage data files (#5920)

This commit ensures each node create its own profile data, so that they
can be merged after tests to produce more accurate profile data.

This commit also prints the coverage data of message.cpp after all
profile data are merged.
This commit is contained in:
Yakun Xu
2020-12-07 13:23:26 -08:00
committed by GitHub
parent dc5c25799d
commit 7a7390b9ee
8 changed files with 141 additions and 198 deletions
+10 -3
View File
@@ -58,6 +58,7 @@ proc wait_for {command success {failure {[\r\n]FAILURE_NOT_EXPECTED[\r\n]}}} {
proc spawn_node {id {type ""} {radio_url ""}} {
global spawn_id
global spawn_ids
global argv0
if {${type} == ""} {
set type $::env(OT_NODE_TYPE)
@@ -69,9 +70,15 @@ proc spawn_node {id {type ""} {radio_url ""}} {
send_user "\n# ${id} ${type}\n"
if {[info exists ::env(CC)] && $::env(CC) == "clang"} {
set gcov_prefix ""
} else {
set gcov_prefix "ot-run/$argv0/ot-gcda.$id"
}
switch -regexp ${type} {
{rcp|rcp-cli} {
spawn $::env(OT_POSIX_APPS)/ot-cli $radio_url
spawn /usr/bin/env GCOV_PREFIX=$gcov_prefix $::env(OT_POSIX_APPS)/ot-cli $radio_url
send "factoryreset\n"
wait_for "state" "disabled"
expect "Done"
@@ -79,7 +86,7 @@ proc spawn_node {id {type ""} {radio_url ""}} {
expect "Done"
}
cli {
spawn $::env(OT_SIMULATION_APPS)/cli/ot-cli-ftd $id
spawn /usr/bin/env GCOV_PREFIX=$gcov_prefix $::env(OT_SIMULATION_APPS)/cli/ot-cli-ftd $id
send "factoryreset\n"
wait_for "state" "disabled"
expect "Done"
@@ -87,7 +94,7 @@ proc spawn_node {id {type ""} {radio_url ""}} {
expect "Done"
}
mtd {
spawn $::env(OT_SIMULATION_APPS)/cli/ot-cli-mtd $id
spawn /usr/bin/env GCOV_PREFIX=$gcov_prefix $::env(OT_SIMULATION_APPS)/cli/ot-cli-mtd $id
send "factoryreset\n"
wait_for "state" "disabled"
expect "Done"