On Fri, May 14, 2021 at 11:05:21PM +0000, David Matlack wrote: > If /dev/kvm is not available then hardware_disable_test will hang > indefinitely because the child process exits before posting to the > semaphore for which the parent is waiting. > > Fix this by making the parent periodically check if the child has > exited. We have to be careful to forward the child's exit status to > preserve a KSFT_SKIP status. > > I considered just checking for /dev/kvm before creating the child > process, but there are so many other reasons why the child could exit > early that it seemed better to handle that as general case. > > Tested: > > $ ./hardware_disable_test > /dev/kvm not available, skipping test > $ echo $? > 4 > $ modprobe kvm_intel > $ ./hardware_disable_test > $ echo $? > 0 > > Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx> > --- > .../selftests/kvm/hardware_disable_test.c | 32 ++++++++++++++++++- > 1 file changed, 31 insertions(+), 1 deletion(-) > Reviewed-by: Andrew Jones <drjones@xxxxxxxxxx>