From b8dcba41c7b6598cff5cf43d5f5b4f26a620cab1 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 3 Nov 2012 14:03:32 +0000 Subject: [PATCH] scripts: Merge up to and including r4569 from trunk git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4577 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/generate-patched-kernel | 4 +-- scripts/list-source-files | 42 ++++++++++++++++++++++ scripts/rebuild-rhel-kernel-rpm | 29 +++++++++------ scripts/run-regression-tests | 56 ++++++++++++++--------------- scripts/test-persistent-reservation | 11 +++--- 5 files changed, 96 insertions(+), 46 deletions(-) create mode 100755 scripts/list-source-files diff --git a/scripts/generate-patched-kernel b/scripts/generate-patched-kernel index fa10f2135..94d139b77 100755 --- a/scripts/generate-patched-kernel +++ b/scripts/generate-patched-kernel @@ -60,9 +60,7 @@ extract_kernel_tree "$1" || exit $? cd "${target}" || exit $? -svn status -v "$(dirname "$(dirname "$scriptname")")" \ -| grep -vE '^\?|^Performing' \ -| cut -c41- \ +list-source-files "$(dirname "$(dirname "$scriptname")")" \ | grep -- "-${kernel_version}.*.patch$" \ | grep -v /in-tree/ \ | while read p diff --git a/scripts/list-source-files b/scripts/list-source-files new file mode 100755 index 000000000..a14307b3b --- /dev/null +++ b/scripts/list-source-files @@ -0,0 +1,42 @@ +#!/bin/bash + +list_source_files() { + local d r + + d="$(cd "$1" && echo "$PWD")" + r="$d" + while [ "$r" != "/" -a ! -e "$r/.svn" -a ! -e "$r/.git" -a ! -e "$r/.hg" ]; do + r="$(dirname "$r")" + done + + if [ -e "$r/.svn" ]; then + ( + cd "$d" + svn status -v | \ + grep -vE '^[D?]|^Performing|^$' | \ + cut -c41- | \ + while read f; do + if [ -f "$f" ]; then + echo "$f" + fi + done + ) + elif [ -e "$r/.git" ]; then + subdir="${d#${r}}" + if [ "$r" != "" ]; then + ( cd "$d" && git ls-tree --name-only -r HEAD ) | sed "s|^$subdir/||" + else + echo "Ignored directory $1" >&2 + fi + elif [ -e "$r/.hg" ]; then + hg manifest + else + echo "Not under source control: $1 ?" >&2 + fi +} + +if [ $# = 0 ]; then + list_source_files "$PWD" +else + for d in "$@"; do list_source_files "$d"; done +fi diff --git a/scripts/rebuild-rhel-kernel-rpm b/scripts/rebuild-rhel-kernel-rpm index 426da3106..a1d8558b7 100755 --- a/scripts/rebuild-rhel-kernel-rpm +++ b/scripts/rebuild-rhel-kernel-rpm @@ -53,16 +53,21 @@ kernel="${kernel%.${arch}}" kernel_src_rpm="${kernel}.src.rpm" kver="${kernel#kernel-}" distro="$(sed -n -e 's/^\(.*\) release .*$/\1/p' /etc/issue)" -releasever="$(sed -n -e 's/^.* release \([0-9.]*\) .*$/\1/p' /etc/issue)" +if [ -n "$2" ]; then + releasever="$2" +else + releasever="$(sed -n -e 's/^.* release \([0-9.]*\) .*$/\1/p' /etc/issue)" +fi releasevermajor="$(echo $releasever | cut -f1 -d.)" releaseverminor="$(echo $releasever | cut -f2 -d.)" case "$distro" in "CentOS"*) - if [ $releasevermajor = 5 ]; then - srpm_url=("http://vault.centos.org/${releasever}/os/SRPMS" "http://vault.centos.org/${releasever}/updates/SRPMS") - else - srpm_url=("http://vault.centos.org/${releasever}/os/Source/SPackages" "http://vault.centos.org/${releasever}/updates/Source/SPackages") - fi + case $releasever in + 5.*|6.[01]) + srpm_url=("http://vault.centos.org/${releasever}/os/SRPMS" "http://vault.centos.org/${releasever}/updates/SRPMS");; + *) + srpm_url=("http://vault.centos.org/${releasever}/os/Source/SPackages" "http://vault.centos.org/${releasever}/updates/Source/SPackages");; + esac ;; "Red Hat Enterprise Linux"*) srpm_url=("http://ftp.redhat.com/pub/redhat/linux/enterprise/${releasevermajor}Server/en/os/SRPMS") @@ -186,12 +191,13 @@ diff -u SPECS/kernel-2.6.spec{.orig,} # END OF PATCH DEFINITIONS BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root -@@ -12593,6 +12596,9 @@ +@@ -12593,6 +12596,10 @@ rm -f kernel-%{kversion}-*-debug.config %endif +%patch200 -p1 +%patch201 -p1 ++sed -i.tmp -e 's/^CONFIG_SCSI_QLA_FC=.*/CONFIG_SCSI_QLA_FC=n/' *.config + # now run oldconfig over all the config files for i in *.config @@ -212,12 +218,13 @@ patch -p1 ${rpmbuild_dir}/SPECS/kernel.spec <<'EOF' || exit $? # empty final patch file to facilitate testing of kernel patches Patch99999: linux-kernel-test.patch -@@ -733,6 +736,9 @@ +@@ -733,6 +736,10 @@ rm -f kernel-%{version}-*-debug.config %endif +%patch200 -p1 +%patch201 -p1 ++sed -i.tmp -e 's/^CONFIG_SCSI_QLA_FC=.*/CONFIG_SCSI_QLA_FC=n/' *.config + # now run oldconfig over all the config files for i in *.config @@ -250,11 +257,12 @@ diff -u SPECS/kernel.spec{.orig,} ApplyOptionalPatch linux-kernel-test.patch # Any further pre-build tree manipulations happen here. -@@ -917,6 +923,7 @@ +@@ -917,6 +923,8 @@ for i in *.config do mv $i .config + echo "CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION=y" >> .config ++ sed -i.tmp -e 's/^CONFIG_SCSI_QLA_FC=.*/CONFIG_SCSI_QLA_FC=n/' .config Arch=`head -1 .config | cut -b 3-` make ARCH=$Arch %{oldconfig_target} > /dev/null echo "# $Arch" > configs/$i @@ -287,11 +295,12 @@ diff -u SPECS/kernel.spec{.orig,} ApplyOptionalPatch linux-kernel-test.patch # Any further pre-build tree manipulations happen here. -@@ -917,6 +923,7 @@ +@@ -917,6 +923,8 @@ for i in *.config do mv $i .config + echo "CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION=y" >> .config ++ sed -i.tmp -e 's/^CONFIG_SCSI_QLA_FC=.*/CONFIG_SCSI_QLA_FC=n/' .config Arch=`head -1 .config | cut -b 3-` make ARCH=$Arch %{oldconfig_target} > /dev/null echo "# $Arch" > configs/$i diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index 2ff3a7ac5..3c0fa4aac 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -88,14 +88,28 @@ function test_scst_tree_patches { # Only copy those files which are administered by Subversion. function duplicate_scst_source_tree { if [ -e "$1/AskingQuestions" ]; then - ( cd "$1" && svn status -v | grep -v '^[D?]' | cut -c3- | awk '{print $4}' \ - | while read f; do [ ! -d "$f" ] && echo "$f"; done ) \ - | tar -C "$1" --files-from=- -c -f - | tar -x -f - + "${scriptsdir}"/list-source-files "$1" | + tar -C "$1" --files-from=- -c -f - | + tar -x -f - else return 1 fi } +function compile_scst { + ( + export KCFLAGS=-DCONFIG_SCST_MEASURE_LATENCY + for p in scst scst_local iscsi-scst srpt qla2x00t $(if [ "${mpt_scst}" = "true" ]; then echo mpt; fi); do + if [ "${p%qla2x00t}" != "$p" ]; then + BUILD_2X_MODULE=y CONFIG_SCSI_QLA_FC=y CONFIG_SCSI_QLA2XXX_TARGET=y \ + make -C $p/qla2x00-target || break + else + make -C $p || break + fi + done + ) +} + # Compile the unpatched SCST source code. function compile_scst_unpatched { local scst="$PWD" @@ -107,16 +121,7 @@ function compile_scst_unpatched { if mkdir -p "${workingdirectory}" \ && cd "${workingdirectory}" \ && duplicate_scst_source_tree "${scst}" \ - && (export KCFLAGS=-DCONFIG_SCST_MEASURE_LATENCY; \ - 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}" + && compile_scst &> "${outputfile}" then echo "OK" else @@ -138,16 +143,7 @@ function compile_scst_patched { && cd "${workingdirectory}" \ && duplicate_scst_source_tree "${scst}" \ && make -s "$1" \ - && (export KCFLAGS=-DCONFIG_SCST_MEASURE_LATENCY; \ - 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}" + && compile_scst &> "${outputfile}" then echo "OK" else @@ -165,7 +161,7 @@ function generate_kernel_patch { local patchfile_m="${outputdir}/scst-$1-kernel-matching-line-numbers.patch" local driver_options="" - driver_options="$([ "${scst_local}" = "true" ] && echo "-l") \ + driver_options="-l \ $([ "${mpt_scst}" = "true" ] && echo "-m") \ $([ "${qla2x00t}" = "true" ] && echo "-q")" @@ -235,6 +231,7 @@ CONFIG_FUNCTION_PROFILER \ CONFIG_FUNCTION_TRACER \ CONFIG_GENERIC_TRACER \ CONFIG_HAVE_FTRACE_NMI_ENTER \ +CONFIG_HEADERS_CHECK \ CONFIG_IRQSOFF_TRACER \ CONFIG_IWLWIFI_DEVICE_TRACING \ CONFIG_IWM_TRACING \ @@ -345,8 +342,8 @@ function run_sparse { local warnings=$(grep -c ' warning:' "${outputfile}") echo "${errors} errors / ${warnings} warnings." cat "${outputfile}" \ - | grep -E 'warning:|error:' \ - | sed -e 's/^[^ ]*:[^ ]*:[^ ]*: //' \ + | grep -E ' warning:| error:' \ + | 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" \ @@ -384,7 +381,8 @@ function run_smatch { local warnings=$(grep -c ' warning:' "${outputfile}") echo "${errors} errors / ${warnings} warnings." cat "${outputfile}" | - grep -E 'warning:|error:' | + grep -E ' info:| warning:| error:' | + sed 's/^\([^:]*\):[0-9:]* /\1: /' | sort | uniq -c else @@ -473,6 +471,9 @@ if [ ! -e scst -o ! -e iscsi-scst -o ! -e srpt ]; then fi scriptsdir="$(dirname $0)" +if [ "${scriptsdir:0:1}" != "/" ]; then + scriptsdir="$PWD/${scriptsdir}" +fi # Where to store persistenly downloaded kernel tarballs and kernel patches. kernel_sources="$HOME/software/downloads" # URL for downloading kernel tarballs and kernel patches. @@ -488,7 +489,6 @@ multiple_patches="false" qla2x00t="false" remove_temporary_files_at_end="false" run_local_compilation="true" -scst_local="true" quiet_download="false" set -- $(/usr/bin/getopt "c:d:j:hklpq" "$@") diff --git a/scripts/test-persistent-reservation b/scripts/test-persistent-reservation index 9b454b0e2..2879f57e6 100755 --- a/scripts/test-persistent-reservation +++ b/scripts/test-persistent-reservation @@ -8,31 +8,32 @@ fi KEY1=ABC123 KEY2=BAD123 DEV="$1" +persist="-Z" # Use sg_persist to put SCSI Persistent Reservation thru its paces. echo -e "\n>>>> Query registered keys - Should report 'no keys'" sg_persist --no-inquiry -i --read-keys $DEV echo -e "\n>>>> Registering key $KEY1" -sg_persist -n -o --register --param-sark $KEY1 $DEV +sg_persist -n -o $persist --register --param-sark $KEY1 $DEV echo -e "\n>>>> Query registered keys - Should report 'key' $KEY1" sg_persist -n -i --read-keys $DEV echo -e "\n>>>> Replacing registered key $KEY1 with $KEY2" -sg_persist -n -o --register --param-sark $KEY2 --param-rk $KEY1 $DEV +sg_persist -n -o $persist --register --param-sark $KEY2 --param-rk $KEY1 $DEV echo -e "\n>>>> Query registered keys - Should report 'key' $KEY2" sg_persist -n -i --read-keys $DEV echo -e "\n>>>> Reserving device using key $KEY2 (Write exclusive)" -sg_persist -n -o --reserve --prout-type=1 --param-rk $KEY2 $DEV +sg_persist -n -o $persist --reserve --prout-type=1 --param-rk $KEY2 $DEV echo -e "\n>>>> Removing registered key 'bad123' " -sg_persist -n -o --register --param-sark 0 --param-rk $KEY2 $DEV +sg_persist -n -o $persist --register --param-sark 0 --param-rk $KEY2 $DEV echo -e "\n>>>> Query registered keys - Should report no registered keys" sg_persist -n -i --read-keys $DEV -echo -e "\n>>>> Query full status - " +echo -e "\n>>>> Query full status - Should neither report key $KEY1 nor key $KEY2" sg_persist -n -i --read-full-status $DEV