[Libosinfo] [libosinfo] tests: Remove calls to g_log_set_always_fatal()

Christophe Fergeau cfergeau at redhat.com
Wed Feb 14 10:09:28 UTC 2018


Ping?

Christophe

On Mon, Jan 15, 2018 at 01:08:13PM +0100, Christophe Fergeau wrote:
> All tests call that method because they want g_warning() to be fatal.
> Since the switch to GTest, this is no longer necessary as this is the
> default  behaviour.
> 
> Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
> ---
>  tests/test-db.c             | 3 ---
>  tests/test-device.c         | 3 ---
>  tests/test-devicelist.c     | 3 ---
>  tests/test-entity.c         | 3 ---
>  tests/test-filter.c         | 3 ---
>  tests/test-install-script.c | 3 ---
>  tests/test-isodetect.c      | 3 ---
>  tests/test-list.c           | 3 ---
>  tests/test-loader.c         | 3 ---
>  tests/test-mediauris.c      | 3 ---
>  tests/test-os.c             | 3 ---
>  tests/test-oslist.c         | 3 ---
>  tests/test-platform.c       | 3 ---
>  tests/test-platformlist.c   | 3 ---
>  tests/test-product.c        | 3 ---
>  tests/test-productfilter.c  | 3 ---
>  tests/test-treeuris.c       | 3 ---
>  17 files changed, 51 deletions(-)
> 
> diff --git a/tests/test-db.c b/tests/test-db.c
> index ac0a529b..553cea2e 100644
> --- a/tests/test-db.c
> +++ b/tests/test-db.c
> @@ -411,9 +411,6 @@ main(int argc, char *argv[])
>      g_test_add_func("/db/prop_os", test_prop_os);
>      g_test_add_func("/db/rel_os", test_rel_os);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_entity_get_type();
>      osinfo_db_get_type();
> diff --git a/tests/test-device.c b/tests/test-device.c
> index f14eebab..064ccc27 100644
> --- a/tests/test-device.c
> +++ b/tests/test-device.c
> @@ -44,9 +44,6 @@ main(int argc, char *argv[])
>  
>      g_test_add_func("/device/basic", test_basic);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_device_get_type();
>  
> diff --git a/tests/test-devicelist.c b/tests/test-devicelist.c
> index cd697934..0c9e3e85 100644
> --- a/tests/test-devicelist.c
> +++ b/tests/test-devicelist.c
> @@ -213,9 +213,6 @@ main(int argc, char *argv[])
>      g_test_add_func("/devicelist/intersect", test_intersect);
>      g_test_add_func("/devicelist/filter", test_filter);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_device_get_type();
>      osinfo_devicelist_get_type();
> diff --git a/tests/test-entity.c b/tests/test-entity.c
> index 5f7233b8..b89f0b5a 100644
> --- a/tests/test-entity.c
> +++ b/tests/test-entity.c
> @@ -323,9 +323,6 @@ main(int argc, char *argv[])
>      g_test_add_func("/entity/multi_props_clear", test_multi_props_clear);
>      g_test_add_func("/entity/int64_props", test_int64_props);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_dummy_get_type();
>  
> diff --git a/tests/test-filter.c b/tests/test-filter.c
> index 3fbeb3e2..9afbc7fb 100644
> --- a/tests/test-filter.c
> +++ b/tests/test-filter.c
> @@ -161,9 +161,6 @@ main(int argc, char *argv[])
>      g_test_add_func("/filter/filter_multi", test_filter_multi);
>      g_test_add_func("/filter/filter_combine", test_filter_combine);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_device_get_type();
>      osinfo_filter_get_type();
> diff --git a/tests/test-install-script.c b/tests/test-install-script.c
> index fa692a39..bb9e79a5 100644
> --- a/tests/test-install-script.c
> +++ b/tests/test-install-script.c
> @@ -309,9 +309,6 @@ main(int argc, char *argv[])
>      g_test_add_func("/install-script/script_data", test_script_data);
>      g_test_add_func("/install-script/script_datamap", test_script_datamap);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_entity_get_type();
>      osinfo_db_get_type();
> diff --git a/tests/test-isodetect.c b/tests/test-isodetect.c
> index 51137284..1f6e5504 100644
> --- a/tests/test-isodetect.c
> +++ b/tests/test-isodetect.c
> @@ -480,9 +480,6 @@ main(int argc, char *argv[])
>      g_test_add_func("/isodetect/sles", test_sles);
>      g_test_add_func("/isodetect/sled", test_sled);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_entity_get_type();
>      osinfo_db_get_type();
> diff --git a/tests/test-list.c b/tests/test-list.c
> index df1c9738..2d376198 100644
> --- a/tests/test-list.c
> +++ b/tests/test-list.c
> @@ -403,9 +403,6 @@ main(int argc, char *argv[])
>      g_test_add_func("/list/filter", test_filter);
>      g_test_add_func("/list/iterate", test_iterate);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_dummy_get_type();
>      osinfo_dummy_list_get_type();
> diff --git a/tests/test-loader.c b/tests/test-loader.c
> index 680075d2..984219b7 100644
> --- a/tests/test-loader.c
> +++ b/tests/test-loader.c
> @@ -44,9 +44,6 @@ main(int argc, char *argv[])
>  
>      g_test_add_func("/loader/basic", test_basic);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_entity_get_type();
>      osinfo_db_get_type();
> diff --git a/tests/test-mediauris.c b/tests/test-mediauris.c
> index a079f465..4bf8ead4 100644
> --- a/tests/test-mediauris.c
> +++ b/tests/test-mediauris.c
> @@ -119,9 +119,6 @@ main(int argc, char *argv[])
>  
>      g_test_add_func("/mediauris/uris", test_uris);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      if (!g_getenv("LIBOSINFO_NETWORK_TESTS"))
>          return 77; /* Skip */
>  
> diff --git a/tests/test-os.c b/tests/test-os.c
> index d62117c0..3c1016a0 100644
> --- a/tests/test-os.c
> +++ b/tests/test-os.c
> @@ -200,9 +200,6 @@ main(int argc, char *argv[])
>      g_test_add_func("/os/devices_filter", test_devices_filter);
>      g_test_add_func("/os/device_driver", test_device_driver);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_platform_get_type();
>      osinfo_device_get_type();
> diff --git a/tests/test-oslist.c b/tests/test-oslist.c
> index c85f8225..6e056a6f 100644
> --- a/tests/test-oslist.c
> +++ b/tests/test-oslist.c
> @@ -213,9 +213,6 @@ main(int argc, char *argv[])
>      g_test_add_func("/oslist/intersect", test_intersect);
>      g_test_add_func("/oslist/filter", test_filter);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_os_get_type();
>      osinfo_oslist_get_type();
> diff --git a/tests/test-platform.c b/tests/test-platform.c
> index a5185290..afcb9193 100644
> --- a/tests/test-platform.c
> +++ b/tests/test-platform.c
> @@ -120,9 +120,6 @@ main(int argc, char *argv[])
>      g_test_add_func("/platform/devices", test_devices);
>      g_test_add_func("/platform/devices_filter", test_devices_filter);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_platform_get_type();
>      osinfo_device_get_type();
> diff --git a/tests/test-platformlist.c b/tests/test-platformlist.c
> index f5029111..852c6b78 100644
> --- a/tests/test-platformlist.c
> +++ b/tests/test-platformlist.c
> @@ -213,9 +213,6 @@ main(int argc, char *argv[])
>      g_test_add_func("/platformlist/intersect", test_intersect);
>      g_test_add_func("/platformlist/filter", test_filter);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_platform_get_type();
>      osinfo_platformlist_get_type();
> diff --git a/tests/test-product.c b/tests/test-product.c
> index 8d58f1c3..3703a703 100644
> --- a/tests/test-product.c
> +++ b/tests/test-product.c
> @@ -195,9 +195,6 @@ main(int argc, char *argv[])
>      g_test_add_func("/product/relproduct", test_relproduct);
>      g_test_add_func("/product/supportdate", test_supportdate);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_platform_get_type();
>      osinfo_device_get_type();
> diff --git a/tests/test-productfilter.c b/tests/test-productfilter.c
> index 021e45a6..125bb9ad 100644
> --- a/tests/test-productfilter.c
> +++ b/tests/test-productfilter.c
> @@ -232,9 +232,6 @@ main(int argc, char *argv[])
>      g_test_add_func("/productfilter/productfilter_multi", test_productfilter_multi);
>      g_test_add_func("/productfilter/productfilter_combine", test_productfilter_combine);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      /* Upfront so we don't confuse valgrind */
>      osinfo_entity_get_type();
>      osinfo_filter_get_type();
> diff --git a/tests/test-treeuris.c b/tests/test-treeuris.c
> index fad10791..2b37bfb7 100644
> --- a/tests/test-treeuris.c
> +++ b/tests/test-treeuris.c
> @@ -119,9 +119,6 @@ main(int argc, char *argv[])
>  
>      g_test_add_func("/treeuris/uris", test_uris);
>  
> -    /* Make sure we catch unexpected g_warning() */
> -    g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
> -
>      if (!g_getenv("LIBOSINFO_NETWORK_TESTS"))
>          return 77; /* Skip */
>  
> -- 
> 2.14.3
> 
> _______________________________________________
> Libosinfo mailing list
> Libosinfo at redhat.com
> https://www.redhat.com/mailman/listinfo/libosinfo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20180214/07b57b60/attachment.sig>


More information about the Libosinfo mailing list