2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright 2021 Mellanox Technologies, Ltd
5 # Check whether doc & code are in sync.
6 # Optional argument: check only what changed since a commit.
7 trusted_commit=$1 # example: origin/main
9 selfdir=$(dirname $(readlink -f $0))
10 rootdir=$(readlink -f $selfdir/..)
12 # speed up by ignoring Unicode details
19 result=$(($result + 1))
25 files=$(git diff-tree --name-only -r $trusted_commit..)
29 has_code_change() # <pattern>
31 test -n "$(git log --format='%h' -S"$1" $trusted_commit..)"
34 has_file_change() # <pattern>
36 changed_files | grep -q "$1"
41 net_paths='drivers/net/|doc/guides/nics/features/'
43 drivers=$(changed_files |
44 sed -rn "s,^($net_paths)([^./]*).*,\2,p" |
51 find $rootdir/drivers/net -mindepth 1 -maxdepth 1 -type d |
56 check_rte_flow() # <driver>
58 code=$rootdir/drivers/net/$1
59 doc=$rootdir/doc/guides/nics/features/$1.ini
60 [ -d $code ] || return 0
61 [ -f $doc ] || return 0
62 report=$($selfdir/parse-flow-support.sh $code $doc)
63 if [ -n "$report" ]; then
64 error "rte_flow doc out of sync for $1"
65 echo "$report" | sed 's,^,\t,'
69 if [ -z "$trusted_commit" ]; then
71 for driver in $(all_net_drivers); do
72 check_rte_flow $driver
77 # find what changed and check
78 if has_code_change 'RTE_FLOW_.*_TYPE_' ||
79 has_file_change 'doc/guides/nics/features'; then
80 for driver in $(changed_net_drivers); do
81 check_rte_flow $driver