[PATCH] qemu-iotests/iotests.py: improve assert_qmp message

Vladimir Sementsov-Ogievskiy posted 1 patch 4 years, 6 months ago
Test asan passed
Test checkpatch passed
Test docker-mingw@fedora passed
Test FreeBSD passed
Test docker-clang@ubuntu passed
Test docker-quick@centos7 passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20191026101221.5506-1-vsementsov@virtuozzo.com
Maintainers: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
tests/qemu-iotests/iotests.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] qemu-iotests/iotests.py: improve assert_qmp message
Posted by Vladimir Sementsov-Ogievskiy 4 years, 6 months ago
Make it obvious, from the two values which is found at path and which
is expected.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---

It's a pain, I can never remember it, and checking each time in source
code who is who is boring.

 tests/qemu-iotests/iotests.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 709def4d5d..e805b9ab14 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -729,8 +729,8 @@ class QMPTestCase(unittest.TestCase):
             self.fail('no match for "%s" in %s' % (str(result), str(value)))
         else:
             self.assertEqual(result, value,
-                             'values not equal "%s" and "%s"'
-                                 % (str(result), str(value)))
+                             '"%s" is "%s", expected "%s"'
+                                 % (path, str(result), str(value)))
 
     def assert_no_active_block_jobs(self):
         result = self.vm.qmp('query-block-jobs')
-- 
2.21.0


Re: [PATCH] qemu-iotests/iotests.py: improve assert_qmp message
Posted by Philippe Mathieu-Daudé 4 years, 6 months ago
On 10/26/19 12:12 PM, Vladimir Sementsov-Ogievskiy wrote:
> Make it obvious, from the two values which is found at path and which
> is expected.

Maybe:

"From the two values compared, make it obvious which is found at path, 
and which is expected."

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> 
> It's a pain, I can never remember it, and checking each time in source
> code who is who is boring.
> 
>   tests/qemu-iotests/iotests.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 709def4d5d..e805b9ab14 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -729,8 +729,8 @@ class QMPTestCase(unittest.TestCase):
>               self.fail('no match for "%s" in %s' % (str(result), str(value)))
>           else:
>               self.assertEqual(result, value,
> -                             'values not equal "%s" and "%s"'
> -                                 % (str(result), str(value)))
> +                             '"%s" is "%s", expected "%s"'
> +                                 % (path, str(result), str(value)))
>   
>       def assert_no_active_block_jobs(self):
>           result = self.vm.qmp('query-block-jobs')
> 

Re: [PATCH] qemu-iotests/iotests.py: improve assert_qmp message
Posted by Vladimir Sementsov-Ogievskiy 4 years, 6 months ago
26.10.2019 14:29, Philippe Mathieu-Daudé wrote:
> On 10/26/19 12:12 PM, Vladimir Sementsov-Ogievskiy wrote:
>> Make it obvious, from the two values which is found at path and which
>> is expected.
> 
> Maybe:
> 
> "From the two values compared, make it obvious which is found at path, and which is expected."
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Thanks for review and better wording!

> 
>>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>>
>> It's a pain, I can never remember it, and checking each time in source
>> code who is who is boring.
>>
>>   tests/qemu-iotests/iotests.py | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
>> index 709def4d5d..e805b9ab14 100644
>> --- a/tests/qemu-iotests/iotests.py
>> +++ b/tests/qemu-iotests/iotests.py
>> @@ -729,8 +729,8 @@ class QMPTestCase(unittest.TestCase):
>>               self.fail('no match for "%s" in %s' % (str(result), str(value)))
>>           else:
>>               self.assertEqual(result, value,
>> -                             'values not equal "%s" and "%s"'
>> -                                 % (str(result), str(value)))
>> +                             '"%s" is "%s", expected "%s"'
>> +                                 % (path, str(result), str(value)))
>>       def assert_no_active_block_jobs(self):
>>           result = self.vm.qmp('query-block-jobs')
>>


-- 
Best regards,
Vladimir
Re: [PATCH] qemu-iotests/iotests.py: improve assert_qmp message
Posted by Kevin Wolf 4 years, 6 months ago
Am 26.10.2019 um 18:58 hat Vladimir Sementsov-Ogievskiy geschrieben:
> 26.10.2019 14:29, Philippe Mathieu-Daudé wrote:
> > On 10/26/19 12:12 PM, Vladimir Sementsov-Ogievskiy wrote:
> >> Make it obvious, from the two values which is found at path and which
> >> is expected.
> > 
> > Maybe:
> > 
> > "From the two values compared, make it obvious which is found at path, and which is expected."
> > 
> > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> Thanks for review and better wording!

Thanks, updated the commit message and applies to the block branch.

Kevin