On Tue, Nov 05, 2024 at 03:08:18PM -0300, Fabiano Rosas wrote:
> Test frameworks usually prefix "test_" to the entry point of the test
> code. Having every function prefixed with test_ makes it hard to
> understand the code and to grep for the actual tests.
> 
> Remove the "test" prefix from everything that is not a test.
> 
> In order to still keep some namespacing, stick to the "migrate_"
> prefix, which is the most used currently.
> 
> Signed-off-by: Fabiano Rosas <faro...@suse.de>
> ---
> note: I would prefer the prefix "mig_" to avoid using "migrate_" which
> is a verb, but several functions such as migrate_qmp() would have to
> be given an entirely new name to keep expressiveness and I want to
> keep this a mechanical change.
> ---
>  tests/qtest/migration-test.c | 410 +++++++++++++++++------------------
>  1 file changed, 205 insertions(+), 205 deletions(-)
> 
> diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c
> index 04890e0479..a40451df1e 100644
> --- a/tests/qtest/migration-test.c
> +++ b/tests/qtest/migration-test.c

> @@ -919,9 +919,9 @@ struct TestMigrateTLSPSKData {
>  };
>  
>  static void *
> -test_migrate_tls_psk_start_common(QTestState *from,
> -                                  QTestState *to,
> -                                  bool mismatch)
> +migrate_tls_psk_start_common(QTestState *from,
> +                             QTestState *to,
> +                             bool mismatch)
>  {
>      struct TestMigrateTLSPSKData *data =
>          g_new0(struct TestMigrateTLSPSKData, 1);
> @@ -964,23 +964,23 @@ test_migrate_tls_psk_start_common(QTestState *from,
>  }
>  
>  static void *
> -test_migrate_tls_psk_match_start(QTestState *from,
> -                                 QTestState *to)
> +migrate_tls_psk_match_start(QTestState *from,
> +                            QTestState *to)

My inclination is usually to go from most general, to
most specific, left-to-right. I think it is also worth
distinguishing these functions as hooks, which would
suggest:

  migrate_hook_start_psk_match

That makes it easy to identify all hooks by grepping
for 'migrate_hook', or identify all start hooks by
grepping 'migrate_hook_start', or all PSK start
hooks with 'migrate_hook_star_psk'.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to