Commit 9f6a3243 authored by Jim Harris's avatar Jim Harris Committed by Konrad Sztyber
Browse files

test: avoid private and public headers w/ same name



abidiff gets confused if a data structure in a
private header files is changed, if there is also
a public header file with the same name.  So avoid
this by forbidding private header files from having
the same name as a public header (i.e. one in
include/spdk or include/spdk_internal).

This was mostly already handled by using names like
nvme_internal.h, but we did have a few conflicts
which were causing our check_so_deps.sh script to
sometimes indicate a version bump was needed when
it really wasn't.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I90895efd22c1594044f3c3f9344bb3a67a754c4b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13728


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent dbecab8d
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -32,6 +32,31 @@ if [[ "$spdk_tag" == "$spdk_lts_tag" ]]; then
fi
source_abi_dir="$HOME/$repo/build/lib"

function check_header_filenames() {
	local dups_found=0

	xtrace_disable

	include_headers=$(git ls-files -- include/spdk include/spdk_internal | xargs -n 1 basename)
	dups=
	for file in $include_headers; do
		if [[ $(git ls-files "lib/**/$file" "module/**/$file" --error-unmatch 2> /dev/null) ]]; then
			dups+=" $file"
			dups_found=1
		fi
	done

	xtrace_restore

	if ((dups_found == 1)); then
		echo "Private header file(s) found with same name as public header file."
		echo "This is not allowed since it can confuse abidiff when determining if"
		echo "data structure changes impact ABI."
		echo $dups
		return 1
	fi
}

function confirm_abi_deps() {
	local processed_so=0
	local abidiff_output
@@ -251,6 +276,8 @@ function confirm_makefile_deps() {
	)
}

run_test "check_header_filenames" check_header_filenames

config_params=$(get_config_params)
if [ "$SPDK_TEST_OCF" -eq 1 ]; then
	config_params="$config_params --with-ocf=$rootdir/ocf.a"