[EDT] [PATCH] tests: Validate .config file for wpa_supplicant build

Amit Khatri amit.khatri at samsung.com
Fri Jun 12 01:17:52 EDT 2015



Hi Jouni
I have modified the script according to sh shell. Now it will work on both shells.

Subject: [PATCH] tests: Validate .config file for wpa_supplicant build and
 print warning message for hwsim build.

Signed-off-by: Amit Khatri <amit.khatri at samsung.com>
Signed-off-by: Rahul Jain <rahul.jain at samsung.com>
---
 tests/hwsim/build.sh | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tests/hwsim/build.sh b/tests/hwsim/build.sh
index 301c330..aa54dbe 100755
--- a/tests/hwsim/build.sh
+++ b/tests/hwsim/build.sh
@@ -4,6 +4,29 @@ set -e
 
 cd $(dirname $0)
 
+validate_config_file()
+{
+	temp=x$(grep 'CONFIG_P2P' .config | cut -c1) ;
+	if [ "$temp" = "x#" ]; then
+		echo "CONFIG_P2P is not enabled in .config file";
+		found=0;
+	fi
+	temp=x$(grep 'CONFIG_DEBUG_FILE' .config | cut -c1);
+	if [ "$temp" = "x#" ]; then
+		echo "CONFIG_DEBUG_FILE is not enabled in .config file";
+		found=0;
+	fi
+	temp=x$(grep 'CONFIG_DEBUG_LINUX_TRACING' .config | cut -c1);
+	if [ "$temp" = "x#" ]; then
+		echo "CONFIG_DEBUG_LINUX_TRACING is not enabled in .config file";
+		found=0;
+	fi
+	if [ "x$found" = "x0" ]; then
+		echo "Please check the above config options it may cause not to start wpa_supplicant for hwsim test";
+		echo "Either use -f or --force-config option";
+	fi
+}
+
 usage()
 {
 	echo "$0 [-c | --codecov] [-f | --force-config]"
@@ -61,6 +84,7 @@ if [ ! -e .config -o $force_config -eq 1 ]; then
     cp ../tests/hwsim/example-wpa_supplicant.config .config
 else
     echo "wpa_supplicant config file exists"
+    validate_config_file;
 fi
 
 if [ $use_lcov -eq 1 ]; then
-- 
1.9.1

Amit Khatri 

EP-000FDDED3B62486AA7D5E5FEC3026A62

------- Original Message -------
Sender : Jouni Malinen<j at w1.fi> 
Date   : Jun 11, 2015 03:19 (GMT+05:30)
Title  : Re: [EDT] [PATCH] tests: Validate .config file for wpa_supplicant build

On Wed, Jun 03, 2015 at 11:28:40AM +0000, Amit Khatri wrote:
> Subject: [PATCH] tests: Validate .config file for wpa_supplicant build and
>  print warning message for hwsim build.

> diff --git a/tests/hwsim/build.sh b/tests/hwsim/build.sh
> @@ -4,6 +4,24 @@ set -e

> +validate_config_file()
> +{
> +	temp=`grep CONFIG_P2P .config`;
> +	if [ `echo "${temp:0:1}"` == '#' ]; then

This won't work with some /bin/sh options, e.g., on Ubuntu 14.04:
./build.sh: 1: ./build.sh: Bad substitution
./build.sh: 10: [: ==: unexpected operator
./build.sh: 1: ./build.sh: Bad substitution
./build.sh: 14: [: ==: unexpected operator
./build.sh: 1: ./build.sh: Bad substitution
./build.sh: 18: [: ==: unexpected operator

> +	temp=`grep CONFIG_DEBUG_LINUX_TRACING .config`;
> +	if [ `echo "${temp:0:1}"` == '#' ]; then
> +		echo "CONFIG_DEBUG_LINUX_TRACING is not enabled in .config file";
> +	fi
> +	echo "Please check the above config options it may cause not to start wpa_supplicant";
> +	echo "Either use -f or --force-config option";

Wouldn't these lines be printed regardless of whether .config included
the needed parameters? If I replace /bin/sh with /bin/bash, I'll get
this output even with a successful build that includes all the needed
functionality:

tests/hwsim$ ./build.sh 
Building TNC testing tools
Building wlantest
Building hostapd
hostapd config file exists
Building wpa_supplicant
wpa_supplicant config file exists
Please check the above config options it may cause not to start wpa_supplicant
Either use -f or --force-config option

-- 
Jouni Malinen                                            PGP id EFC895FA
<p>&nbsp;</p><p>&nbsp;</p>


More information about the HostAP mailing list