From: Fabiano Rosas <farosas@suse.de>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>,
Leonardo Bras <leobras@redhat.com>,
Thomas Huth <thuth@redhat.com>,
Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v1 6/7] tests/qtest/migration: Add a wrapper to print test names
Date: Mon, 27 Nov 2023 12:44:53 -0300 [thread overview]
Message-ID: <87y1ej2oay.fsf@suse.de> (raw)
In-Reply-To: <ZWStsHj23pCbuGPP@x1n>
Peter Xu <peterx@redhat.com> writes:
> On Fri, Nov 24, 2023 at 01:14:31PM -0300, Fabiano Rosas wrote:
>> Our usage of gtest results in us losing the very basic functionality
>> of "knowing which test failed". The issue is that gtest only prints
>> test names ("paths" in gtest parlance) once the test has finished, but
>> we use asserts in the tests and crash gtest itself before it can print
>> anything. We also use a final abort when the result of g_test_run is
>> not 0.
>>
>> Depending on how the test failed/broke we can see the function that
>> trigged the abort, which may be representative of the test, but it
>> could also just be some generic function.
>>
>> We have been relying on the primitive method of looking at the name of
>> the previous successful test and then looking at the code to figure
>> out which test should have come next.
>>
>> Add a wrapper to the test registration that does the job of printing
>> the test name before running.
>>
>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
>> ---
>> tests/qtest/migration-helpers.c | 32 ++++++++++++++++++++++++++++++++
>> tests/qtest/migration-helpers.h | 1 +
>> 2 files changed, 33 insertions(+)
>>
>> diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helpers.c
>> index f1106128a9..164e09c299 100644
>> --- a/tests/qtest/migration-helpers.c
>> +++ b/tests/qtest/migration-helpers.c
>> @@ -298,3 +298,35 @@ char *resolve_machine_version(const char *alias, const char *var1,
>>
>> return find_common_machine_version(machine_name, var1, var2);
>> }
>> +
>> +typedef struct {
>> + char *name;
>> + void (*func)(void);
>> +} MigrationTest;
>> +
>> +static void migration_test_destroy(gpointer data)
>> +{
>> + MigrationTest *test = (MigrationTest *)data;
>> +
>> + g_free(test->name);
>> + g_free(test);
>> +}
>> +
>> +static void migration_test_wrapper(const void *data)
>> +{
>> + MigrationTest *test = (MigrationTest *)data;
>> +
>> + g_test_message("Running /%s%s", qtest_get_arch(), test->name);
>
> /%s/%s?
The test name contains a leading slash.
next prev parent reply other threads:[~2023-11-27 15:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-24 16:14 [PATCH v1 0/7] migration cleanups and testing improvements Fabiano Rosas
2023-11-24 16:14 ` [PATCH v1 1/7] migration/multifd: Remove MultiFDPages_t::packet_num Fabiano Rosas
2023-11-27 14:42 ` Peter Xu
2023-11-24 16:14 ` [PATCH v1 2/7] migration/multifd: Remove QEMUFile from where it is not needed Fabiano Rosas
2023-11-27 14:44 ` Peter Xu
2023-11-24 16:14 ` [PATCH v1 3/7] migration/multifd: Change multifd_pages_init argument Fabiano Rosas
2023-11-27 14:45 ` Peter Xu
2023-11-24 16:14 ` [PATCH v1 4/7] migration: Report error in incoming migration Fabiano Rosas
2023-11-27 14:46 ` Peter Xu
2023-11-24 16:14 ` [PATCH v1 5/7] tests/qtest/migration: Print migration incoming errors Fabiano Rosas
2023-11-27 14:50 ` Peter Xu
2023-11-27 15:52 ` Fabiano Rosas
2023-11-27 20:23 ` Peter Xu
2023-11-27 20:32 ` Fabiano Rosas
2023-11-27 20:52 ` Peter Xu
2023-11-24 16:14 ` [PATCH v1 6/7] tests/qtest/migration: Add a wrapper to print test names Fabiano Rosas
2023-11-27 14:54 ` Peter Xu
2023-11-27 15:44 ` Fabiano Rosas [this message]
2023-11-27 15:56 ` Peter Xu
2023-11-24 16:14 ` [PATCH v1 7/7] tests/qtest/migration: Use the new migration_test_add Fabiano Rosas
2023-11-27 14:55 ` Peter Xu
2024-01-04 4:56 ` [PATCH v1 0/7] migration cleanups and testing improvements Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y1ej2oay.fsf@suse.de \
--to=farosas@suse.de \
--cc=leobras@redhat.com \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).