From 9f6a32430179fc3f3fb69461a7e974a433dc427f Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 19 Jul 2022 23:24:34 +0000 Subject: [PATCH] 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: Jim Harris Change-Id: I90895efd22c1594044f3c3f9344bb3a67a754c4b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13728 Tested-by: SPDK CI Jenkins Reviewed-by: Konrad Sztyber Reviewed-by: Changpeng Liu --- test/make/check_so_deps.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/make/check_so_deps.sh b/test/make/check_so_deps.sh index 251b87293..1b50ae55e 100755 --- a/test/make/check_so_deps.sh +++ b/test/make/check_so_deps.sh @@ -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"