From 409670aa26b6a8c9c0fb34eb7a887b9fedc6952b Mon Sep 17 00:00:00 2001 From: "Paul E. McKenney" Date: Thu, 9 Apr 2020 16:58:00 -0700 Subject: [PATCH] torture: Save a few lines by using config_override_param initially This commit saves a few lines of code by also using the bash config_override_param() to set the initial list of Kconfig options from the CFcommon file. While in the area, it makes this function capable of update-in-place on the file containing the cumulative Kconfig options, thus avoiding annoying changes when adding another source of options. Signed-off-by: Paul E. McKenney --- .../rcutorture/bin/kvm-test-1-run.sh | 38 ++++++++----------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh index c7534fddde1f..52f89664dfa5 100755 --- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh @@ -46,35 +46,29 @@ echo ' ---' `date`: Starting build echo ' ---' Kconfig fragment at: $config_template >> $resdir/log touch $resdir/ConfigFragment.input -# Combine additional Kconfig options into an existing set such that newer -# options win. The first argument is the Kconfig source ID, the second -# the source file within $T, the third the destination file within $T, -# and the fourth and final the list of additional Kconfig options. +# Combine additional Kconfig options into an existing set such that +# newer options win. The first argument is the Kconfig source ID, the +# second the to-be-updated file within $T, and the third and final the +# list of additional Kconfig options. Note that a $2.tmp file is +# created when doing the update. config_override_param () { - if test -n "$4" + if test -n "$3" then - echo $4 | sed -e 's/^ *//' -e 's/ *$//' | tr -s " " "\012" > $T/Kconfig_args + echo $3 | sed -e 's/^ *//' -e 's/ *$//' | tr -s " " "\012" > $T/Kconfig_args echo " --- $1" >> $resdir/ConfigFragment.input cat $T/Kconfig_args >> $resdir/ConfigFragment.input - config_override.sh $T/$2 $T/Kconfig_args > $T/$3 + config_override.sh $T/$2 $T/Kconfig_args > $T/$2.tmp + mv $T/$2.tmp $T/$2 # Note that "#CHECK#" is not permitted on commandline. - else - cp $T/$2 $T/$3 fi } -if test -r "$config_dir/CFcommon" -then - echo " --- $config_dir/CFcommon" >> $resdir/ConfigFragment.input - cat < $config_dir/CFcommon >> $resdir/ConfigFragment.input - cp $config_dir/CFcommon $T/Kc0 -else - echo > $T/Kc0 -fi -config_override_param "$config_template" Kc0 Kc1 "`cat $config_template 2> /dev/null`" -config_override_param "--kcsan options" Kc1 Kc2 "$TORTURE_KCONFIG_KCSAN_ARG" -config_override_param "--kconfig argument" Kc2 Kc3 "$TORTURE_KCONFIG_ARG" -cp $T/Kc3 $resdir/ConfigFragment +echo > $T/KcList +config_override_param "$config_dir/CFcommon" KcList "`cat $config_dir/CFcommon 2> /dev/null`" +config_override_param "$config_template" KcList "`cat $config_template 2> /dev/null`" +config_override_param "--kcsan options" KcList "$TORTURE_KCONFIG_KCSAN_ARG" +config_override_param "--kconfig argument" KcList "$TORTURE_KCONFIG_ARG" +cp $T/KcList $resdir/ConfigFragment base_resdir=`echo $resdir | sed -e 's/\.[0-9]\+$//'` if test "$base_resdir" != "$resdir" -a -f $base_resdir/bzImage -a -f $base_resdir/vmlinux @@ -87,7 +81,7 @@ then ln -s $base_resdir/.config $resdir # for kvm-recheck.sh # Arch-independent indicator touch $resdir/builtkernel -elif kvm-build.sh $T/Kc3 $resdir +elif kvm-build.sh $T/KcList $resdir then # Had to build a kernel for this test. QEMU="`identify_qemu vmlinux`"