########################
function usage {
- echo "Usage: $0 [-c] [-h] [-k <kver1>] [-k <kver2>] ..."
+ echo "Usage: $0 [-c] [-f] [-h] [-j] [-k <kver1>] [-k <kver2>] ..."
echo " -c - cache directory for Linux kernel tarballs."
echo " -f - full check -- do not only compile SCST but the whole" \
"kernel tree."
echo " -h - display this help information."
+ echo " -j - number of jobs that 'make' should run simultaneously."
echo " -k <kver> - kernel version to use during test."
}
# Generate a kernel patch from the SCST source tree for kernel version $1.
function generate_kernel_patch {
+ local scst_dir="${PWD}"
+ local kver="$(kernel_version $1)"
+ local patchfile="${outputdir}/scst-$1-kernel.patch"
+
+ SIGNED_OFF_BY="..." \
scripts/generate-kernel-patch \
$([ "${scst_local}" = "true" ] && echo -- "-l") \
$([ "${mpt_scst}" = "true" ] && echo -- "-m") \
$([ "${qla2x00t}" = "true" ] && echo -- "-q") \
- $1
+ ${kver} > "${patchfile}"
}
# Generate a kernel patch through scripts/generate-kernel-patch and test
local kver="$(kernel_version $1)"
local plevel="$(patchlevel $1)"
local outputfile="${outputdir}/kernel-$1-patch-output.txt"
+ local patchfile="${outputdir}/scst-$1-kernel.patch"
local rc=0
echo "Testing whether the generated kernel patch applies cleanly ..."
( cd "${outputdir}" && extract_kernel_tree "$1" )
- generate_kernel_patch $1 \
- | (cd "${outputdir}/linux-$1" && patch -p1 --dry-run -f &> "${outputfile}")
+ ( cd "${outputdir}/linux-$1" \
+ && patch -p1 --dry-run -f < "${patchfile}" &> "${outputfile}" )
if [ $? != 0 ]; then
echo "FAILED"
rc=1
local kver="$(kernel_version $1)"
local plevel="$(patchlevel $1)"
local outputfile="${outputdir}/checkpatch-$1-output.txt"
+ local patchfile="${outputdir}/scst-$1-kernel.patch"
if [ -e "${outputdir}/linux-$1/scripts/checkpatch.pl" ]
then
echo "Running checkpatch on the SCST kernel patch ..."
- generate_kernel_patch $1 \
- | (cd "${outputdir}/linux-$1" && scripts/checkpatch.pl - &> "${outputfile}")
+ ( cd "${outputdir}/linux-$1" \
+ && scripts/checkpatch.pl - < "${patchfile}" &> "${outputfile}")
local errors=$(grep -c '^ERROR' "${outputfile}")
local warnings=$(grep -c '^WARNING' "${outputfile}")
echo "${errors} errors / ${warnings} warnings."
local patchfile="${outputdir}/scst-$1-kernel.patch"
echo "Patching and configuring kernel ..."
- SIGNED_OFF_BY="..." generate_kernel_patch "$1" > "${patchfile}"
(
cd "${outputdir}/linux-$1" \
&& patch -p1 -f -s <"${patchfile}" \
&& LC_ALL=C make -k C=2 M=drivers/scst # CF=-D__CHECK_ENDIAN__
) &> "${outputfile}"
local errors=$(grep -c ' error:' "${outputfile}")
- local warnings=$(grep -vE 'expected different context|wanted >= [01], got |warning: potentially expensive pointer subtraction$' "${outputfile}" | grep -c ' warning:')
+ local warnings=$(grep -c ' warning:' "${outputfile}")
echo "${errors} errors / ${warnings} warnings."
cat "${outputfile}" \
- | grep -vE 'expected different context|wanted >= [01], got |warning: potentially expensive pointer subtraction$' \
- | grep '^[^ ]' \
- | sed 's/.*: //' \
+ | grep -E 'warning:|error:' \
+ | sed -e 's/^[^ ]*:[^ ]*:[^ ]*: //' -e "s/'[^']*'/<function>/g" \
| sort \
| uniq -c
return 0
# URL for downloading kernel tarballs and kernel patches.
kernel_mirror="ftp://ftp.eu.kernel.org/pub/linux/kernel/v2.6"
kernel_versions=""
-# Directory in which the regression test output files will be stored.
-outputdir=$PWD/regression-test-output-$(date +%Y-%m-%d_%Hh%Mm%Ss)
+# Directory in which the regression test output files will be stored. Must be
+# an absolute path.
+outputdir="${PWD}/regression-test-output-$(date +%Y-%m-%d_%Hh%Mm%Ss)"
# Driver configuration.
mpt_scst="false"
qla2x00t="false"
'-c') kernel_sources="$2"; shift; shift;;
'-f') full_check="true"; shift;;
'-h') usage; exit 1;;
+ '-j') export MAKEFLAGS="-j$2"; shift; shift;;
'-k') kernel_versions="${kernel_versions} $2"; shift; shift;;
'--') shift;;
*) usage; exit 1;;
rm -rf "${outputdir}"
mkdir -p "${outputdir}" || exit $?
-MAKEFLAGS=-j3
-
test_scst_tree_patches || exit $?
compile_scst_unpatched || exit $?
compile_scst_patched || exit $?
printf "= kernel %-9s =\n" "${k}"
echo "===================="
- if download_kernel $k && test_if_patch_applies_cleanly $k; then
- run_checkpatch $k
- patch_and_configure_kernel $k
- run_sparse $k
- run_headers_check $k
- if [ "${full_check}" = "true" ]; then
- compile_patched_kernel $k
- run_checkstack $k
- run_namespacecheck $k
- run_make_htmldocs $k
- fi
- else
- echo "FAILED for kernel $k"
- fi
+ download_kernel $k || continue
+ generate_kernel_patch $k || continue
+ test_if_patch_applies_cleanly $k || continue
+ run_checkpatch $k
+ patch_and_configure_kernel $k
+ run_sparse $k
+ run_headers_check $k
+ [ "${full_check}" = "true" ] || continue
+ compile_patched_kernel $k
+ run_checkstack $k
+ run_namespacecheck $k
+ run_make_htmldocs $k
done