From 48f70f48cfdfac70be9643d64288675bf7d6ef27 Mon Sep 17 00:00:00 2001 From: Pawel Wodkowski Date: Wed, 3 Oct 2018 19:58:52 +0200 Subject: [PATCH] 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: Pawel Wodkowski Reviewed-on: https://review.gerrithub.io/428086 Chandler-Test-Pool: SPDK Automated Test System Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- configure | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/configure b/configure index 19615efcf..29a6efa36 100755 --- a/configure +++ b/configure @@ -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