mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-21 12:41:26 +00:00
The patch below implements the following modifications for
scripts/run-regression-tests: - Adds a description about what the script does. - Added command-line option -c which allows to specify which directory to use as cache for kernel tar balls and patch files. - More error checking. - scst_local is now included in all the tests. - Swapped the order of two test steps, namely compiling the whole tree and running sparse. This way the output of the sparse tool is available a lot sooner. Signed-off-by: Bart Van Assche <bart.vanassche@gmail.com> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@574 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -18,12 +18,41 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
############################################################################
|
||||
# This script performs the following actions:
|
||||
# - Creates a temporary directory for storing the output of the regression
|
||||
# tests. No existing files are modified by this script.
|
||||
# - Verifies whether the top-level *.patch files apply cleanly to the SCST
|
||||
# tree.
|
||||
# - Duplicates the entire source tree to the temporary directory and
|
||||
# compiles the SCST source code.
|
||||
# - Duplicates the entire source tree to the temporary directory, applies
|
||||
# the full-perf patches and again compiles the SCST source code.
|
||||
# - Checks whether the kernel version specified through option -k is present
|
||||
# in the directory specified through option -c.
|
||||
# - If the source code of the kernel specified through -k is not present,
|
||||
# download it.
|
||||
# - Convert the SCST source code into a kernel patch.
|
||||
# - Extract the kernel sources.
|
||||
# - 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.
|
||||
# - Compile the kernel tree.
|
||||
#
|
||||
# Note: the results of the individual steps are not verified by this script
|
||||
# -- the output generated by the individual steps has to be verified by
|
||||
# reviewing the output files written into the temporary directory.
|
||||
############################################################################
|
||||
|
||||
|
||||
########################
|
||||
# Function definitions #
|
||||
########################
|
||||
|
||||
function usage {
|
||||
echo "Usage: $0 [-h] [-k <kver1>] [-k <kver2>] ..."
|
||||
echo "Usage: $0 [-c] [-h] [-k <kver1>] [-k <kver2>] ..."
|
||||
echo " -c - cache directory for Linux kernel tarballs."
|
||||
echo " -h - display this help information."
|
||||
echo " -k <kver> - kernel version to use during test."
|
||||
}
|
||||
@@ -58,10 +87,10 @@ function extract_kernel_tree {
|
||||
mkdir "${tmpdir}" || return $?
|
||||
(
|
||||
cd "${tmpdir}" || return $?
|
||||
tar xjf "${downloads}/linux-${kver}.tar.bz2"
|
||||
tar xjf "${kernel_sources}/linux-${kver}.tar.bz2" || return $?
|
||||
cd "linux-${kver}" || return $?
|
||||
if [ "${plevel}" != "" ]; then
|
||||
bzip2 -cd "${downloads}/patch-$1.bz2" | patch -p1 -f -s || return $?
|
||||
bzip2 -cd "${kernel_sources}/patch-$1.bz2" | patch -p1 -f -s || return $?
|
||||
fi
|
||||
cd ..
|
||||
mv "linux-${kver}" "../linux-$1"
|
||||
@@ -101,17 +130,15 @@ function compile_scst_unpatched {
|
||||
if mkdir -p "${workingdirectory}" \
|
||||
&& cd "${workingdirectory}" \
|
||||
&& duplicate_scst_source_tree "${scst}" \
|
||||
&& [ $(( make -s clean \
|
||||
&& make -s scst iscsi-scst \
|
||||
&& ([ "${scst_local}" = "true" ] && make -C scst_local clean) \
|
||||
&& ([ "${scst_local}" = "true" ] && make -C scst_local -s ) \
|
||||
&& ([ "${mpt_scst}" = "true" ] && make -C mpt clean) \
|
||||
&& ([ "${mpt_scst}" = "true" ] && make -C mpt -s ) \
|
||||
&& make -C srpt -s clean \
|
||||
&& make -C srpt -s ) 2>&1 \
|
||||
| tee "${outputfile}" \
|
||||
| grep -vE 'warning.*Patch scst_exec_req_fifo-|^ Building'\
|
||||
| wc --lines) = 0 ]
|
||||
&& (make -s clean \
|
||||
&& make -s scst iscsi-scst \
|
||||
&& if "${scst_local}" = "true" ; then make -C scst_local clean; fi \
|
||||
&& if "${scst_local}" = "true" ; then make -C scst_local -s ; fi \
|
||||
&& if "${mpt_scst}" = "true" ; then make -C mpt clean; fi \
|
||||
&& if "${mpt_scst}" = "true" ; then make -C mpt -s ; fi \
|
||||
&& make -C srpt -s clean \
|
||||
&& make -C srpt -s ) \
|
||||
>& "${outputfile}"
|
||||
then
|
||||
true
|
||||
else
|
||||
@@ -135,17 +162,15 @@ function compile_scst_patched {
|
||||
&& patch -p0 -f -s <"${scst}/iscsi-full_perf.patch" \
|
||||
&& patch -p0 -f -s <"${scst}/qla2x00t-full_perf.patch" \
|
||||
&& patch -p0 -f -s <"${scst}/scst-full_perf.patch" \
|
||||
&& [ $(( make -s clean \
|
||||
&& make -s scst iscsi-scst \
|
||||
&& ([ "${scst_local}" = "true" ] && make -C scst_local clean) \
|
||||
&& ([ "${scst_local}" = "true" ] && make -C scst_local -s ) \
|
||||
&& ([ "${mpt_scst}" = "true" ] && make -C mpt clean) \
|
||||
&& ([ "${mpt_scst}" = "true" ] && make -C mpt -s ) \
|
||||
&& make -C srpt -s clean \
|
||||
&& make -C srpt -s ) 2>&1 \
|
||||
| tee "${outputfile}" \
|
||||
| grep -vE 'warning.*Patch scst_exec_req_fifo-|^ Building'\
|
||||
| wc --lines) = 0 ]
|
||||
&& (make -s clean \
|
||||
&& make -s scst iscsi-scst \
|
||||
&& if "${scst_local}" = "true" ; then make -C scst_local clean; fi \
|
||||
&& if "${scst_local}" = "true" ; then make -C scst_local -s ; fi \
|
||||
&& if "${mpt_scst}" = "true" ; then make -C mpt clean; fi \
|
||||
&& if "${mpt_scst}" = "true" ; then make -C mpt -s ; fi \
|
||||
&& make -C srpt -s clean \
|
||||
&& make -C srpt -s ) \
|
||||
>& "${outputfile}"
|
||||
then
|
||||
true
|
||||
else
|
||||
@@ -158,22 +183,27 @@ function compile_scst_patched {
|
||||
function download_file {
|
||||
if [ ! -e "$(basename "$1")" ]; then
|
||||
echo "Downloading $1 ..."
|
||||
wget -q -nc "$1"
|
||||
if ! wget -q -nc "$1"; then
|
||||
echo "Downloading $1 failed."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Make sure the kernel tarball and patch file are present in directory
|
||||
# ${downloads}. Download any missing files from ${kernel_mirror}.
|
||||
# ${kernel_sources}. Download any missing files from ${kernel_mirror}.
|
||||
function download_kernel {
|
||||
local kver="$(kernel_version $1)"
|
||||
local plevel="$(patchlevel $1)"
|
||||
|
||||
mkdir -p "${downloads}" || return $?
|
||||
mkdir -p "${kernel_sources}" || return $?
|
||||
test -w "${kernel_sources}" || return $?
|
||||
(
|
||||
cd "${downloads}" || return $?
|
||||
download_file "${kernel_mirror}/linux-$(kernel_version $1).tar.bz2"
|
||||
cd "${kernel_sources}" || return $?
|
||||
download_file "${kernel_mirror}/linux-$(kernel_version $1).tar.bz2" \
|
||||
|| return $?
|
||||
if [ "${plevel}" != "" ]; then
|
||||
download_file "${kernel_mirror}/patch-$1.bz2"
|
||||
download_file "${kernel_mirror}/patch-$1.bz2" || return $?
|
||||
fi
|
||||
)
|
||||
}
|
||||
@@ -225,23 +255,30 @@ function run_checkpatch {
|
||||
return 0
|
||||
}
|
||||
|
||||
function patch_and_configure_kernel {
|
||||
local patchfile="${outputdir}/scst-$1-kernel.patch"
|
||||
|
||||
echo "Patching and configuring kernel $1 ..."
|
||||
generate_kernel_patch "$1" > "${patchfile}"
|
||||
(
|
||||
cd "${outputdir}/linux-$1" \
|
||||
&& patch -p1 -f -s <"${patchfile}" \
|
||||
>"${outputdir}/patch-command-output.txt" \
|
||||
&& make -s allmodconfig &>/dev/null
|
||||
)
|
||||
}
|
||||
|
||||
# Patches and compiles a kernel tree. Assumes that there is a vanilla kernel
|
||||
# tree present in directory "${outputdir}/linux-$1".
|
||||
function compile_patched_kernel {
|
||||
local kver="$(kernel_version $1)"
|
||||
local plevel="$(patchlevel $1)"
|
||||
local outputfile="${outputdir}/kernel-$1-compilation-output.txt"
|
||||
local patchfile="${outputdir}/scst-$1-kernel.patch"
|
||||
|
||||
echo "Patching and compiling kernel $1 ..."
|
||||
echo "Compiling kernel $1 ..."
|
||||
(
|
||||
generate_kernel_patch "$1" > "${patchfile}"
|
||||
(
|
||||
cd "${outputdir}/linux-$1" && patch -p1 -f -s <"${patchfile}"
|
||||
)
|
||||
(
|
||||
cd "${outputdir}/linux-$1" \
|
||||
&& make -s allmodconfig \
|
||||
&& LC_ALL=C make -s -k -j3 bzImage modules
|
||||
)
|
||||
) >& "${outputfile}"
|
||||
@@ -250,8 +287,7 @@ function compile_patched_kernel {
|
||||
}
|
||||
|
||||
# Run the source code verification tool 'sparse' on the SCST code. Assumes that
|
||||
# there is a patched and compiled kernel tree present in directory
|
||||
# "${outputdir}/linux-$1".
|
||||
# there is a patched kernel tree present in directory "${outputdir}/linux-$1".
|
||||
function run_sparse {
|
||||
local kver="$(kernel_version $1)"
|
||||
local plevel="$(patchlevel $1)"
|
||||
@@ -261,6 +297,7 @@ function run_sparse {
|
||||
(
|
||||
cd "${outputdir}/linux-$1" \
|
||||
&& make -s prepare \
|
||||
&& make -s scripts \
|
||||
&& LC_ALL=C make -s -k C=2 M=drivers/scst
|
||||
) >& "${outputfile}"
|
||||
echo "See also ${outputfile}."
|
||||
@@ -278,7 +315,7 @@ if [ ! -e scst -o ! -e iscsi-scst -o ! -e srpt ]; then
|
||||
fi
|
||||
|
||||
# Where to store persistenly downloaded kernel tarballs and kernel patches.
|
||||
downloads="$HOME/software/downloads"
|
||||
kernel_sources="$HOME/software/downloads"
|
||||
# URL for downloading kernel tarballs and kernel patches.
|
||||
kernel_mirror="ftp://ftp.eu.kernel.org/pub/linux/kernel/v2.6"
|
||||
kernel_versions=""
|
||||
@@ -287,12 +324,13 @@ outputdir=$PWD/regression-test-output-$(date +%Y-%m-%d_%Hh%Mm%Ss)
|
||||
# Driver configuration.
|
||||
mpt_scst="false"
|
||||
qla2x00t="false"
|
||||
scst_local="false"
|
||||
scst_local="true"
|
||||
|
||||
set -- $(/usr/bin/getopt "hk:" "$@")
|
||||
set -- $(/usr/bin/getopt "c:hk:" "$@")
|
||||
while [ "$1" != "${1#-}" ]
|
||||
do
|
||||
case "$1" in
|
||||
'-c') kernel_sources="$2"; shift; shift;;
|
||||
'-h') usage; exit 1;;
|
||||
'-k') kernel_versions="${kernel_versions} $2"; shift; shift;;
|
||||
'--') shift;;
|
||||
@@ -307,9 +345,8 @@ fi
|
||||
|
||||
# Default kernel versions to use for the test.
|
||||
if [ "${kernel_versions}" = "" ]; then
|
||||
#kernel_versions="2.6.24.7 2.6.25.19 2.6.26.7 2.6.27.3"
|
||||
kernel_versions="2.6.26.7 2.6.27.3"
|
||||
kernel_versions="2.6.27.3"
|
||||
#kernel_versions="2.6.24.7 2.6.25.20 2.6.26.8 2.6.27.6"
|
||||
kernel_versions="2.6.27.6"
|
||||
fi
|
||||
|
||||
|
||||
@@ -326,18 +363,12 @@ compile_scst_patched || exit $?
|
||||
|
||||
for k in ${kernel_versions}
|
||||
do
|
||||
download_kernel $k
|
||||
if test_if_patch_applies_cleanly $k; then
|
||||
if download_kernel $k && test_if_patch_applies_cleanly $k; then
|
||||
run_checkpatch $k
|
||||
patch_and_configure_kernel $k
|
||||
run_sparse $k
|
||||
compile_patched_kernel $k
|
||||
else
|
||||
echo "FAILED for kernel $k"
|
||||
fi
|
||||
done
|
||||
|
||||
for k in ${kernel_versions}
|
||||
do
|
||||
compile_patched_kernel $k
|
||||
done
|
||||
|
||||
for k in ${kernel_versions}
|
||||
do
|
||||
run_sparse $k
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user