On Mon, Mar 07, 2022 at 03:39:22PM +0800, Peter Xu wrote: > On Wed, Mar 02, 2022 at 05:49:25PM +0000, Daniel P. Berrangé wrote: > > The migration precopy testing helper function always expects the > > migration to run to a completion state. There will be test scenarios > > for TLS where expect either the client or server to fail the migration. > > This expands the helper to cope with these scenarios. > > > > Signed-off-by: Daniel P. Berrangé <berra...@redhat.com> > > --- > > tests/qtest/migration-test.c | 47 +++++++++++++++++++++++++++++------- > > 1 file changed, 38 insertions(+), 9 deletions(-) > > > > diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c > > index 2082c58e8b..e40b408988 100644 > > --- a/tests/qtest/migration-test.c > > +++ b/tests/qtest/migration-test.c > > @@ -827,17 +827,32 @@ typedef void (*TestMigrateFinishHook)(QTestState > > *from, > > * @connect_uri: the URI for the src QEMU to connect to > > * @start_hook: (optional) callback to run at start to set migration > > parameters > > * @finish_hook: (optional) callback to run at finish to cleanup > > + * @expect_fail: true if we expect migration to fail > > + * @dst_quit: true if we expect the dst QEMU to quit with an > > + * abnormal exit status on failure > > "dst_quit" sounds a bit confusing to me, as setting dst_quit=false seems to > mean "dest qemu should not quit" but it's actually for checking an abnormal > quit only. > > Rename may work. Or, IMHO it's nicer if we could merge the two parameters: > > @expected_result: What is the expectation of this migration test > > typedef enum { > /* This test should succeed, the default */ > MIG_TEST_SUCCEED = 0, > /* This test should fail, dest qemu should keep alive */ > MIG_TEST_FAIL, > /* This test should fail, dest qemu should fail with abnormal status */ > MIG_TEST_FAIL_DEST_QUIT_ERR, > }; > > Because fundamentally the two parameters are correlated, e.g. there is no > combination of expect_fail==false && dst_quit==true. > > No strong opinion, though.
Using enums is more clear to someone reading code, so a good idea. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|