scripts/run-regression-tests: Add support for distro kernels

A few examples of how to run the regression tests against a distro kernel:

scripts/run-regression-tests -l 4.18.0-147.5.1.el8_1^CentOS^8.1.1911-nc
scripts/run-regression-tests -l 4.18.0-80.11.2.el8_0^CentOS^8.0.1905-nc
scripts/run-regression-tests -l 3.10.0-1127.el7^CentOS^7.8.2003-nc
scripts/run-regression-tests -l 3.10.0-1062.18.1.el7^CentOS^7.7.1908-nc
scripts/run-regression-tests -l 3.10.0-957.27.2.el7^CentOS^7.6.1810-nc
scripts/run-regression-tests -l 3.10.0-862.14.4.el7^CentOS^7.5.1804-nc



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8885 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2020-05-09 22:54:47 +00:00
parent b3b658bd09
commit 6773f8e9a5
7 changed files with 91 additions and 29 deletions
+2 -1
View File
@@ -15,7 +15,8 @@ fi
mkdir -p qla2xxx-orig
cd qla2xxx-orig || exit $?
download_and_extract_kernel_tree "${kernel_version}"
download_and_extract_kernel_tree "${kernel_version}" || exit $?
kernel_version=${kernel_version/^*}
touch "linux-${kernel_version}"/drivers/scsi/qla2xxx/*
rm -rf "${kernel_version}"
mkdir -p "${kernel_version}/include/trace/events"
+5 -3
View File
@@ -2,15 +2,17 @@
kernel_version="$1"
if [ "$1" = "" ]; then
if [ "$kernel_version" = "" ]; then
echo "Error: missing kernel version argument."
exit 1
fi
if [ ! -e qla2xxx-orig/$1 ]; then
"$(dirname "$0")/extract-qla2xxx-orig" "$1"
if [ ! -e qla2xxx-orig/${kernel_version/^*} ]; then
"$(dirname "$0")/extract-qla2xxx-orig" "$kernel_version" || exit $?
fi
kernel_version=${kernel_version/^*}
mkdir -p in-tree-patches/"${kernel_version}"
for g in Kconfig *.[ch]; do
+2 -1
View File
@@ -15,7 +15,8 @@ fi
mkdir -p qla2xxx-orig
cd qla2xxx-orig || exit $?
download_and_extract_kernel_tree "${kernel_version}"
download_and_extract_kernel_tree "${kernel_version}" || exit $?
kernel_version=${kernel_version/^*}
touch "linux-${kernel_version}"/drivers/scsi/qla2xxx/*
rm -rf "${kernel_version}"
mkdir -p "${kernel_version}"
+5 -3
View File
@@ -2,15 +2,17 @@
kernel_version="$1"
if [ "$1" = "" ]; then
if [ "$kernel_version" = "" ]; then
echo "Error: missing kernel version argument."
exit 1
fi
if [ ! -e qla2xxx-orig/$1 ]; then
"$(dirname "$0")/extract-qla2xxx-orig" "$1"
if [ ! -e qla2xxx-orig/${kernel_version/^*} ]; then
"$(dirname "$0")/extract-qla2xxx-orig" "$kernel_version" || exit $?
fi
kernel_version=${kernel_version/^*}
mkdir -p in-tree-patches/"${kernel_version}"
for g in Kconfig *.[ch]; do
+23 -7
View File
@@ -105,6 +105,21 @@ EOF
# Run the script specialize_patch with appropriate options on the patch
# passed via stdin and send the specialized patch to stdout.
function specialize_patch {
local arr ao
readarray -d ^ -t arr <<<"$1^^^^"
local kver=${arr[0]}
local distro=${arr[1]}
local release=${arr[2]}
readarray -d . -t arr <<<"$release..."
local releasevermajor="${arr[0]}"
local releaseverminor="${arr[1]}"
if [ -n "$releasevermajor" ]; then
ao=(
-v RHEL_MAJOR=$releasevermajor
-v RHEL_MINOR=$releaseverminor
-v RHEL_RELEASE_CODE=$((releasevermajor * 256 + releaseverminor))
)
fi
if [ "${enable_specialize}" = "true" ]; then
if [ "${generating_upstream_patch}" = "true" ]; then
scripts/filter-trace-entry-exit
@@ -113,14 +128,14 @@ function specialize_patch {
fi |
"$(dirname "$0")/specialize-patch" \
"${specialize_patch_options[@]}" \
-v kernel_version="${kver3}" \
-v SCST_IO_CONTEXT="${scst_io_context}"
-v kernel_version="${kver/-*}" \
-v SCST_IO_CONTEXT="${scst_io_context}" "${ao[@]}"
else
cat
fi
}
# Read a patch from stdin, specialize it for kernel version ${kver}
# Read a patch from stdin, specialize it for kernel version ${full_kver}
# and write the output either to stdout or to the file $1 (if not empty),
# depending on the value of the variable ${multiple_patches}.
function process_patch {
@@ -132,7 +147,7 @@ function process_patch {
fi
tmppatch="$(/bin/mktemp)"
(
specialize_patch
specialize_patch "${full_kver}"
) >"${tmppatch}"
touch "${tmppatch}"
{
@@ -151,7 +166,7 @@ function process_patch {
true
fi
else
specialize_patch
specialize_patch "${full_kver}"
fi
}
@@ -208,6 +223,7 @@ if [ $# != 1 ]; then
fi
# Strip patch level from the kernel version number.
full_kver="$1"
kver="$(kernel_version "$1")"
# kver3: first three components of the version number.
if [ "${1#2.}" != "$1" ]; then
@@ -507,7 +523,7 @@ add_file "iscsi-scst/README_in-tree" "Documentation/scst/README.iscsi" \
if [ "${qla2x00t}" = "true" ]; then
( cd qla2x00t && "$PWD/generate-in-tree-patches" "$1" )
( cd qla2x00t && "$PWD/generate-in-tree-patches" "$1" ) || exit $?
for f in qla2x00t/in-tree-patches/"$1"/*.patch; do
[ -e "$f" ] || continue
@@ -533,7 +549,7 @@ if [ "${qla2x00t}" = "true" ]; then
elif [ "${qla2x00t_32gbit}" = "true" ]; then
( cd qla2x00t-32gbit && "$PWD/generate-in-tree-patches" "$1" )
( cd qla2x00t-32gbit && "$PWD/generate-in-tree-patches" "$1" ) || exit $?
for f in qla2x00t-32gbit/in-tree-patches/"$1"/*.patch; do
[ -e "$f" ] || continue
+39 -4
View File
@@ -2,6 +2,9 @@
# Shell functions for parsing the Linux kernel version and for downloading
# from kernel.org.
# shellcheck source=./rhel-rpm-functions
source "$(dirname "$0")/../scripts/rhel-rpm-functions" || return $?
kernel_mirror="http://cdn.kernel.org/pub/linux/kernel"
kernel_downloads="$HOME/software/downloads"
kernel_tree="$HOME/software/linux-kernel"
@@ -435,10 +438,37 @@ EOF
done
}
function download_and_extract_distro_rpm {
[ -n "$1" ] || return $?
local arr
readarray -d ^ -t arr <<<"$1^^^^"
local kver=${arr[0]}
local distro=${arr[1]}
local release=${arr[2]}
(
cd "${kernel_downloads}" || exit $?
urls=($(get_srpm_urls "$distro" "$release" x86_64))
for url in "${urls[@]}"; do
wget -q -nc "${url}/kernel-${kver}.src.rpm" && break
done
)
local tmpdir=kernel-tree-tmp-$$
rm -rf "linux-$1" "${tmpdir}"
mkdir "${tmpdir}" || return $?
(
cd "${tmpdir}" &&
rpm2cpio "${kernel_downloads}/kernel-${kver}.src.rpm" |
cpio -i --make-directories --quiet &&
tar xaf linux-${kver}.tar.* &&
mv "linux-${kver}" ".." &&
cd "../linux-${kver}"
) || return $?
rm -rf "${tmpdir}"
}
function download_and_extract_kernel_tree {
if [ -e "${kernel_tree}" ]; then
rm -rf "linux-$1"
mkdir "linux-$1"
{ [ "${1/^}" = "$1" ] &&
(
cd "${kernel_tree}" &&
{
@@ -450,12 +480,17 @@ function download_and_extract_kernel_tree {
git fetch stable
}
} &&
{ git tag -l "v$1" | grep -q '^v'; } &&
git archive "v$1"
) | tar -C "linux-$1" -xf-
) | {
rm -rf "linux-$1" &&
mkdir "linux-$1" &&
tar -C "linux-$1" -xf- 2>/dev/null
}; } || download_and_extract_distro_rpm "$1"
else
download_kernel "$1" && extract_kernel_tree "$1"
fi &&
(cd "linux-$1" && patch_kernel "$1")
(cd "linux-${1/^*}" && patch_kernel "${1/^*}")
}
# For shellcheck
+15 -10
View File
@@ -4,7 +4,7 @@
#
# Script for running those SCST regression tests that can be run automatically.
#
# Copyright (C) 2008-2009 Bart Van Assche <bvanassche@acm.org>
# Copyright (C) 2008-2020 Bart Van Assche <bvanassche@acm.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -199,22 +199,23 @@ function compile_scst_patched {
}
# Generate a kernel patch from the SCST source tree for kernel version $1
# and with generate-kernel-patch options $2.
# and with generate-kernel-patch options $2. $1 may be a
# ${kver}^${distro}^${release} triplet.
function generate_kernel_patch {
local kver
local patchfile="${outputdir}/scst-$1-kernel.patch"
local patchfile_m="${outputdir}/scst-$1-kernel-matching-line-numbers.patch"
local patchfile="${outputdir}/scst-${1/^*}-kernel.patch"
local patchfile_m="${outputdir}/scst-${1/^*}-kernel-matching-line-numbers.patch"
local driver_options=""
kver="$(kernel_version "$1")"
kver="$(kernel_version "${1/^*}")"
driver_options=(-l)
[ "${mpt_scst}" = "true" ] && driver_options+=("-m")
"${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" "$2" "$1" > "${patchfile}"
"${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" $2 "$1" > "${patchfile}"
"${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -n "$2" "$1" > "${patchfile_m}"
"${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -n $2 "$1" > "${patchfile_m}"
"${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -p "${outputdir}/${patchdir}" "$2" "$1"
"${scriptsdir}"/generate-kernel-patch "${driver_options[@]}" -p "${outputdir}/${patchdir}" $2 "$1"
}
# Run checkpatch on the generated kernel patch. Assumes that there is a
@@ -267,6 +268,7 @@ CONFIG_BINARY_PRINTF \
CONFIG_BLK_DEV_IO_TRACE \
CONFIG_BRANCH_PROFILE_NONE \
CONFIG_CONTEXT_SWITCH_TRACER \
CONFIG_DEBUG_SECTION_MISMATCH \
CONFIG_DEBUG_STRICT_USER_COPY_CHECKS \
CONFIG_DYNAMIC_FTRACE \
CONFIG_EVENT_TRACE_TEST_SYSCALLS \
@@ -292,6 +294,7 @@ CONFIG_MMIOTRACE \
CONFIG_NET_DROP_MONITOR \
CONFIG_NOP_TRACER \
CONFIG_RETPOLINE \
CONFIG_RH_KABI_SIZE_ALIGN_CHECKS \
CONFIG_SCHED_TRACER \
CONFIG_SECURITY_SELINUX \
CONFIG_STACK_TRACER \
@@ -630,7 +633,7 @@ do
run_smatch="true"
ipv6="true"
global_multiple_patches="${multiple_patches}"
while [ "${kv%-?}" != "${kv}" ] || [ "${kv%-??}" != "${kv}" ]; do
while true; do
kv_without_opt="${kv%-?}"
if [ "${kv_without_opt}" = "${kv}" ]; then
kv_without_opt="${kv%-??}"
@@ -645,7 +648,7 @@ do
'-nm') run_smatch="false";;
'-u') generate_kernel_patch_options="-u";;
'-p') multiple_patches="true";;
*) echo "Error: unknown option ${kopt}."; exit 1;;
*) break;;
esac
kv="${kv_without_opt}"
done
@@ -656,6 +659,7 @@ do
(
cd "${outputdir}" &&
download_and_extract_kernel_tree "$k" &&
k="${k/^*}" &&
cd "linux-$k/include/linux" &&
if [ ! -e compiler-gcc6.h ]; then
for f in compiler-gcc5.h compiler-gcc4.h; do
@@ -667,6 +671,7 @@ do
fi
) ||
continue
k="${k/^*}"
if [ "${run_checkpatch}" = "true" ]; then
run_checkpatch "$k"
fi