On 10/17/2017 11:31 AM, Jeff Cody wrote: > So that later patches can cleanup running qemu processes called from > different subshells, track resources to cleanup in pid and fd list > files. > > In subsquent patches, ./check will kill all QEMU processes launched with > the common.qemu framework, and the tests will not need to cleanup > manually (unless they want to do so as part of the test, e.g. wait for > a process to end such as migration). > > Signed-off-by: Jeff Cody <[email protected]> > --- > tests/qemu-iotests/common.qemu | 82 > ++++++++++++++++++++++++++++++++---------- > tests/qemu-iotests/common.rc | 3 +- > 2 files changed, 64 insertions(+), 21 deletions(-)
Modulo the typo in the commit message in response to your other tweaks,
> + # get line count, and therefore number of processes to kill
> + numproc=$(wc -l "${QEMU_PID_LIST}" | sed 's/\s.*//')
Instead of having to use sed, just do:
numproc=$(wc -l < "${QEMU_PID_LIST}")
wc is required to behave differently when parsing stdin than when
parsing a named file, so you might as well take advantage of it.
> +
> + for i in $(seq 1 $numproc)
Are we sure seq is always available? Shave a subshell, and avoid the
dependency, by using bash's:
for i in {1..$numproc}
> +++ b/tests/qemu-iotests/common.rc
> @@ -40,7 +40,6 @@ poke_file()
> printf "$3" | dd "of=$1" bs=1 "seek=$2" conv=notrunc &>/dev/null
> }
>
> -
> if ! . ./common.config
Spurious whitespace change?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
