From f24489d94f69e0d63146c44bef1dcc28a40f396c Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 21 Dec 2014 16:41:59 +0200 Subject: [PATCH] tests: Use new scripts for vm-run.sh codecov Now there is only one set of commands to maintain. The separate reports for individual components have not been of much use in the past, so they are dropped for now. Signed-off-by: Jouni Malinen --- tests/hwsim/vm/combine-codecov.sh | 7 +++- tests/hwsim/vm/process-codecov.sh | 13 ++++--- tests/hwsim/vm/vm-run.sh | 56 +++---------------------------- 3 files changed, 20 insertions(+), 56 deletions(-) diff --git a/tests/hwsim/vm/combine-codecov.sh b/tests/hwsim/vm/combine-codecov.sh index 9c7be84ea..014d615be 100755 --- a/tests/hwsim/vm/combine-codecov.sh +++ b/tests/hwsim/vm/combine-codecov.sh @@ -1,6 +1,11 @@ #!/bin/bash LOGDIR=$1 +if [ -n "$2" ]; then + ODIR=$2 +else + ODIR=. +fi TMPDIR=/tmp/logs mv $LOGDIR/alt-* $TMPDIR @@ -13,7 +18,7 @@ done lcov $args -o $LOGDIR/combined.info > $LOGDIR/combined-lcov.log 2>&1 cd $LOGDIR -genhtml -t "wpa_supplicant/hostapd combined for hwsim test run $(date +%s)" combined.info --output-directory . > lcov.log 2>&1 +genhtml -t "wpa_supplicant/hostapd combined for hwsim test run $(date +%s)" combined.info --output-directory $ODIR > lcov.log 2>&1 rm -r /tmp/logs/alt-wpa_supplicant rm -r /tmp/logs/alt-hostapd diff --git a/tests/hwsim/vm/process-codecov.sh b/tests/hwsim/vm/process-codecov.sh index 7108a200a..d932aa2d0 100755 --- a/tests/hwsim/vm/process-codecov.sh +++ b/tests/hwsim/vm/process-codecov.sh @@ -2,6 +2,7 @@ LOGDIR=$1 POSTFIX=$2 +RESTORE=$3 DIR=$PWD TMPDIR=/tmp/logs @@ -25,7 +26,11 @@ lcov -c -d .. 2> lcov.log | sed s%SF:/tmp/logs/alt-[^/]*/%SF:/tmp/logs/alt-wpa_s wait cd $DIR -rm -r $TMPDIR/alt-wpa_supplicant -rm -r $TMPDIR/alt-hostapd -rm -r $TMPDIR/alt-hostapd-as -rm -r $TMPDIR/alt-hlr_auc_gw +if [ "$RESTORE" == "restore" ]; then + mv $TMPDIR/alt-* $LOGDIR +else + rm -r $TMPDIR/alt-wpa_supplicant + rm -r $TMPDIR/alt-hostapd + rm -r $TMPDIR/alt-hostapd-as + rm -r $TMPDIR/alt-hlr_auc_gw +fi diff --git a/tests/hwsim/vm/vm-run.sh b/tests/hwsim/vm/vm-run.sh index 163586dad..e6d99d354 100755 --- a/tests/hwsim/vm/vm-run.sh +++ b/tests/hwsim/vm/vm-run.sh @@ -102,61 +102,15 @@ kvm \ -append "mac80211_hwsim.support_p2p_device=0 mac80211_hwsim.channels=$CHANNELS mac80211_hwsim.radios=6 init=$CMD testdir=$TESTDIR timewarp=$TIMEWARP console=$KVMOUT root=/dev/root rootflags=trans=virtio,version=9p2000.u ro rootfstype=9p EPATH=$EPATH ARGS=$RUN_TEST_ARGS" if [ $CODECOV = "yes" ]; then - DIR=$PWD - mv $LOGDIR/alt-wpa_supplicant /tmp/logs - mv $LOGDIR/alt-hostapd /tmp/logs - mv $LOGDIR/alt-hostapd-as /tmp/logs - mv $LOGDIR/alt-hlr_auc_gw /tmp/logs - - echo "Generating code coverage report for wpa_supplicant" - cd /tmp/logs/alt-wpa_supplicant/wpa_supplicant - lcov -c -d .. > lcov.info 2> lcov.log - genhtml -t "wpa_supplicant hwsim test run $DATE" lcov.info --output-directory $LOGDIR/lcov-wpa_supplicant >> lcov.log 2>&1 - mv lcov.info lcov.log $LOGDIR/lcov-wpa_supplicant - - echo "Generating code coverage report for hostapd" - cd /tmp/logs/alt-hostapd/hostapd - lcov -c -d .. > lcov.info 2> lcov.log - genhtml -t "hostapd hwsim test run $DATE" lcov.info --output-directory $LOGDIR/lcov-hostapd >> lcov.log 2>&1 - mv lcov.info lcov.log $LOGDIR/lcov-hostapd - - echo "Generating code coverage report for hostapd (AS)" - cd /tmp/logs/alt-hostapd-as/hostapd - lcov -c -d .. > lcov.info 2> lcov.log - genhtml -t "hostapd (AS) hwsim test run $DATE" lcov.info --output-directory $LOGDIR/lcov-hostapd-as >> lcov.log 2>&1 - mv lcov.info lcov.log $LOGDIR/lcov-hostapd-as - - echo "Generating code coverage report for hlr_auc_gw" - cd /tmp/logs/alt-hlr_auc_gw/hostapd - lcov -c -d .. > lcov.info 2> lcov.log - genhtml -t "hlr_auc_gw hwsim test run $DATE" lcov.info --output-directory $LOGDIR/lcov-hlr_auc_gw >> lcov.log 2>&1 - mv lcov.info lcov.log $LOGDIR/lcov-hlr_auc_gw - - echo "Generating combined code coverage report" - mkdir $LOGDIR/lcov-combined - for i in wpa_supplicant hostapd hostapd-as hlr_auc_gw; do - sed s%SF:/tmp/logs/alt-[^/]*/%SF:/tmp/logs/alt-wpa_supplicant/% < $LOGDIR/lcov-$i/lcov.info > $LOGDIR/lcov-combined/$i.info - done - cd $LOGDIR/lcov-combined - lcov -a wpa_supplicant.info -a hostapd.info -a hostapd-as.info -a hlr_auc_gw.info -o combined.info > lcov.log 2>&1 - genhtml -t "wpa_supplicant/hostapd combined for hwsim test run $DATE" combined.info --output-directory . >> lcov.log 2>&1 - - cd $DIR - rm -r /tmp/logs/alt-wpa_supplicant - rm -r /tmp/logs/alt-hostapd - rm -r /tmp/logs/alt-hostapd-as - rm -r /tmp/logs/alt-hlr_auc_gw - rmdir /tmp/logs + echo "Preparing code coverage reports" + ./process-codecov.sh $LOGDIR "" restore + ./combine-codecov.sh $LOGDIR lcov fi echo echo "Test run completed" echo "Logfiles are at $LOGDIR" if [ $CODECOV = "yes" ]; then - echo "Code coverage reports:" - echo "wpa_supplicant: file://$LOGDIR/lcov-wpa_supplicant/index.html" - echo "hostapd: file://$LOGDIR/lcov-hostapd/index.html" - echo "hostapd (AS): file://$LOGDIR/lcov-hostapd-as/index.html" - echo "hlr_auc_gw: file://$LOGDIR/lcov-hlr_auc_gw/index.html" - echo "combined: file://$LOGDIR/lcov-combined/index.html" + echo "Code coverage report:" + echo "file://$LOGDIR/lcov/index.html" fi