tests: Add option to build before running all tests

Add an option --build to run-all.sh to build before starting to run all
the tests. In addition, add an option --codecov to extract the code
coverage data at the end of the run.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
This commit is contained in:
Ilan Peer 2014-10-27 10:00:54 -04:00 committed by Jouni Malinen
parent a7fe868dae
commit 5d60296ea7

View file

@ -28,6 +28,9 @@ unset VALGRIND
unset TRACE unset TRACE
unset TRACE_ARGS unset TRACE_ARGS
unset RUN_TEST_ARGS unset RUN_TEST_ARGS
unset BUILD
unset BUILD_ARGS
unset CODECOV
while [ "$1" != "" ]; do while [ "$1" != "" ]; do
case $1 in case $1 in
-v | --valgrind | valgrind) -v | --valgrind | valgrind)
@ -46,6 +49,17 @@ while [ "$1" != "" ]; do
shift shift
echo "$0: using channels=$NUM_CH" 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
;;
*) *)
RUN_TEST_ARGS="$RUN_TEST_ARGS$1 " RUN_TEST_ARGS="$RUN_TEST_ARGS$1 "
shift shift
@ -58,8 +72,12 @@ if [ ! -z "$RUN_TEST_ARGS" ]; then
fi fi
unset SUFFIX unset SUFFIX
if [ ! -z "$BUILD" ]; then
SUFFIX=-build
fi
if [ ! -z "$VALGRIND" ]; then if [ ! -z "$VALGRIND" ]; then
SUFFIX=-valgrind SUFFIX=$SUFFIX-valgrind
fi fi
if [ ! -z "$TRACE" ]; then if [ ! -z "$TRACE" ]; then
@ -67,6 +85,18 @@ if [ ! -z "$TRACE" ]; then
TRACE_ARGS="-T" TRACE_ARGS="-T"
fi 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 ! ./start.sh $VALGRIND $TRACE $NUM_CH; then
if ! [ -z "$LOGBASEDIR" ] ; then if ! [ -z "$LOGBASEDIR" ] ; then
echo "Could not start test environment" > $LOGDIR/run echo "Could not start test environment" > $LOGDIR/run
@ -85,6 +115,14 @@ if [ ! -z "$VALGRIND" ] ; then
errors=1 errors=1
fi fi
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 if [ $errors -gt 0 ]; then
tar czf /tmp/hwsim-tests-$DATE-FAILED$SUFFIX.tar.gz $LOGDIR/ tar czf /tmp/hwsim-tests-$DATE-FAILED$SUFFIX.tar.gz $LOGDIR/
exit 1 exit 1