Skip to content

Commit 409670a

Browse files
committed
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 <[email protected]>
1 parent 5b6b4b6 commit 409670a

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,35 +46,29 @@ echo ' ---' `date`: Starting build
4646
echo ' ---' Kconfig fragment at: $config_template >> $resdir/log
4747
touch $resdir/ConfigFragment.input
4848

49-
# Combine additional Kconfig options into an existing set such that newer
50-
# options win. The first argument is the Kconfig source ID, the second
51-
# the source file within $T, the third the destination file within $T,
52-
# and the fourth and final the list of additional Kconfig options.
49+
# Combine additional Kconfig options into an existing set such that
50+
# newer options win. The first argument is the Kconfig source ID, the
51+
# second the to-be-updated file within $T, and the third and final the
52+
# list of additional Kconfig options. Note that a $2.tmp file is
53+
# created when doing the update.
5354
config_override_param () {
54-
if test -n "$4"
55+
if test -n "$3"
5556
then
56-
echo $4 | sed -e 's/^ *//' -e 's/ *$//' | tr -s " " "\012" > $T/Kconfig_args
57+
echo $3 | sed -e 's/^ *//' -e 's/ *$//' | tr -s " " "\012" > $T/Kconfig_args
5758
echo " --- $1" >> $resdir/ConfigFragment.input
5859
cat $T/Kconfig_args >> $resdir/ConfigFragment.input
59-
config_override.sh $T/$2 $T/Kconfig_args > $T/$3
60+
config_override.sh $T/$2 $T/Kconfig_args > $T/$2.tmp
61+
mv $T/$2.tmp $T/$2
6062
# Note that "#CHECK#" is not permitted on commandline.
61-
else
62-
cp $T/$2 $T/$3
6363
fi
6464
}
6565

66-
if test -r "$config_dir/CFcommon"
67-
then
68-
echo " --- $config_dir/CFcommon" >> $resdir/ConfigFragment.input
69-
cat < $config_dir/CFcommon >> $resdir/ConfigFragment.input
70-
cp $config_dir/CFcommon $T/Kc0
71-
else
72-
echo > $T/Kc0
73-
fi
74-
config_override_param "$config_template" Kc0 Kc1 "`cat $config_template 2> /dev/null`"
75-
config_override_param "--kcsan options" Kc1 Kc2 "$TORTURE_KCONFIG_KCSAN_ARG"
76-
config_override_param "--kconfig argument" Kc2 Kc3 "$TORTURE_KCONFIG_ARG"
77-
cp $T/Kc3 $resdir/ConfigFragment
66+
echo > $T/KcList
67+
config_override_param "$config_dir/CFcommon" KcList "`cat $config_dir/CFcommon 2> /dev/null`"
68+
config_override_param "$config_template" KcList "`cat $config_template 2> /dev/null`"
69+
config_override_param "--kcsan options" KcList "$TORTURE_KCONFIG_KCSAN_ARG"
70+
config_override_param "--kconfig argument" KcList "$TORTURE_KCONFIG_ARG"
71+
cp $T/KcList $resdir/ConfigFragment
7872

7973
base_resdir=`echo $resdir | sed -e 's/\.[0-9]\+$//'`
8074
if test "$base_resdir" != "$resdir" -a -f $base_resdir/bzImage -a -f $base_resdir/vmlinux
@@ -87,7 +81,7 @@ then
8781
ln -s $base_resdir/.config $resdir # for kvm-recheck.sh
8882
# Arch-independent indicator
8983
touch $resdir/builtkernel
90-
elif kvm-build.sh $T/Kc3 $resdir
84+
elif kvm-build.sh $T/KcList $resdir
9185
then
9286
# Had to build a kernel for this test.
9387
QEMU="`identify_qemu vmlinux`"

0 commit comments

Comments
 (0)