Re: [kvm-unit-tests PATCH v3 1/2] Add the possibility to do simple migration tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21.03.2017 13:39, Andrew Jones wrote:
> On Mon, Mar 20, 2017 at 06:12:11PM +0100, Thomas Huth wrote:
>> To be able to do simple migration tests with kvm-unit-tests, too,
>> add a helper function that does all the necessary work: Start two
>> instances of QEMU (source and destination) with QMP sockets for
>> sending commands to them, then trigger the migration from one
>> instance to the other and finally signal the end of the migration
>> to the guest by injecting an NMI.
>> This helper function is now used automatically for powerpc tests
>> if the test is put into the "migration" group in the unittests.cfg
>> file.
>>
>> Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx>
>> ---
>>  powerpc/run           |  2 +-
>>  scripts/arch-run.bash | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++
>>  scripts/runtime.bash  |  3 +++
>>  3 files changed, 65 insertions(+), 1 deletion(-)
>>
>> diff --git a/powerpc/run b/powerpc/run
>> index 6269abb..d92608e 100755
>> --- a/powerpc/run
>> +++ b/powerpc/run
>> @@ -46,7 +46,7 @@ M+=",accel=$ACCEL"
>>  command="$qemu -nodefaults $M -bios $FIRMWARE"
>>  [ -f "$ENV" ] && command+=" -initrd $ENV"
>>  command+=" -display none -serial stdio -kernel"
>> -command="$(timeout_cmd) $command"
>> +command="$(migration_cmd) $(timeout_cmd) $command"
>>  echo $command "$@"
>>  
>>  # powerpc tests currently exit with rtas-poweroff, which exits with 0.
>> diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
>> index 1610f3b..453ae1c 100644
>> --- a/scripts/arch-run.bash
>> +++ b/scripts/arch-run.bash
>> @@ -70,3 +70,64 @@ timeout_cmd ()
>>  		echo "timeout -k 1s --foreground $TIMEOUT"
>>  	fi
>>  }
>> +
>> +qmp ()
>> +{
> 
> Let's put the nc probe here, and instead of saying $0 needs nc, we can
> say which specific function with $FUNCNAME, i.e.
> 
>  command -v nc >/dev/null 2>&1 || (echo "$FUNCNAME needs nc (netcat)"; exit 1)
> 
> We could also cache the results of the probe, if we don't want to do it on
> every invocation of qmp()

I tried to move the check to the qmp() function, as you suggested, but
that does not work as expected: The script then does not terminate
anymore! Seems like the shell is waiting for the started QEMU processes
to finish first, so I'd have to add some ugly error handling magic in
that case to kill the background QEMU processes if nc is not available.
I think it is easier if I keep the check at the beginning of
run_migration() instead.

>> +	echo '{ "execute": "qmp_capabilities" }{ "execute":' "$2" '}' | nc -U $1
>> +}
>> +
>> +run_migration ()
>> +{
>> +	if ! command -v nc >/dev/null 2>&1; then
>> +		echo "$0 needs nc (netcat)"
>> +		exit 1

I noticed that I should rather exit with "2" instead of "1" here ...
otherwise run_tests.sh does not report a FAIL here. I'll send a new
version with the fix...

>> +	fi

 Thomas


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux