Skip to content

Commit

Permalink
Merge tag 'ktest-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/rostedt/linux-ktest

Pull ktest updates from Steven Rostedt:

 - Added a KTEST section in the MAINTAINERS file

 - Included John Hawley as a co-maintainer

 - Add an example config that would work with VMware workstation guests

 - Cleanups to the code

* tag 'ktest-v5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest:
  ktest: Add KTEST section to MAINTAINERS file
  ktest: Re-arrange the code blocks for better discoverability
  ktest: Further consistency cleanups
  ktest: Fixing indentation to match expected pattern
  ktest: Adding editor hints to improve consistency
  ktest: Add example config for using VMware VMs
  ktest: Minor cleanup with uninitialized variable $build_options
  • Loading branch information
torvalds committed May 5, 2021
2 parents d29c9bb + c7ceee6 commit dd8c86c
Show file tree
Hide file tree
Showing 3 changed files with 433 additions and 281 deletions.
6 changes: 6 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -10170,6 +10170,12 @@ S: Maintained
F: Documentation/devicetree/bindings/leds/backlight/kinetic,ktd253.yaml
F: drivers/video/backlight/ktd253-backlight.c

KTEST
M: Steven Rostedt <[email protected]>
M: John Hawley <[email protected]>
S: Maintained
F: tools/testing/ktest

L3MDEV
M: David Ahern <[email protected]>
L: [email protected]
Expand Down
137 changes: 137 additions & 0 deletions tools/testing/ktest/examples/vmware.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
#
# This config is an example usage of ktest.pl with a vmware guest
#
# VMware Setup:
# -------------
# - Edit the Virtual Machine ("Edit virtual machine settings")
# - Add a Serial Port
# - You almost certainly want it set "Connect at power on"
# - Select "Use socket (named pipe)"
# - Select a name that you'll recognize, like 'ktestserialpipe'
# - From: Server
# - To: A Virtual Machine
# - Save
# - Make sure you note the name, it will be in the base directory of the
# virtual machine (where the "disks" are stored. The default
# is /var/lib/vmware/<virtual machine name>/<the name you entered above>
#
# - Make note of the path to the VM
# </End VMware setup>
#
# The guest is called 'Guest' and this would be something that
# could be run on the host to test a virtual machine target.

MACHINE = Guest

# Name of the serial pipe you set in the VMware settings
VMWARE_SERIAL_NAME = <the name you entered above>

# Define a variable of the name of the VM
# Noting this needs to be the name of the kmx file, and usually, the
# name of the directory that it's in. If the directory and name
# differ change the VMWARE_VM_DIR accordingly.
# Please ommit the .kmx extension
VMWARE_VM_NAME = <virtual machine name>

# VM dir name. This is usually the same as the virtual machine's name,
# but not always the case. Change if they differ
VMWARE_VM_DIR = ${VMWARE_VM_NAME}

# Base directory that the Virtual machine is contained in
# /var/lib/vmware is the default on Linux
VMWARE_VM_BASE_DIR = /var/lib/vmware/${VMWARE_VM_DIR}

# Use ncat to read the unix pipe. Anything that can read the Unix Pipe
# and output it's contents to stdout will work
CONSOLE = /usr/bin/ncat -U ${VMWARE_VM_BASE_DIR}/${VMWARE_SERIAL_NAME}

# Define what version of Workstation you are using
# This is used by vmrun to use the appropriate appripriate pieces to
# test this. In all likelihood you want 'ws' or 'player'
# Valid options:
# ws - Workstation (Windows or Linux host)
# fusion - Fusion (Mac host)
# player - Using VMware Player (Windows or Linux host)
# Note: vmrun has to run directly on the host machine
VMWARE_HOST_TYPE = ws

# VMware provides `vmrun` to allow you to do certain things to the virtual machine
# This should hard reset the VM and force a boot
VMWARE_POWER_CYCLE = /usr/bin/vmrun -T ${VMWARE_HOST_TYPE} reset ${VMWARE_VM_BASE_DIR}/${VMWARE_VM_NAME}.kmx nogui

#*************************************#
# This part is the same as test.conf #
#*************************************#

# The include files will set up the type of test to run. Just set TEST to
# which test you want to run.
#
# TESTS = patchcheck, randconfig, boot, test, config-bisect, bisect, min-config
#
# See the include/*.conf files that define these tests
#
TEST := patchcheck

# Some tests may have more than one test to run. Define MULTI := 1 to run
# the extra tests.
MULTI := 0

# In case you want to differentiate which type of system you are testing
BITS := 64

# REBOOT = none, error, fail, empty
# See include/defaults.conf
REBOOT := empty


# The defaults file will set up various settings that can be used by all
# machine configs.
INCLUDE include/defaults.conf


#*************************************#
# Now we are different from test.conf #
#*************************************#


# The example here assumes that Guest is running a Fedora release
# that uses dracut for its initfs. The POST_INSTALL will be executed
# after the install of the kernel and modules are complete.
#
POST_INSTALL = ${SSH} /sbin/dracut -f /boot/initramfs-test.img $KERNEL_VERSION

# Guests sometimes get stuck on reboot. We wait 3 seconds after running
# the reboot command and then do a full power-cycle of the guest.
# This forces the guest to restart.
#
POWERCYCLE_AFTER_REBOOT = 3

# We do the same after the halt command, but this time we wait 20 seconds.
POWEROFF_AFTER_HALT = 20


# As the defaults.conf file has a POWER_CYCLE option already defined,
# and options can not be defined in the same section more than once
# (all DEFAULTS sections are considered the same). We use the
# DEFAULTS OVERRIDE to tell ktest.pl to ignore the previous defined
# options, for the options set in the OVERRIDE section.
#
DEFAULTS OVERRIDE

# Instead of using the default POWER_CYCLE option defined in
# defaults.conf, we use virsh to cycle it. To do so, we destroy
# the guest, wait 5 seconds, and then start it up again.
# Crude, but effective.
#
POWER_CYCLE = ${VMWARE_POWER_CYCLE}


DEFAULTS

# The following files each handle a different test case.
# Having them included allows you to set up more than one machine and share
# the same tests.
INCLUDE include/patchcheck.conf
INCLUDE include/tests.conf
INCLUDE include/bisect.conf
INCLUDE include/min-config.conf
Loading

0 comments on commit dd8c86c

Please sign in to comment.