diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index c1b7609cc..b183a3a45 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -72,7 +72,7 @@ EOF # Insert a '+'-sign at the start of each line. sed -e 's/^/+/' < "$1" | \ if [ "${replace_sbug_by_bug}" = "true" ]; then - sed -e 's/sBUG(\([^)]\)/BUG(\1/g' -e 's/sBUG_ON(\([^)]\)/BUG_ON(\1/g' + sed -e 's/sBUG(\([^)]*\)/BUG(\1/g' -e 's/sBUG_ON(\([^)]*\)/BUG_ON(\1/g' else cat fi \ @@ -163,8 +163,7 @@ do '-h') usage; exit 1;; '-l') shift;; '-m') mpt_scst="true"; shift;; - '-n') specialize_patch_options="-v delete_disabled_code=0" - replace_sbug_by_bug="false" + '-n') specialize_patch_options="-v blank_deleted_code=1" shift ;; '-p') multiple_patches="true"; patchdir="$2"; shift; shift;; @@ -278,6 +277,10 @@ add_file "scst/kernel/in-tree/Makefile.scst" "drivers/scst/Makefile" for f in $(ls scst/src/*.[ch] 2>/dev/null) do + if [ "${generating_upstream_patch}" = "true" \ + -a "${f}" = "scst/src/scst_proc.c" ]; then + continue + fi if ! in_separate_patch "${f}"; then add_file "${f}" "drivers/scst/${f#scst/src/}" fi @@ -290,6 +293,10 @@ do fileset=$s for f in $(set | grep "^$s=" | sed -e "s/^$s='\(.*\)'\$/\1/" -e "s/^$s=\(.*\)\$/\1/") do + if [ "${generating_upstream_patch}" = "true" \ + -a "${f}" = "scst/src/scst_proc.c" ]; then + continue + fi if [ "${f#scst/include}" != "${f}" ]; then add_file "${f}" "include/scst/${f#scst/include/}" else diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index 82ddb8e3d..af6c713af 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -278,7 +278,8 @@ function download_kernel { ) } -# Generate a kernel patch from the SCST source tree for kernel version $1. +# Generate a kernel patch from the SCST source tree for kernel version $1 +# and with generate-kernel-patch options $2. function generate_kernel_patch { local scst_dir="${PWD}" local kver="$(kernel_version $1)" @@ -287,23 +288,22 @@ function generate_kernel_patch { SIGNED_OFF_BY="..." \ scripts/generate-kernel-patch \ - $([ "${scst_local}" = "true" ] && echo -- "-l") \ - $([ "${mpt_scst}" = "true" ] && echo -- "-m") \ - $([ "${qla2x00t}" = "true" ] && echo -- "-q") \ - ${1} > "${patchfile}" + $([ "${scst_local}" = "true" ] && echo "-l") \ + $([ "${mpt_scst}" = "true" ] && echo "-m") \ + $([ "${qla2x00t}" = "true" ] && echo "-q") \ + $2 $1 > "${patchfile}" SIGNED_OFF_BY="..." \ scripts/generate-kernel-patch \ - -n \ - $([ "${scst_local}" = "true" ] && echo -- "-l") \ - $([ "${mpt_scst}" = "true" ] && echo -- "-m") \ - $([ "${qla2x00t}" = "true" ] && echo -- "-q") \ - ${1} > "${patchfile_m}" + -n \ + $([ "${scst_local}" = "true" ] && echo "-l") \ + $([ "${mpt_scst}" = "true" ] && echo "-m") \ + $([ "${qla2x00t}" = "true" ] && echo "-q") \ + $2 $1 > "${patchfile_m}" } -# Generate a kernel patch through scripts/generate-kernel-patch and test -# whether it applies cleanly to kernel version $1. Leaves a vanilla kernel -# in directory "${outputdir}/linux-$1" at exit. +# Test whether the generated kernel patch applies cleanly to kernel version $1. +# Leaves a vanilla kernel tree in directory "${outputdir}/linux-$1" at exit. function test_if_patch_applies_cleanly { local kver="$(kernel_version $1)" local plevel="$(patchlevel $1)" @@ -579,14 +579,21 @@ compile_scst_patched debug2perf || exit $? compile_scst_patched disable_proc || exit $? first_iteration="true" -for k in ${kernel_versions} +for kv in ${kernel_versions} do - echo "====================" - printf "= kernel %-9s =\n" "${k}" - echo "====================" + echo "======================" + printf "= kernel %-11s =\n" "${kv}" + echo "======================" + + if [ "${kv%-u}" != "${kv}" ]; then + k="${kv%-u}" + v="-u" + else + k="${kv}" + fi download_kernel $k || continue - generate_kernel_patch $k || continue + generate_kernel_patch $k "$v" || continue test_if_patch_applies_cleanly $k || continue if [ "${first_iteration}" = "true" -o "${k#2.6.26}" != "$k" ]; then first_iteration="false" @@ -597,8 +604,8 @@ do patch_and_configure_kernel $k compile_kernel $k drivers/scst fi - # run_headers_check $k if [ "${full_check}" = "true" ]; then + run_headers_check $k compile_patched_kernel $k run_checkstack $k run_namespacecheck $k diff --git a/scripts/specialize-patch b/scripts/specialize-patch index d2fbb26b9..67254f08b 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -283,25 +283,34 @@ function process_preprocessor_statement() { if (output) any_section_output[if_nesting_level] = 1 } - if (delete_disabled_code \ - && (evaluated ~ "^+#define SCSI_EXEC_REQ_FIFO_DEFINED$" \ - && SCSI_EXEC_REQ_FIFO_DEFINED != "" \ - || evaluated ~ "^+#define SCST_IO_CONTEXT$" \ - && SCST_IO_CONTEXT != "" \ - || (evaluated ~ "^+#define CONFIG_SCST_PROC$" \ - && config_scst_proc_undefined))) + if (evaluated ~ "^+#define SCSI_EXEC_REQ_FIFO_DEFINED$" \ + && SCSI_EXEC_REQ_FIFO_DEFINED != "" \ + || evaluated ~ "^+#define SCST_IO_CONTEXT$" \ + && SCST_IO_CONTEXT != "" \ + || (evaluated ~ "^+#define CONFIG_SCST_PROC$" \ + && config_scst_proc_undefined)) { - lines_deleted += input_line_count - delete_next_blank_line = 1 + if (blank_deleted_code) + for (i = 0; i < input_line_count; i++) + line[lines++] = "+" + else + { + lines_deleted += input_line_count + delete_next_blank_line = 1 + } } - else if (delete_disabled_code == 0 || (output && (! condition || condition && matching_if !~ "^+#if [01]"))) + else if (output && (! condition || condition && matching_if !~ "^+#if [01]")) { for (i = 0; i < input_line_count; i++) line[lines++] = input_line[i] } else { - lines_deleted += input_line_count + if (blank_deleted_code) + for (i = 0; i < input_line_count; i++) + line[lines++] = "+" + else + lines_deleted += input_line_count } } @@ -349,8 +358,8 @@ BEGIN { printf "Error: kernel version (%s) is out of range.\n", kernel_version exit 1 } - if (delete_disabled_code != 0 && delete_disabled_code != 1) - delete_disabled_code = 0 + if (blank_deleted_code != 0 && blank_deleted_code != 1) + blank_deleted_code = 0 if (generating_upstream_patch_defined != 0 && generating_upstream_patch_defined != 1) generating_upstream_patch_defined = 0 if (config_tcp_zero_copy_transfer_completion_notification_undefined != 0 && config_tcp_zero_copy_transfer_completion_notification_undefined != 1) @@ -385,10 +394,16 @@ BEGIN { dump_lines() match($0, "^@@ -([0-9]*),([0-9]*) \\+([0-9]*),([0-9]*) @@(.*)$", h) } - else if (delete_disabled_code && delete_next_blank_line && match($0, "^+$")) + else if (delete_next_blank_line && match($0, "^+$")) { - lines_deleted += input_line_count - delete_next_blank_line = 0 + if (blank_deleted_code) + for (i = 0; i < input_line_count; i++) + line[lines++] = "+" + else + { + lines_deleted += input_line_count + delete_next_blank_line = 0 + } } else { @@ -397,16 +412,22 @@ BEGIN { { process_preprocessor_statement() } - else if (delete_disabled_code == 0 || output) + else if (output) { # Store the lines that were just read. for (i = 0; i < input_line_count; i++) - line[lines++]=input_line[i] + line[lines++] = input_line[i] } else { # Discard the last read lines. - lines_deleted += input_line_count + if (blank_deleted_code) + { + for (i = 0; i < input_line_count; i++) + line[lines++] = "+" + } + else + lines_deleted += input_line_count } } }