[PATCH 5/8] tests: Add option to build before running all tests
Ilan Peer
ilan.peer
Sun Oct 26 00:06:32 PDT 2014
Add an option to run-all.sh to build before starting to
run all the tests.
In addition add an option to extract the code coverage data at the
end of the run.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
tests/hwsim/run-all.sh | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/tests/hwsim/run-all.sh b/tests/hwsim/run-all.sh
index e99d796..51772d9 100755
--- a/tests/hwsim/run-all.sh
+++ b/tests/hwsim/run-all.sh
@@ -27,6 +27,9 @@ fi
unset VALGRIND
unset TRACE
unset TRACE_ARGS
+unset BUILD
+unset BUILD_ARGS
+unset CODECOV
while [ "$1" != "" ]; do
case $1 in
-v | --valgrind ) shift
@@ -42,13 +45,26 @@ while [ "$1" != "" ]; do
shift
echo "$0: using channels=$NUM_CH"
;;
+ -b | --build ) shift
+ echo "$0: build before running tests"
+ BUILD=build
+ ;;
+ -c | --codecov ) shift
+ echo "$0: using code coverage"
+ CODECOV=lcov
+ BUILD_ARGS=-c
+ ;;
* ) exit 1
esac
done
unset SUFFIX
+if [ ! -z "$BUILD" ]; then
+ SUFFIX=-build
+fi
+
if [ ! -z "$VALGRIND" ]; then
- SUFFIX=-valgrind
+ SUFFIX=$SUFFIX-valgrind
fi
if [ ! -z "$TRACE" ]; then
@@ -56,6 +72,18 @@ if [ ! -z "$TRACE" ]; then
TRACE_ARGS="-T"
fi
+if [ ! -z "$CODECOV" ]; then
+ SUFFIX=$SUFFIX-codecov
+fi
+
+if [ ! -z "$BUILD" ]; then
+ echo "Building with args=$BUILD_ARGS"
+ if ! ./build.sh $BUILD_ARGS; then
+ echo "Failed building components"
+ exit 1
+ fi
+fi
+
if ! ./start.sh $VALGRIND $TRACE $NUM_CH; then
if ! [ -z "$LOGBASEDIR" ] ; then
echo "Could not start test environment" > $LOGDIR/run
@@ -74,6 +102,14 @@ if [ ! -z "$VALGRIND" ] ; then
errors=1
fi
fi
+
+if [ ! -z "$CODECOV" ] ; then
+ lcov -q --capture --directory ../../wpa_supplicant --output-file $LOGDIR/wpas_lcov.info
+ genhtml -q $LOGDIR/wpas_lcov.info --output-directory $LOGDIR/wpas_lcov
+ lcov -q --capture --directory ../../hostapd --output-file $LOGDIR/hostapd_lcov.info
+ genhtml -q $LOGDIR/hostapd_lcov.info --output-directory $LOGDIR/hostapd_lcov
+fi
+
if [ $errors -gt 0 ]; then
tar czf /tmp/hwsim-tests-$DATE-FAILED$SUFFIX.tar.gz $LOGDIR/
exit 1
--
1.8.3.2
More information about the Hostap
mailing list