Stefan Reinauer has uploaded this change for review. ( https://review.coreboot.org/c/em100/+/37496 )
Change subject: Add test / code coverage script ......................................................................
Add test / code coverage script
Add a simple script that runs through most functions of the em100 tool and produces code coverage information.
Currently does not look for errors in the output, or do any other analysis.
Signed-off-by: Stefan Reinauer stefan.reinauer@coreboot.org Change-Id: I6f842f881e5b636eff061696f3eebf076e5f39c0 --- A gcov.sh 1 file changed, 69 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/em100 refs/changes/96/37496/1
diff --git a/gcov.sh b/gcov.sh new file mode 100755 index 0000000..ff3656d --- /dev/null +++ b/gcov.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +LOG=em100_test.log + +i=0 +banner_test() +{ + printf "\rRunning tests... %03d" $i +} + +next_test() +{ + lcov --no-external --capture --directory . -t TEST_$i --output-file coverage.info >> $LOG + i=$(( $i + 1)) +} + +printf "Building... " +echo "Test log" > $LOG +make clean >> $LOG +CFLAGS="-O2 -g -fomit-frame-pointer -fprofile-arcs -ftest-coverage" make >> $LOG +printf "ok\n"; + +banner_test +# some prep work +export EM100_HOME=$(mktemp -d) +i=$(( $i + 1)) + +banner_test +./em100 >>$LOG 2>&1 +next_test + +banner_test +./em100 --help >> $LOG 2>&1 +next_test + +banner_test +./em100 -U >> $LOG 2>&1 +next_test + +banner_test +./em100 --stop --set M25P80 -d file.bin -v --start >> $LOG 2>&1 +next_test + +banner_test +./em100 -U file.bin >> $LOG 2>&1 +next_test + +banner_test +./em100 --list-devices >> $LOG 2>&1 +next_test + +banner_test +./em100 --firmware-dump $EM100_HOME/test1.raw >> $LOG 2>&1 +next_test + +banner_test +./em100 --firmware-write $EM100_HOME/test2.dpfw >> $LOG 2>&1 +next_test + +banner_test +./em100 --firmware-update auto >> $LOG 2>&1 +next_test + +printf "\n\n" +printf "Now power cycle your EM100Pro\n" + +genhtml coverage.info --output-directory out >> $LOG +rm *.gcno *.gcda xz/*.gcno xz/*.gcda +