[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 2/4] tests/migration-test: Add a test for null parameter setup
From: |
Peter Xu |
Subject: |
[PATCH v3 2/4] tests/migration-test: Add a test for null parameter setups |
Date: |
Tue, 5 Sep 2023 12:23:33 -0400 |
Add a test for StrOrNull parameters (tls-*).
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
tests/qtest/migration-test.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
index 62d3f37021..ff86838ec3 100644
--- a/tests/qtest/migration-test.c
+++ b/tests/qtest/migration-test.c
@@ -1471,6 +1471,27 @@ static void test_postcopy_preempt_all(void)
#endif
+/*
+ * We have a few parameters that allows null as input, test them to make
+ * sure they won't crash (where some used to).
+ */
+static void test_null_parameters(void)
+{
+ static const char *allow_null_params[] = {
+ "tls-authz", "tls-hostname", "tls-creds"
+ };
+ QTestState *vm = qtest_init("");
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(allow_null_params); i++) {
+ qtest_qmp_assert_success(vm, "{ 'execute': 'migrate-set-parameters',"
+ "'arguments': { %s: null } }",
+ allow_null_params[i]);
+ }
+
+ qtest_quit(vm);
+}
+
static void test_baddest(void)
{
MigrateStart args = {
@@ -2827,6 +2848,7 @@ int main(int argc, char **argv)
}
}
+ qtest_add_func("/migration/null_parameters", test_null_parameters);
qtest_add_func("/migration/bad_dest", test_baddest);
qtest_add_func("/migration/precopy/unix/plain", test_precopy_unix_plain);
qtest_add_func("/migration/precopy/unix/xbzrle", test_precopy_unix_xbzrle);
--
2.41.0
Re: [PATCH v3 4/4] migration/qapi: Drop @MigrationParameter enum, Markus Armbruster, 2023/09/26
[PATCH v3 3/4] migration/qapi: Replace @MigrateSetParameters with @MigrationParameters, Peter Xu, 2023/09/05
Re: [PATCH v3 0/4] qapi/migration: Dedup migration parameter objects and fix tls-authz crash, Markus Armbruster, 2023/09/25