diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index 54b9e07f5..7200f29e5 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -74,7 +74,7 @@ jobs: workdir="/tmp/scst-${version}" out="output.txt" - ./scripts/kernel/run-regression-tests -l -q -d "${workdir}" "${version}-nc-ns-nm" | tee "${out}" + ./scripts/kernel/run-regression-tests -l -q -d "${workdir}" "${version}-nc" | tee "${out}" if ! grep -q "Compiling the patched kernel" "${out}"; then echo "::error title=Regression tests::run-regression-tests failed" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 629fdc292..343e87de6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -148,9 +148,13 @@ in `.github/workflows/ci.yml` and `.github/workflows/coverity.yml`. `make ginkgo-check` checks the framework only; follow the guide before running tests that load modules or access storage. -`scripts/kernel/run-regression-tests` checks kernel compatibility, compilation, -sparse and smatch. It downloads or prepares kernel trees and is separate -from the lightweight local checks above. The nightly support matrix is +`make sparse` and `make smatch` analyze the configured modules; use +`KUNIT_TEST=y` to include KUnit sources. Their policies and reports are described +in the [scripts guide](scripts/README.md#sparse-and-smatch). + +`scripts/kernel/run-regression-tests` checks kernel compatibility through +compilation and checkpatch. It downloads or prepares kernel trees and is +separate from the analyzer targets above. The nightly support matrix is `ABT_KERNELS` in `nightly/conf/nightly.conf`; CI exercises a subset in `.github/workflows/run_regression_tests.yaml`. diff --git a/scripts/README.md b/scripts/README.md index 8401f6036..38c617395 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -18,8 +18,8 @@ direct callers of a relocated script must use its new directory below. The existing `checkpatch`, `checkpatch_commits`, `checkpatch_diff`, and `checkpatch_scan` entry points remain directly under `scripts/`. The wrapper's diagnostic ignore list is in `checkpatch`; whole-tree scan exclusions are in -`checkpatch_scan`. The kernel regression runner retains its separate analyzer -commands and filtering. Moving the tools does not change these policies. +`checkpatch_scan`. The kernel regression runner retains its separate checkpatch +command and filtering; Sparse and Smatch use the dedicated Make targets below. Use Make targets from the repository root unless a component workflow says otherwise. Direct scripts retain their working-directory conventions: @@ -28,8 +28,8 @@ generation and source inventory use the requested or current source directory. Module Makefiles invoke `sign-modules` from the directory containing modules. Consult each script's argument handling before invoking it. -`kernel/run-regression-tests` prepares kernel trees and runs compilation, -checkpatch, sparse, and smatch according to its options. The maintained kernel +`kernel/run-regression-tests` prepares kernel trees and runs compilation and +checkpatch according to its options. The maintained kernel matrix is `ABT_KERNELS` in `nightly/conf/nightly.conf`; the CI subset is selected through `kernel/kernel-matrix` and `.github/kernel-matrix.conf`. diff --git a/scripts/kernel/kernel-matrix b/scripts/kernel/kernel-matrix index 997b9ea68..31c2b036f 100644 --- a/scripts/kernel/kernel-matrix +++ b/scripts/kernel/kernel-matrix @@ -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 ;; diff --git a/scripts/kernel/run-regression-tests b/scripts/kernel/run-regression-tests index 14bd48814..b2251dfc9 100755 --- a/scripts/kernel/run-regression-tests +++ b/scripts/kernel/run-regression-tests @@ -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 :/g" \ - -e "s/context problem in '[^']*': '[^']*'/context problem in : /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 "${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"