summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-02-20 12:04:02 +0000
committerPeter Maydell <peter.maydell@linaro.org>2014-02-20 12:10:23 +0000
commit4c0c9bbe78901a706497a8fa1a27935bafc20cf7 (patch)
tree43fe900e8e748606dcdb0ef22d10068cc4608aaa /tests
parent46eef33b89e936ca793e13c4aeea1414e97e8dbb (diff)
parent1094fd3a6219923c8d1abfc7dee5af996a181e7a (diff)
downloadhqemu-4c0c9bbe78901a706497a8fa1a27935bafc20cf7.zip
hqemu-4c0c9bbe78901a706497a8fa1a27935bafc20cf7.tar.gz
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
* remotes/qmp-unstable/queue/qmp: monitor: Add object_add class argument completion. monitor: Add object_del id argument completion. monitor: Add device_add device argument completion. monitor: Add device_del id argument completion. qmp: expose list of supported character device backends Use error_is_set() only when necessary QMP: allow JSON dict arguments in qmp-shell hmp: migrate command (without -d) now blocks correctly Conflicts: blockdev.c [PMM: resolved trivial conflict in blockdev.c] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-qmp-input-strict.c16
-rw-r--r--tests/test-qmp-input-visitor.c20
-rw-r--r--tests/test-qmp-output-visitor.c22
-rw-r--r--tests/test-string-input-visitor.c20
-rw-r--r--tests/test-string-output-visitor.c14
5 files changed, 46 insertions, 46 deletions
diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c
index 6f68963..38bdf5e 100644
--- a/tests/test-qmp-input-strict.c
+++ b/tests/test-qmp-input-strict.c
@@ -92,7 +92,7 @@ static void test_validate_struct(TestInputVisitorData *data,
v = validate_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo' }");
visit_type_TestStruct(v, &p, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_free(p->string);
g_free(p);
}
@@ -107,7 +107,7 @@ static void test_validate_struct_nested(TestInputVisitorData *data,
v = validate_test_init(data, "{ 'string0': 'string0', 'dict1': { 'string1': 'string1', 'dict2': { 'userdef1': { 'integer': 42, 'string': 'string' }, 'string2': 'string2'}}}");
visit_type_UserDefNested(v, &udp, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
qapi_free_UserDefNested(udp);
}
@@ -121,7 +121,7 @@ static void test_validate_list(TestInputVisitorData *data,
v = validate_test_init(data, "[ { 'string': 'string0', 'integer': 42 }, { 'string': 'string1', 'integer': 43 }, { 'string': 'string2', 'integer': 44 } ]");
visit_type_UserDefOneList(v, &head, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
qapi_free_UserDefOneList(head);
}
@@ -135,7 +135,7 @@ static void test_validate_union(TestInputVisitorData *data,
v = validate_test_init(data, "{ 'type': 'b', 'data' : { 'integer': 42 } }");
visit_type_UserDefUnion(v, &tmp, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
qapi_free_UserDefUnion(tmp);
}
@@ -149,7 +149,7 @@ static void test_validate_fail_struct(TestInputVisitorData *data,
v = validate_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo', 'extra': 42 }");
visit_type_TestStruct(v, &p, NULL, &errp);
- g_assert(error_is_set(&errp));
+ g_assert(errp);
if (p) {
g_free(p->string);
}
@@ -166,7 +166,7 @@ static void test_validate_fail_struct_nested(TestInputVisitorData *data,
v = validate_test_init(data, "{ 'string0': 'string0', 'dict1': { 'string1': 'string1', 'dict2': { 'userdef1': { 'integer': 42, 'string': 'string', 'extra': [42, 23, {'foo':'bar'}] }, 'string2': 'string2'}}}");
visit_type_UserDefNested(v, &udp, NULL, &errp);
- g_assert(error_is_set(&errp));
+ g_assert(errp);
qapi_free_UserDefNested(udp);
}
@@ -180,7 +180,7 @@ static void test_validate_fail_list(TestInputVisitorData *data,
v = validate_test_init(data, "[ { 'string': 'string0', 'integer': 42 }, { 'string': 'string1', 'integer': 43 }, { 'string': 'string2', 'integer': 44, 'extra': 'ggg' } ]");
visit_type_UserDefOneList(v, &head, NULL, &errp);
- g_assert(error_is_set(&errp));
+ g_assert(errp);
qapi_free_UserDefOneList(head);
}
@@ -194,7 +194,7 @@ static void test_validate_fail_union(TestInputVisitorData *data,
v = validate_test_init(data, "{ 'type': 'b', 'data' : { 'integer': 42 }, 'extra': 'yyy' }");
visit_type_UserDefUnion(v, &tmp, NULL, &errp);
- g_assert(error_is_set(&errp));
+ g_assert(errp);
qapi_free_UserDefUnion(tmp);
}
diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qmp-input-visitor.c
index 1e1c6fa..6eb7dc5 100644
--- a/tests/test-qmp-input-visitor.c
+++ b/tests/test-qmp-input-visitor.c
@@ -96,7 +96,7 @@ static void test_visitor_in_int(TestInputVisitorData *data,
v = visitor_input_test_init(data, "%" PRId64, value);
visit_type_int(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpint(res, ==, value);
}
@@ -114,7 +114,7 @@ static void test_visitor_in_int_overflow(TestInputVisitorData *data,
v = visitor_input_test_init(data, "%f", DBL_MAX);
visit_type_int(v, &res, NULL, &errp);
- g_assert(error_is_set(&errp));
+ g_assert(errp);
error_free(errp);
}
@@ -128,7 +128,7 @@ static void test_visitor_in_bool(TestInputVisitorData *data,
v = visitor_input_test_init(data, "true");
visit_type_bool(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpint(res, ==, true);
}
@@ -142,7 +142,7 @@ static void test_visitor_in_number(TestInputVisitorData *data,
v = visitor_input_test_init(data, "%f", value);
visit_type_number(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpfloat(res, ==, value);
}
@@ -156,7 +156,7 @@ static void test_visitor_in_string(TestInputVisitorData *data,
v = visitor_input_test_init(data, "%s", value);
visit_type_str(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpstr(res, ==, value);
g_free(res);
@@ -175,7 +175,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
v = visitor_input_test_init(data, "%s", EnumOne_lookup[i]);
visit_type_EnumOne(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpint(i, ==, res);
visitor_input_teardown(data, NULL);
@@ -223,7 +223,7 @@ static void test_visitor_in_struct(TestInputVisitorData *data,
v = visitor_input_test_init(data, "{ 'integer': -42, 'boolean': true, 'string': 'foo' }");
visit_type_TestStruct(v, &p, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpint(p->integer, ==, -42);
g_assert(p->boolean == true);
g_assert_cmpstr(p->string, ==, "foo");
@@ -248,7 +248,7 @@ static void test_visitor_in_struct_nested(TestInputVisitorData *data,
v = visitor_input_test_init(data, "{ 'string0': 'string0', 'dict1': { 'string1': 'string1', 'dict2': { 'userdef1': { 'integer': 42, 'string': 'string' }, 'string2': 'string2'}}}");
visit_type_UserDefNested(v, &udp, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
check_and_free_str(udp->string0, "string0");
check_and_free_str(udp->dict1.string1, "string1");
@@ -272,7 +272,7 @@ static void test_visitor_in_list(TestInputVisitorData *data,
v = visitor_input_test_init(data, "[ { 'string': 'string0', 'integer': 42 }, { 'string': 'string1', 'integer': 43 }, { 'string': 'string2', 'integer': 44 } ]");
visit_type_UserDefOneList(v, &head, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert(head != NULL);
for (i = 0, item = head; item; item = item->next, i++) {
@@ -601,7 +601,7 @@ static void test_visitor_in_errors(TestInputVisitorData *data,
v = visitor_input_test_init(data, "{ 'integer': false, 'boolean': 'foo', 'string': -42 }");
visit_type_TestStruct(v, &p, NULL, &errp);
- g_assert(error_is_set(&errp));
+ g_assert(errp);
g_assert(p->string == NULL);
error_free(errp);
diff --git a/tests/test-qmp-output-visitor.c b/tests/test-qmp-output-visitor.c
index e073d83..f31d168 100644
--- a/tests/test-qmp-output-visitor.c
+++ b/tests/test-qmp-output-visitor.c
@@ -49,7 +49,7 @@ static void test_visitor_out_int(TestOutputVisitorData *data,
QObject *obj;
visit_type_int(data->ov, &value, NULL, &errp);
- g_assert(error_is_set(&errp) == 0);
+ g_assert(!errp);
obj = qmp_output_get_qobject(data->qov);
g_assert(obj != NULL);
@@ -67,7 +67,7 @@ static void test_visitor_out_bool(TestOutputVisitorData *data,
QObject *obj;
visit_type_bool(data->ov, &value, NULL, &errp);
- g_assert(error_is_set(&errp) == 0);
+ g_assert(!errp);
obj = qmp_output_get_qobject(data->qov);
g_assert(obj != NULL);
@@ -85,7 +85,7 @@ static void test_visitor_out_number(TestOutputVisitorData *data,
QObject *obj;
visit_type_number(data->ov, &value, NULL, &errp);
- g_assert(error_is_set(&errp) == 0);
+ g_assert(!errp);
obj = qmp_output_get_qobject(data->qov);
g_assert(obj != NULL);
@@ -103,7 +103,7 @@ static void test_visitor_out_string(TestOutputVisitorData *data,
QObject *obj;
visit_type_str(data->ov, &string, NULL, &errp);
- g_assert(error_is_set(&errp) == 0);
+ g_assert(!errp);
obj = qmp_output_get_qobject(data->qov);
g_assert(obj != NULL);
@@ -122,7 +122,7 @@ static void test_visitor_out_no_string(TestOutputVisitorData *data,
/* A null string should return "" */
visit_type_str(data->ov, &string, NULL, &errp);
- g_assert(error_is_set(&errp) == 0);
+ g_assert(!errp);
obj = qmp_output_get_qobject(data->qov);
g_assert(obj != NULL);
@@ -141,7 +141,7 @@ static void test_visitor_out_enum(TestOutputVisitorData *data,
for (i = 0; i < ENUM_ONE_MAX; i++) {
visit_type_EnumOne(data->ov, &i, "unused", &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
obj = qmp_output_get_qobject(data->qov);
g_assert(obj != NULL);
@@ -161,7 +161,7 @@ static void test_visitor_out_enum_errors(TestOutputVisitorData *data,
for (i = 0; i < ARRAY_SIZE(bad_values) ; i++) {
errp = NULL;
visit_type_EnumOne(data->ov, &bad_values[i], "unused", &errp);
- g_assert(error_is_set(&errp) == true);
+ g_assert(errp);
error_free(errp);
}
}
@@ -198,7 +198,7 @@ static void test_visitor_out_struct(TestOutputVisitorData *data,
QDict *qdict;
visit_type_TestStruct(data->ov, &p, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
obj = qmp_output_get_qobject(data->qov);
g_assert(obj != NULL);
@@ -241,7 +241,7 @@ static void test_visitor_out_struct_nested(TestOutputVisitorData *data,
ud2->dict1.dict3.string3 = g_strdup(strings[3]);
visit_type_UserDefNested(data->ov, &ud2, "unused", &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
obj = qmp_output_get_qobject(data->qov);
g_assert(obj != NULL);
@@ -288,7 +288,7 @@ static void test_visitor_out_struct_errors(TestOutputVisitorData *data,
u.has_enum1 = true;
u.enum1 = bad_values[i];
visit_type_UserDefOne(data->ov, &pu, "unused", &errp);
- g_assert(error_is_set(&errp) == true);
+ g_assert(errp);
error_free(errp);
}
}
@@ -343,7 +343,7 @@ static void test_visitor_out_list(TestOutputVisitorData *data,
}
visit_type_TestStructList(data->ov, &head, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
obj = qmp_output_get_qobject(data->qov);
g_assert(obj != NULL);
diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c
index 5989f81..d406263 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -60,7 +60,7 @@ static void test_visitor_in_int(TestInputVisitorData *data,
v = visitor_input_test_init(data, "-42");
visit_type_int(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpint(res, ==, value);
}
@@ -74,42 +74,42 @@ static void test_visitor_in_bool(TestInputVisitorData *data,
v = visitor_input_test_init(data, "true");
visit_type_bool(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpint(res, ==, true);
visitor_input_teardown(data, unused);
v = visitor_input_test_init(data, "yes");
visit_type_bool(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpint(res, ==, true);
visitor_input_teardown(data, unused);
v = visitor_input_test_init(data, "on");
visit_type_bool(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpint(res, ==, true);
visitor_input_teardown(data, unused);
v = visitor_input_test_init(data, "false");
visit_type_bool(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpint(res, ==, false);
visitor_input_teardown(data, unused);
v = visitor_input_test_init(data, "no");
visit_type_bool(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpint(res, ==, false);
visitor_input_teardown(data, unused);
v = visitor_input_test_init(data, "off");
visit_type_bool(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpint(res, ==, false);
}
@@ -123,7 +123,7 @@ static void test_visitor_in_number(TestInputVisitorData *data,
v = visitor_input_test_init(data, "3.14");
visit_type_number(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpfloat(res, ==, value);
}
@@ -137,7 +137,7 @@ static void test_visitor_in_string(TestInputVisitorData *data,
v = visitor_input_test_init(data, value);
visit_type_str(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpstr(res, ==, value);
g_free(res);
@@ -156,7 +156,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
v = visitor_input_test_init(data, EnumOne_lookup[i]);
visit_type_EnumOne(v, &res, NULL, &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
g_assert_cmpint(i, ==, res);
visitor_input_teardown(data, NULL);
diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c
index 79d815f..52231cd 100644
--- a/tests/test-string-output-visitor.c
+++ b/tests/test-string-output-visitor.c
@@ -49,7 +49,7 @@ static void test_visitor_out_int(TestOutputVisitorData *data,
char *str;
visit_type_int(data->ov, &value, NULL, &errp);
- g_assert(error_is_set(&errp) == 0);
+ g_assert(!errp);
str = string_output_get_string(data->sov);
g_assert(str != NULL);
@@ -65,7 +65,7 @@ static void test_visitor_out_bool(TestOutputVisitorData *data,
char *str;
visit_type_bool(data->ov, &value, NULL, &errp);
- g_assert(error_is_set(&errp) == 0);
+ g_assert(!errp);
str = string_output_get_string(data->sov);
g_assert(str != NULL);
@@ -81,7 +81,7 @@ static void test_visitor_out_number(TestOutputVisitorData *data,
char *str;
visit_type_number(data->ov, &value, NULL, &errp);
- g_assert(error_is_set(&errp) == 0);
+ g_assert(!errp);
str = string_output_get_string(data->sov);
g_assert(str != NULL);
@@ -97,7 +97,7 @@ static void test_visitor_out_string(TestOutputVisitorData *data,
char *str;
visit_type_str(data->ov, &string, NULL, &errp);
- g_assert(error_is_set(&errp) == 0);
+ g_assert(!errp);
str = string_output_get_string(data->sov);
g_assert(str != NULL);
@@ -114,7 +114,7 @@ static void test_visitor_out_no_string(TestOutputVisitorData *data,
/* A null string should return "" */
visit_type_str(data->ov, &string, NULL, &errp);
- g_assert(error_is_set(&errp) == 0);
+ g_assert(!errp);
str = string_output_get_string(data->sov);
g_assert(str != NULL);
@@ -131,7 +131,7 @@ static void test_visitor_out_enum(TestOutputVisitorData *data,
for (i = 0; i < ENUM_ONE_MAX; i++) {
visit_type_EnumOne(data->ov, &i, "unused", &errp);
- g_assert(!error_is_set(&errp));
+ g_assert(!errp);
str = string_output_get_string(data->sov);
g_assert(str != NULL);
@@ -149,7 +149,7 @@ static void test_visitor_out_enum_errors(TestOutputVisitorData *data,
for (i = 0; i < ARRAY_SIZE(bad_values) ; i++) {
errp = NULL;
visit_type_EnumOne(data->ov, &bad_values[i], "unused", &errp);
- g_assert(error_is_set(&errp) == true);
+ g_assert(errp);
error_free(errp);
}
}
OpenPOWER on IntegriCloud