scripts/check_format.sh: fix naming convention check.
I had previously implemented a portion of the naming convention check that looked for symbols that had been moved by performing two checks: git diff commit1 commit2 -- libname | grep for added function git diff commit2 commit1 --libname | grep for added functions and then subtracting the values returned by the second check from the values returned by the first check. That works as long as the two diffs are reciprocal (i.e. the first diff is a mirror image of the second). However, this has proven to not be the case. This change fixes that check by performing the smae diff twice and grepping for removed functions the same time. Change-Id: I09c81921d68436baeee706f2d9a6d30db1d23976 Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3229 Community-CI: Mellanox Build Bot Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
9aeaafa1bc
commit
5faea08e71
@ -233,7 +233,7 @@ for c_file in "${changed_c_libs[@]}"; do
|
||||
# Capture just the names of newly added (or modified) functions that start with "spdk_"
|
||||
mapfile -t defined_symbols < <(git diff -U0 $commit_to_compare HEAD -- $c_file | sed -En 's/(^[+])(spdk[a-z,A-Z,0-9,_]*)(\(.*)/\2/p')
|
||||
# Capture the names of removed symbols to catch edge cases where we just move definitions around.
|
||||
mapfile -t removed_symbols < <(git diff -U0 HEAD $commit_to_compare -- $c_file | sed -En 's/(^[+])(spdk[a-z,A-Z,0-9,_]*)(\(.*)/\2/p')
|
||||
mapfile -t removed_symbols < <(git diff -U0 $commit_to_compare HEAD -- $c_file | sed -En 's/(^[-])(spdk[a-z,A-Z,0-9,_]*)(\(.*)/\2/p')
|
||||
for symbol in "${removed_symbols[@]}"; do
|
||||
defined_symbols=("${defined_symbols[@]/$symbol/}")
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user