Commit d39e9eff authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Tomasz Zawadzki
Browse files

check_so_deps: sort libraries in confirm_makefile_deps



While here, mark all local variables and change the way the error
message is printed (it helps to keep the output mangled due to the tests
being run in parallel).

Signed-off-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Change-Id: If26184c59199909c7fed1b7ee3a0757ff25dcc6c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/20842


Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarMichal Berger <michal.berger@intel.com>
parent 23b3340f
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -304,8 +304,11 @@ function get_lib_shortname() {
	echo "${lib//@(libspdk_|.so)/}"
}

# shellcheck disable=SC2005
sort_libs() { echo $(printf "%s\n" "$@" | sort); }

function confirm_deps() {
	local lib=$1 deplib lib_shortname
	local lib=$1 deplib lib_shortname symbols dep_names lib_make_deps found_symbol_lib

	lib_shortname=$(get_lib_shortname "$lib")
	lib_make_deps=(${!lib_shortname})
@@ -330,10 +333,11 @@ function confirm_deps() {
	diff=$(echo "${dep_names[@]}" "${lib_make_deps[@]}" | tr ' ' '\n' | sort | uniq -u)
	if [ "$diff" != "" ]; then
		touch $fail_file
		echo "there was a dependency mismatch in the library $lib_shortname"
		echo "The makefile (spdk.lib_deps.mk) lists: '${lib_make_deps[*]}'"
		echo "readelf outputs   : '${dep_names[*]}'"
		echo "---------------------------------------------------------------------"
		cat <<- MSG
			There was a dependency mismatch in the library $lib_shortname
			The makefile (spdk.lib_deps.mk) lists: '$(sort_libs "${lib_make_deps[@]}")'
			readelf outputs:                       '$(sort_libs "${dep_names[@]}")'
		MSG
	fi
}