Commit 48f70f48 authored by Pawel Wodkowski's avatar Pawel Wodkowski Committed by Jim Harris
Browse files

configure: add concistency check of CONFIG file vs CONFIG[@] array



If someone adds configure option in configure script but forgot to
update the CONFIG file following error will be printed:

$ ./configure
Using default SPDK env in /home/pwodkowx/Private/spdk/lib/env_dpdk
Using default DPDK in /home/pwodkowx/Private/spdk/dpdk/build

BUG: Some configuration option are not present in CONFIG file. Please
update this file.
Missing options in CONFIG (+) file and in current config (-):
--- CONFIG file
+++ CONFIG[@]
@@ -9,6 +9,7 @@
 CONFIG_ISCSI_INITIATOR
 CONFIG_LOG_BACKTRACE
 CONFIG_LTO
+CONFIG_MISSING_OPTION_IN_CONFIG_FILE
 CONFIG_PMDK
 CONFIG_PMDK_DIR
 CONFIG_PREFIX

Change-Id: If313a95caf9dc657fc81e78baf85ac86f20565e1
Signed-off-by: default avatarPawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/428086


Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent aaa691b0
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -364,6 +364,18 @@ if [[ "${CONFIG[CRYPTO]}" = "y" ]]; then
	fi
fi

# We are now ready to generate final configuration. But first do sanity
# check to see if all keys in CONFIG array have its reflection in CONFIG file.
if [ $(egrep -c "^\s*CONFIG_[[:alnum:]_]+\?=" CONFIG) -ne ${#CONFIG[@]} ]; then
	echo ""
	echo "BUG: Some configuration options are not present in CONFIG file. Please update this file."
	echo "Missing options in CONFIG (+) file and in current config (-): "
	diff -u --label "CONFIG file" --label "CONFIG[@]" \
		<(sed -r -e '/^\s*$/d; /^\s*#.*/d; s/(CONFIG_[[:alnum:]_]+)\?=.*/\1/g' CONFIG | sort) \
		<(printf "CONFIG_%s\n" ${!CONFIG[@]} | sort)
	exit 1
fi

echo -n "Creating CONFIG.local..."
cp -f CONFIG CONFIG.local
for key in ${!CONFIG[@]}; do