torture: Add --kconfig argument to kvm.sh
Currently, testing a variant of an existing scenario requires editing that scenario's file or creating a new scenario file. This is messy and error prone with respect to changes to scenarios. This commit therefore adds a --kconfig argument to kvm.sh, so that '--kconfig "CONFIG_RCU_TRACE=y CONFIG_RCU_EQS_DEBUG=n" will override those two Kconfig options. In addition, there is now clear precedence: the config fragment overrides CFcommon, and the --kconfig argument overrides both. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
This commit is contained in:
parent
c7e224eec4
commit
d62c9833d6
61
tools/testing/selftests/rcutorture/bin/config_override.sh
Executable file
61
tools/testing/selftests/rcutorture/bin/config_override.sh
Executable file
@ -0,0 +1,61 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# config_override.sh base override
|
||||||
|
#
|
||||||
|
# Combines base and override, removing any Kconfig options from base
|
||||||
|
# that conflict with any in override, concatenating what remains and
|
||||||
|
# sending the result to standard output.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, you can access it online at
|
||||||
|
# http://www.gnu.org/licenses/gpl-2.0.html.
|
||||||
|
#
|
||||||
|
# Copyright (C) IBM Corporation, 2017
|
||||||
|
#
|
||||||
|
# Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
|
||||||
|
|
||||||
|
base=$1
|
||||||
|
if test -r $base
|
||||||
|
then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo Base file $base unreadable!!!
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
override=$2
|
||||||
|
if test -r $override
|
||||||
|
then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
echo Override file $override unreadable!!!
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
T=/tmp/config_override.sh.$$
|
||||||
|
trap 'rm -rf $T' 0
|
||||||
|
mkdir $T
|
||||||
|
|
||||||
|
sed < $override -e 's/^/grep -v "/' -e 's/=.*$/="/' |
|
||||||
|
awk '
|
||||||
|
{
|
||||||
|
if (last)
|
||||||
|
print last " |";
|
||||||
|
last = $0;
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
if (last)
|
||||||
|
print last;
|
||||||
|
}' > $T/script
|
||||||
|
sh $T/script < $base
|
||||||
|
cat $override
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Build a kvm-ready Linux kernel from the tree in the current directory.
|
# Build a kvm-ready Linux kernel from the tree in the current directory.
|
||||||
#
|
#
|
||||||
# Usage: kvm-build.sh config-template build-dir more-configs
|
# Usage: kvm-build.sh config-template build-dir
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -34,24 +34,17 @@ then
|
|||||||
echo "kvm-build.sh :$builddir: Not a writable directory, cannot build into it"
|
echo "kvm-build.sh :$builddir: Not a writable directory, cannot build into it"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
moreconfigs=${3}
|
|
||||||
if test -z "$moreconfigs" -o ! -r "$moreconfigs"
|
|
||||||
then
|
|
||||||
echo "kvm-build.sh :$moreconfigs: Not a readable file"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
T=/tmp/test-linux.sh.$$
|
T=/tmp/test-linux.sh.$$
|
||||||
trap 'rm -rf $T' 0
|
trap 'rm -rf $T' 0
|
||||||
mkdir $T
|
mkdir $T
|
||||||
|
|
||||||
grep -v 'CONFIG_[A-Z]*_TORTURE_TEST=' < ${config_template} > $T/config
|
cp ${config_template} $T/config
|
||||||
cat << ___EOF___ >> $T/config
|
cat << ___EOF___ >> $T/config
|
||||||
CONFIG_INITRAMFS_SOURCE="$TORTURE_INITRD"
|
CONFIG_INITRAMFS_SOURCE="$TORTURE_INITRD"
|
||||||
CONFIG_VIRTIO_PCI=y
|
CONFIG_VIRTIO_PCI=y
|
||||||
CONFIG_VIRTIO_CONSOLE=y
|
CONFIG_VIRTIO_CONSOLE=y
|
||||||
___EOF___
|
___EOF___
|
||||||
cat $moreconfigs >> $T/config
|
|
||||||
|
|
||||||
configinit.sh $T/config O=$builddir
|
configinit.sh $T/config O=$builddir
|
||||||
retval=$?
|
retval=$?
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
T=/tmp/kvm-test-1-run.sh.$$
|
T=/tmp/kvm-test-1-run.sh.$$
|
||||||
trap 'rm -rf $T' 0
|
trap 'rm -rf $T' 0
|
||||||
touch $T
|
mkdir $T
|
||||||
|
|
||||||
. $KVM/bin/functions.sh
|
. $KVM/bin/functions.sh
|
||||||
. $CONFIGFRAG/ver_functions.sh
|
. $CONFIGFRAG/ver_functions.sh
|
||||||
@ -60,37 +60,33 @@ then
|
|||||||
echo "kvm-test-1-run.sh :$resdir: Not a writable directory, cannot store results into it"
|
echo "kvm-test-1-run.sh :$resdir: Not a writable directory, cannot store results into it"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
cp $config_template $resdir/ConfigFragment
|
|
||||||
echo ' ---' `date`: Starting build
|
echo ' ---' `date`: Starting build
|
||||||
echo ' ---' Kconfig fragment at: $config_template >> $resdir/log
|
echo ' ---' Kconfig fragment at: $config_template >> $resdir/log
|
||||||
|
touch $resdir/ConfigFragment.input $resdir/ConfigFragment
|
||||||
if test -r "$config_dir/CFcommon"
|
if test -r "$config_dir/CFcommon"
|
||||||
then
|
then
|
||||||
cat < $config_dir/CFcommon >> $T
|
echo " --- $config_dir/CFcommon" >> $resdir/ConfigFragment.input
|
||||||
|
cat < $config_dir/CFcommon >> $resdir/ConfigFragment.input
|
||||||
|
config_override.sh $config_dir/CFcommon $config_template > $T/Kc1
|
||||||
|
grep '#CHECK#' $config_dir/CFcommon >> $resdir/ConfigFragment
|
||||||
|
else
|
||||||
|
cp $config_template $T/Kc1
|
||||||
fi
|
fi
|
||||||
# Optimizations below this point
|
echo " --- $config_template" >> $resdir/ConfigFragment.input
|
||||||
# CONFIG_USB=n
|
cat $config_template >> $resdir/ConfigFragment.input
|
||||||
# CONFIG_SECURITY=n
|
grep '#CHECK#' $config_template >> $resdir/ConfigFragment
|
||||||
# CONFIG_NFS_FS=n
|
if test -n "$TORTURE_KCONFIG_ARG"
|
||||||
# CONFIG_SOUND=n
|
then
|
||||||
# CONFIG_INPUT_JOYSTICK=n
|
echo $TORTURE_KCONFIG_ARG | tr -s " " "\012" > $T/cmdline
|
||||||
# CONFIG_INPUT_TABLET=n
|
echo " --- --kconfig argument" >> $resdir/ConfigFragment.input
|
||||||
# CONFIG_INPUT_TOUCHSCREEN=n
|
cat $T/cmdline >> $resdir/ConfigFragment.input
|
||||||
# CONFIG_INPUT_MISC=n
|
config_override.sh $T/Kc1 $T/cmdline > $T/Kc2
|
||||||
# CONFIG_INPUT_MOUSE=n
|
# Note that "#CHECK#" is not permitted on commandline.
|
||||||
# # CONFIG_NET=n # disables console access, so accept the slower build.
|
else
|
||||||
# CONFIG_SCSI=n
|
cp $T/Kc1 $T/Kc2
|
||||||
# CONFIG_ATA=n
|
fi
|
||||||
# CONFIG_FAT_FS=n
|
cat $T/Kc2 >> $resdir/ConfigFragment
|
||||||
# CONFIG_MSDOS_FS=n
|
|
||||||
# CONFIG_VFAT_FS=n
|
|
||||||
# CONFIG_ISO9660_FS=n
|
|
||||||
# CONFIG_QUOTA=n
|
|
||||||
# CONFIG_HID=n
|
|
||||||
# CONFIG_CRYPTO=n
|
|
||||||
# CONFIG_PCCARD=n
|
|
||||||
# CONFIG_PCMCIA=n
|
|
||||||
# CONFIG_CARDBUS=n
|
|
||||||
# CONFIG_YENTA=n
|
|
||||||
base_resdir=`echo $resdir | sed -e 's/\.[0-9]\+$//'`
|
base_resdir=`echo $resdir | sed -e 's/\.[0-9]\+$//'`
|
||||||
if test "$base_resdir" != "$resdir" -a -f $base_resdir/bzImage -a -f $base_resdir/vmlinux
|
if test "$base_resdir" != "$resdir" -a -f $base_resdir/bzImage -a -f $base_resdir/vmlinux
|
||||||
then
|
then
|
||||||
@ -100,7 +96,7 @@ then
|
|||||||
KERNEL=$base_resdir/${BOOT_IMAGE##*/} # use the last component of ${BOOT_IMAGE}
|
KERNEL=$base_resdir/${BOOT_IMAGE##*/} # use the last component of ${BOOT_IMAGE}
|
||||||
ln -s $base_resdir/Make*.out $resdir # for kvm-recheck.sh
|
ln -s $base_resdir/Make*.out $resdir # for kvm-recheck.sh
|
||||||
ln -s $base_resdir/.config $resdir # for kvm-recheck.sh
|
ln -s $base_resdir/.config $resdir # for kvm-recheck.sh
|
||||||
elif kvm-build.sh $config_template $builddir $T
|
elif kvm-build.sh $T/Kc2 $builddir
|
||||||
then
|
then
|
||||||
# Had to build a kernel for this test.
|
# Had to build a kernel for this test.
|
||||||
QEMU="`identify_qemu $builddir/vmlinux`"
|
QEMU="`identify_qemu $builddir/vmlinux`"
|
||||||
@ -149,7 +145,7 @@ fi
|
|||||||
|
|
||||||
# Generate -smp qemu argument.
|
# Generate -smp qemu argument.
|
||||||
qemu_args="-enable-kvm -nographic $qemu_args"
|
qemu_args="-enable-kvm -nographic $qemu_args"
|
||||||
cpu_count=`configNR_CPUS.sh $config_template`
|
cpu_count=`configNR_CPUS.sh $resdir/ConfigFragment`
|
||||||
cpu_count=`configfrag_boot_cpus "$boot_args" "$config_template" "$cpu_count"`
|
cpu_count=`configfrag_boot_cpus "$boot_args" "$config_template" "$cpu_count"`
|
||||||
vcpus=`identify_qemu_vcpus`
|
vcpus=`identify_qemu_vcpus`
|
||||||
if test $cpu_count -gt $vcpus
|
if test $cpu_count -gt $vcpus
|
||||||
|
@ -41,6 +41,7 @@ PATH=${KVM}/bin:$PATH; export PATH
|
|||||||
TORTURE_DEFCONFIG=defconfig
|
TORTURE_DEFCONFIG=defconfig
|
||||||
TORTURE_BOOT_IMAGE=""
|
TORTURE_BOOT_IMAGE=""
|
||||||
TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD
|
TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD
|
||||||
|
TORTURE_KCONFIG_ARG=""
|
||||||
TORTURE_KMAKE_ARG=""
|
TORTURE_KMAKE_ARG=""
|
||||||
TORTURE_SHUTDOWN_GRACE=180
|
TORTURE_SHUTDOWN_GRACE=180
|
||||||
TORTURE_SUITE=rcu
|
TORTURE_SUITE=rcu
|
||||||
@ -65,6 +66,7 @@ usage () {
|
|||||||
echo " --duration minutes"
|
echo " --duration minutes"
|
||||||
echo " --interactive"
|
echo " --interactive"
|
||||||
echo " --jitter N [ maxsleep (us) [ maxspin (us) ] ]"
|
echo " --jitter N [ maxsleep (us) [ maxspin (us) ] ]"
|
||||||
|
echo " --kconfig Kconfig-options"
|
||||||
echo " --kmake-arg kernel-make-arguments"
|
echo " --kmake-arg kernel-make-arguments"
|
||||||
echo " --mac nn:nn:nn:nn:nn:nn"
|
echo " --mac nn:nn:nn:nn:nn:nn"
|
||||||
echo " --no-initrd"
|
echo " --no-initrd"
|
||||||
@ -129,6 +131,11 @@ do
|
|||||||
jitter="$2"
|
jitter="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
--kconfig)
|
||||||
|
checkarg --kconfig "(Kconfig options)" $# "$2" '^CONFIG_[A-Z0-9_]\+=\([ynm]\|[0-9]\+\)\( CONFIG_[A-Z0-9_]\+=\([ynm]\|[0-9]\+\)\)*$' '^error$'
|
||||||
|
TORTURE_KCONFIG_ARG="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--kmake-arg)
|
--kmake-arg)
|
||||||
checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$'
|
checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$'
|
||||||
TORTURE_KMAKE_ARG="$2"
|
TORTURE_KMAKE_ARG="$2"
|
||||||
@ -275,6 +282,7 @@ TORTURE_BOOT_IMAGE="$TORTURE_BOOT_IMAGE"; export TORTURE_BOOT_IMAGE
|
|||||||
TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY
|
TORTURE_BUILDONLY="$TORTURE_BUILDONLY"; export TORTURE_BUILDONLY
|
||||||
TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG
|
TORTURE_DEFCONFIG="$TORTURE_DEFCONFIG"; export TORTURE_DEFCONFIG
|
||||||
TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD
|
TORTURE_INITRD="$TORTURE_INITRD"; export TORTURE_INITRD
|
||||||
|
TORTURE_KCONFIG_ARG="$TORTURE_KCONFIG_ARG"; export TORTURE_KCONFIG_ARG
|
||||||
TORTURE_KMAKE_ARG="$TORTURE_KMAKE_ARG"; export TORTURE_KMAKE_ARG
|
TORTURE_KMAKE_ARG="$TORTURE_KMAKE_ARG"; export TORTURE_KMAKE_ARG
|
||||||
TORTURE_QEMU_CMD="$TORTURE_QEMU_CMD"; export TORTURE_QEMU_CMD
|
TORTURE_QEMU_CMD="$TORTURE_QEMU_CMD"; export TORTURE_QEMU_CMD
|
||||||
TORTURE_QEMU_INTERACTIVE="$TORTURE_QEMU_INTERACTIVE"; export TORTURE_QEMU_INTERACTIVE
|
TORTURE_QEMU_INTERACTIVE="$TORTURE_QEMU_INTERACTIVE"; export TORTURE_QEMU_INTERACTIVE
|
||||||
|
Loading…
Reference in New Issue
Block a user