[PATCH 1/8] tests: Add an option to build with code coverage

Ilan Peer ilan.peer
Sun Oct 26 00:06:28 PDT 2014


Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 tests/hwsim/build.sh | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tests/hwsim/build.sh b/tests/hwsim/build.sh
index 06ea424..b795f62 100755
--- a/tests/hwsim/build.sh
+++ b/tests/hwsim/build.sh
@@ -4,16 +4,50 @@ set -e
 
 cd $(dirname $0)
 
+use_lcov=0
+while [ "$1" != "" ]; do
+	case $1 in
+		-c | --codecov ) shift
+			echo "$0: use code coverage specified"
+			use_lcov=1
+			;;
+		* ) exit 1
+	esac
+done
+
 cd ../../wpa_supplicant
 if [ ! -e .config ]; then
     cp ../tests/hwsim/example-wpa_supplicant.config .config
+else
+    echo "Wpa_supplicant config file exits"
+fi
+
+if [ $use_lcov -eq 1 ]; then
+    if ! grep -q CONFIG_CODE_COVERAGE .config; then
+	    echo CONFIG_CODE_COVERAGE=y >> .config
+    else
+	    echo "CONFIG_CODE_COVERAGE already exists in wpa_supplicant/.conig. Ignore"
+    fi
 fi
+
 make clean
 make -j8
+
 cd ../hostapd
 if [ ! -e .config ]; then
     cp ../tests/hwsim/example-hostapd.config .config
+else
+    echo "hostapd config file exits"
+fi
+
+if [ $use_lcov -eq 1 ]; then
+    if ! grep -q CONFIG_CODE_COVERAGE .config; then
+	    echo CONFIG_CODE_COVERAGE=y >> .config
+    else
+	    echo "CONFIG_CODE_COVERAGE already exists in hostapd/.conig. Ignore"
+    fi
 fi
+
 make clean
 make -j8 hostapd hlr_auc_gw
 cd ../wlantest
-- 
1.8.3.2




More information about the Hostap mailing list