diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile | 2 | ||||
-rw-r--r-- | tests/i440fx-test.c | 2 | ||||
-rwxr-xr-x | tests/qemu-iotests/005 | 2 | ||||
-rwxr-xr-x | tests/qemu-iotests/070 | 13 | ||||
-rw-r--r-- | tests/qemu-iotests/070.out | 15 | ||||
-rw-r--r-- | tests/test-qmp-input-strict.c | 16 | ||||
-rw-r--r-- | tests/test-qmp-input-visitor.c | 20 | ||||
-rw-r--r-- | tests/test-qmp-output-visitor.c | 22 | ||||
-rw-r--r-- | tests/test-string-input-visitor.c | 20 | ||||
-rw-r--r-- | tests/test-string-output-visitor.c | 14 |
10 files changed, 76 insertions, 50 deletions
diff --git a/tests/Makefile b/tests/Makefile index 0ef8727873..b17d41e4e2 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -181,7 +181,7 @@ tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o xbzrle.o page_cache.o libqemuuti tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o tests/test-int128$(EXESUF): tests/test-int128.o tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \ - hw/core/qdev.o hw/core/qdev-properties.o \ + hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\ hw/core/irq.o \ $(qom-core-obj) \ $(test-qapi-obj-y) \ diff --git a/tests/i440fx-test.c b/tests/i440fx-test.c index e398b83018..ad232b561c 100644 --- a/tests/i440fx-test.c +++ b/tests/i440fx-test.c @@ -349,7 +349,7 @@ static void test_i440fx_firmware(FirmwareTestFixture *fixture, qtest_start(cmdline); g_free(cmdline); - /* Qemu has loaded the firmware (because qtest_start() only returns after + /* QEMU has loaded the firmware (because qtest_start() only returns after * the QMP handshake completes). We must unlink the firmware blob right * here, because any assertion firing below would leak it in the * filesystem. This is also the reason why we recreate the blob every time diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005 index 9abcb84e4b..ba1236dfbf 100755 --- a/tests/qemu-iotests/005 +++ b/tests/qemu-iotests/005 @@ -44,6 +44,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto generic _supported_os Linux +_unsupported_imgopts "subformat=twoGbMaxExtentFlat" \ + "subformat=twoGbMaxExtentSparse" # vpc is limited to 127GB, so we can't test it here if [ "$IMGFMT" = "vpc" ]; then diff --git a/tests/qemu-iotests/070 b/tests/qemu-iotests/070 index 41bf100701..ce71fa4a22 100755 --- a/tests/qemu-iotests/070 +++ b/tests/qemu-iotests/070 @@ -56,11 +56,22 @@ _use_sample_img iotest-dirtylog-10G-4M.vhdx.bz2 echo echo "=== Verify open image read-only fails, due to dirty log ===" -$QEMU_IO -r -c "read -pP 0xa5 0 18M" "$TEST_IMG" 2>&1 | grep -o "Permission denied" +$QEMU_IO -r -c "read -pP 0xa5 0 18M" "$TEST_IMG" 2>&1 | _filter_testdir \ + | _filter_qemu_io echo "=== Verify open image replays log ===" $QEMU_IO -c "read -pP 0xa5 0 18M" "$TEST_IMG" | _filter_qemu_io +# extract fresh sample image again +_use_sample_img iotest-dirtylog-10G-4M.vhdx.bz2 + +echo "=== Verify qemu-img check -r all replays log ===" +$QEMU_IMG check -r all "$TEST_IMG" 2>&1 | _filter_testdir | _filter_qemu + +echo "=== Verify open image read-only succeeds after log replay ===" +$QEMU_IO -r -c "read -pP 0xa5 0 18M" "$TEST_IMG" 2>&1 | _filter_testdir \ + | _filter_qemu_io + # success, all done echo "*** done" rm -f $seq.full diff --git a/tests/qemu-iotests/070.out b/tests/qemu-iotests/070.out index 9db8ff2650..922d62cb51 100644 --- a/tests/qemu-iotests/070.out +++ b/tests/qemu-iotests/070.out @@ -1,8 +1,21 @@ QA output created by 070 === Verify open image read-only fails, due to dirty log === -Permission denied +qemu-io: can't open device TEST_DIR/iotest-dirtylog-10G-4M.vhdx: VHDX image file 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' opened read-only, but contains a log that needs to be replayed. To replay the log, execute: + qemu-img check -r all 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx': Operation not permitted + no file open, try 'help open' === Verify open image replays log === read 18874368/18874368 bytes at offset 0 18 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +=== Verify qemu-img check -r all replays log === +The following inconsistencies were found and repaired: + + 0 leaked clusters + 1 corruptions + +Double checking the fixed image now... +No errors were found on the image. +=== Verify open image read-only succeeds after log replay === +read 18874368/18874368 bytes at offset 0 +18 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) *** done diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c index 6f68963a3d..38bdf5ec7c 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 1e1c6fa0c2..6eb7dc5bcf 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 e073d833bf..f31d168d63 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 5989f8118e..d406263aee 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 56cc21d078..22363d100f 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); } } |