scripts: Retire legacy Sparse and Smatch regression wrappers

Use the dedicated native analyzer targets instead of regression wrappers
that return success after tool failures and summarize filtered output.

Remove their suffix switches and the analyzer-only IBM VIO option.
Update the regression caller and kernel-option parser together; the
maintained kernel list and compilation matrix are unchanged. Keep legacy
Checkpatch until its own integration series.
This commit is contained in:
Gleb Chesnokov
2026-10-19 21:38:56 +03:00
parent 2f8ff7ea63
commit 791f5e6e2d
5 changed files with 12 additions and 120 deletions
-3
View File
@@ -28,11 +28,8 @@ strip_kernel_options() {
while true; do
case "${stripped_kernel}" in
*-nc) stripped_kernel="${stripped_kernel%-nc}" ;;
*-ns) stripped_kernel="${stripped_kernel%-ns}" ;;
*-nm) stripped_kernel="${stripped_kernel%-nm}" ;;
*-4) stripped_kernel="${stripped_kernel%-4}" ;;
*-f) stripped_kernel="${stripped_kernel%-f}" ;;
*-i) stripped_kernel="${stripped_kernel%-i}" ;;
*-u) stripped_kernel="${stripped_kernel%-u}" ;;
*-p) stripped_kernel="${stripped_kernel%-p}" ;;
*) return ;;
-109
View File
@@ -37,7 +37,6 @@
# - Run checkpatch on the SCST kernel patch.
# - Apply the SCST kernel patch to the kernel tree.
# - Run 'make allmodconfig'.
# - Run the sparse source code checker on the SCST directory.
# - Run 'make headers_check'.
# - Compile the kernel tree.
# - Run 'make checkstack'.
@@ -432,84 +431,6 @@ function compile_kernel {
return 0
}
# Run the source code verification tool 'sparse' on the SCST code. Assumes that
# there is a patched kernel tree present in directory "${outputdir}/linux-$1".
# For more information about endianness annotations, see also
# http://lwn.net/Articles/205624/.
function run_sparse {
local k="$1"
local kver plevel
kver="$(kernel_version "$1")"
plevel="$(patchlevel "$1")"
local outputfile="${outputdir}/sparse-$1-output.txt"
shift
echo "Running sparse on the patched kernel in $* ..."
if (cd "${outputdir}/linux-$k" \
&& make -s modules_prepare \
&& make -s scripts \
&& if grep -q '^CONFIG_PPC=y$' .config; then LC_ALL=C KBUILD_MODPOST_WARN=1 make -k M=arch/powerpc/lib; fi \
&& for subdir; do
LC_ALL=C KBUILD_MODPOST_WARN=1 make -k C=2 CF="-D__CHECK_ENDIAN__ -DCONFIG_SPARSE_RCU_POINTER" M="${subdir}"
done
) &> "${outputfile}"
then
local errors warnings
errors=$(grep -c ' error:' "${outputfile}")
warnings=$(grep -c ' warning:' "${outputfile}")
echo "${errors} errors / ${warnings} warnings."
grep -E ' warning:| error:' < "${outputfile}" \
| sed -e 's/^[^:]*:[0-9:]* //' \
-e "s/context imbalance in '[^']*':/context imbalance in <function>:/g" \
-e "s/context problem in '[^']*': '[^']*'/context problem in <function>: <function>/g" \
-e "s/function '[^']*'/function/g" \
-e "s/symbol '[^']*'/symbol/g" \
| sort \
| uniq -c
else
echo FAILED
fi
return 0
}
# Run smatch for kernel version $1 on directories $2..$n
function run_smatch {
local k="$1"
local kver plevel
kver="$(kernel_version "$1")"
plevel="$(patchlevel "$1")"
local outputfile="${outputdir}/smatch-$1-output.txt"
local disable="" # "CONFIG_DYNAMIC_DEBUG"
shift
echo "Running smatch on the patched kernel in $* ..."
if (cd "${outputdir}/linux-$k" &&
for c in $disable; do sed -i.tmp "s/^$c=y\$/$c=n/" .config; done &&
make -s oldconfig </dev/null &&
make -s modules_prepare &&
make -s scripts &&
if grep -q '^CONFIG_PPC=y$' .config; then LC_ALL=C KBUILD_MODPOST_WARN=1 make -k M=arch/powerpc/lib; fi &&
for subdir; do
LC_ALL=C KBUILD_MODPOST_WARN=1 make -k CHECK="smatch -p=kernel" C=2 CF=-D__CHECK_ENDIAN__ M="${subdir}"
done
) &> "${outputfile}"
then
local errors warnings
errors=$(grep -c ' error:' "${outputfile}")
warnings=$(grep -c ' warn:' "${outputfile}")
echo "${errors} errors / ${warnings} warnings."
grep -E ' info:| warn:| error:' < "${outputfile}" |
sed 's/^\([^:]*\):[0-9:]* /\1: /;s/\((see line \)[0-9]*\()\)/\1...\2/' |
sort |
uniq -c
else
echo FAILED
fi
return 0
}
function run_checkstack {
local kver plevel
kver="$(kernel_version "$1")"
@@ -674,10 +595,7 @@ do
full_check="false"
generate_kernel_patch_options=""
ibmvio="false"
run_checkpatch="true"
run_sparse="true"
run_smatch="true"
ipv6="true"
while true; do
kv_without_opt="${kv%-?}"
@@ -688,10 +606,7 @@ do
case "${kopt}" in
'-4') ipv6="false";;
'-f') full_check="true";;
'-i') ibmvio="true";;
'-nc') run_checkpatch="false";;
'-ns') run_sparse="false";;
'-nm') run_smatch="false";;
'-u') generate_kernel_patch_options="-u";;
'-p') multiple_patches="true";;
*) break;;
@@ -729,30 +644,6 @@ do
done
export KCFLAGS
subdirs=(drivers/scst drivers/scsi/qla2xxx)
if [ "${run_sparse}" = "true" ]; then
if [ "$(type -p sparse)" = "" ]; then
echo "Error: sparse has not yet been installed."
echo "See also http://www.kernel.org/pub/software/devel/sparse/."
else
run_sparse "$k" "${subdirs[@]}"
mv "${outputdir}/sparse-$k-output.txt" \
"${outputdir}/sparse-$k-scst-output.txt"
if [ "${ibmvio}" = "true" ]; then
run_sparse "$k" drivers/scsi libsrp.ko scsi_sysfs.ko \
scsi_transport_fc.ko scsi_transport_srp.ko
mv "${outputdir}/sparse-$k-output.txt" \
"${outputdir}/sparse-$k-scsi-output.txt"
fi
fi
fi
if [ "${run_smatch}" = "true" ]; then
if [ "$(type -p smatch)" = "" ]; then
echo "Error: smatch has not yet been installed."
echo "See also http://smatch.sourceforge.net/."
else
run_smatch "$k" "${subdirs[@]}"
fi
fi
compile_kernel "$k" "${subdirs[@]}"
if [ "${full_check}" = "true" ]; then
run_headers_check "$k"