validate: tests: use fixtures to init/deinit and fix leaks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9118>
This commit is contained in:
parent
79321deb27
commit
76fc1d0acf
@ -29,21 +29,28 @@ GST_START_TEST (test_expression_parser)
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static void
|
||||
setup (void)
|
||||
{
|
||||
gst_validate_init ();
|
||||
}
|
||||
|
||||
static void
|
||||
teardown (void)
|
||||
{
|
||||
gst_validate_deinit ();
|
||||
}
|
||||
|
||||
static Suite *
|
||||
gst_validate_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("registry");
|
||||
TCase *tc_chain = tcase_create ("registry");
|
||||
suite_add_tcase (s, tc_chain);
|
||||
tcase_add_checked_fixture (tc_chain, setup, teardown);
|
||||
|
||||
if (atexit (gst_validate_deinit) != 0) {
|
||||
GST_ERROR ("failed to set gst_validate_deinit as exit function");
|
||||
}
|
||||
|
||||
g_setenv ("GST_VALIDATE_REPORTING_DETAILS", "all", TRUE);
|
||||
gst_validate_init ();
|
||||
tcase_add_test (tc_chain, test_expression_parser);
|
||||
gst_validate_deinit ();
|
||||
g_setenv ("GST_VALIDATE_REPORTING_DETAILS", "all", TRUE);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -93,16 +93,25 @@ GST_START_TEST (monitors_cleanup)
|
||||
GST_END_TEST;
|
||||
|
||||
|
||||
static void
|
||||
setup (void)
|
||||
{
|
||||
gst_validate_init ();
|
||||
}
|
||||
|
||||
static void
|
||||
teardown (void)
|
||||
{
|
||||
gst_validate_deinit ();
|
||||
}
|
||||
|
||||
static Suite *
|
||||
gst_validate_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("monitoring");
|
||||
TCase *tc_chain = tcase_create ("monitoring");
|
||||
suite_add_tcase (s, tc_chain);
|
||||
|
||||
if (atexit (gst_validate_deinit) != 0) {
|
||||
GST_ERROR ("failed to set gst_validate_deinit as exit function");
|
||||
}
|
||||
tcase_add_checked_fixture (tc_chain, setup, teardown);
|
||||
|
||||
tcase_add_test (tc_chain, monitors_added);
|
||||
tcase_add_test (tc_chain, monitors_cleanup);
|
||||
|
@ -93,22 +93,30 @@ GST_START_TEST (check_text_overrides)
|
||||
GST_END_TEST;
|
||||
|
||||
|
||||
static void
|
||||
setup (void)
|
||||
{
|
||||
gst_validate_init ();
|
||||
}
|
||||
|
||||
static void
|
||||
teardown (void)
|
||||
{
|
||||
gst_validate_deinit ();
|
||||
}
|
||||
|
||||
static Suite *
|
||||
gst_validate_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("registry");
|
||||
TCase *tc_chain = tcase_create ("registry");
|
||||
suite_add_tcase (s, tc_chain);
|
||||
tcase_add_checked_fixture (tc_chain, setup, teardown);
|
||||
|
||||
if (atexit (gst_validate_deinit) != 0) {
|
||||
GST_ERROR ("failed to set gst_validate_deinit as exit function");
|
||||
}
|
||||
tcase_add_test (tc_chain, check_text_overrides);
|
||||
// Do not abort on critical issues, as this test will generate them on purpose.
|
||||
g_setenv ("GST_VALIDATE", "print_issues", TRUE);
|
||||
g_setenv ("GST_VALIDATE_REPORTING_DETAILS", "all", TRUE);
|
||||
gst_validate_init ();
|
||||
tcase_add_test (tc_chain, check_text_overrides);
|
||||
gst_validate_deinit ();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -1062,20 +1062,31 @@ GST_END_TEST;
|
||||
|
||||
|
||||
|
||||
static void
|
||||
setup (void)
|
||||
{
|
||||
/*
|
||||
* Don't initialize validate here. Each test needs to setup the
|
||||
* environment before initialization
|
||||
*/
|
||||
/* gst_validate_init (); */
|
||||
|
||||
fake_elements_register ();
|
||||
}
|
||||
|
||||
static void
|
||||
teardown (void)
|
||||
{
|
||||
gst_validate_deinit ();
|
||||
}
|
||||
|
||||
static Suite *
|
||||
gst_validate_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("padmonitor");
|
||||
TCase *tc_chain = tcase_create ("padmonitor");
|
||||
suite_add_tcase (s, tc_chain);
|
||||
|
||||
if (atexit (gst_validate_deinit) != 0) {
|
||||
GST_ERROR ("failed to set gst_validate_deinit as exit function");
|
||||
}
|
||||
// Do not abort on critical issues, as this test will generate them on purpose.
|
||||
g_setenv ("GST_VALIDATE", "print_issues", TRUE);
|
||||
|
||||
fake_elements_register ();
|
||||
tcase_add_checked_fixture (tc_chain, setup, teardown);
|
||||
|
||||
tcase_add_test (tc_chain, buffer_before_segment);
|
||||
tcase_add_test (tc_chain, buffer_outside_segment);
|
||||
@ -1102,6 +1113,9 @@ gst_validate_suite (void)
|
||||
tcase_add_test (tc_chain, flow_error_without_message);
|
||||
tcase_add_test (tc_chain, flow_error_with_message);
|
||||
|
||||
// Do not abort on critical issues, as this test will generate them on purpose.
|
||||
g_setenv ("GST_VALIDATE", "print_issues", TRUE);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -135,9 +135,9 @@ GST_START_TEST (test_complex_reporting_details)
|
||||
|
||||
gst_object_unref (element);
|
||||
|
||||
g_object_unref (pipeline_monitor);
|
||||
gst_object_unref (pipeline_monitor);
|
||||
gst_object_unref (pipeline);
|
||||
g_object_unref (runner);
|
||||
gst_object_unref (runner);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
@ -254,18 +254,31 @@ TEST_LEVELS (issue_type, "event::flush-stop-unexpected:none", 0);
|
||||
|
||||
#undef TEST_LEVELS
|
||||
|
||||
static void
|
||||
setup (void)
|
||||
{
|
||||
/*
|
||||
* Don't initialize validate here. Each test needs to setup the
|
||||
* environment before initialization
|
||||
*/
|
||||
/* gst_validate_init (); */
|
||||
|
||||
fake_elements_register ();
|
||||
}
|
||||
|
||||
static void
|
||||
teardown (void)
|
||||
{
|
||||
gst_validate_deinit ();
|
||||
}
|
||||
|
||||
static Suite *
|
||||
gst_validate_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("reporting");
|
||||
TCase *tc_chain = tcase_create ("reporting");
|
||||
suite_add_tcase (s, tc_chain);
|
||||
|
||||
if (atexit (gst_validate_deinit) != 0) {
|
||||
GST_ERROR ("failed to set gst_validate_deinit as exit function");
|
||||
}
|
||||
|
||||
fake_elements_register ();
|
||||
tcase_add_checked_fixture (tc_chain, setup, teardown);
|
||||
|
||||
tcase_add_test (tc_chain, test_report_levels_all);
|
||||
tcase_add_test (tc_chain, test_report_levels_2);
|
||||
|
@ -45,21 +45,29 @@ GST_START_TEST (test_expression_parser)
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static void
|
||||
setup (void)
|
||||
{
|
||||
gst_validate_init ();
|
||||
}
|
||||
|
||||
static void
|
||||
teardown (void)
|
||||
{
|
||||
gst_validate_deinit ();
|
||||
}
|
||||
|
||||
static Suite *
|
||||
gst_validate_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("registry");
|
||||
TCase *tc_chain = tcase_create ("registry");
|
||||
suite_add_tcase (s, tc_chain);
|
||||
tcase_add_checked_fixture (tc_chain, setup, teardown);
|
||||
|
||||
if (atexit (gst_validate_deinit) != 0) {
|
||||
GST_ERROR ("failed to set gst_validate_deinit as exit function");
|
||||
}
|
||||
tcase_add_test (tc_chain, test_expression_parser);
|
||||
|
||||
g_setenv ("GST_VALIDATE_REPORTING_DETAILS", "all", TRUE);
|
||||
gst_validate_init ();
|
||||
tcase_add_test (tc_chain, test_expression_parser);
|
||||
gst_validate_deinit ();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -41,20 +41,27 @@ GST_START_TEST (test_resolve_variables)
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static void
|
||||
setup (void)
|
||||
{
|
||||
gst_validate_init ();
|
||||
}
|
||||
|
||||
static void
|
||||
teardown (void)
|
||||
{
|
||||
gst_validate_deinit ();
|
||||
}
|
||||
|
||||
static Suite *
|
||||
gst_validate_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("utilities");
|
||||
TCase *tc_chain = tcase_create ("utilities");
|
||||
suite_add_tcase (s, tc_chain);
|
||||
tcase_add_checked_fixture (tc_chain, setup, teardown);
|
||||
|
||||
if (atexit (gst_validate_deinit) != 0) {
|
||||
GST_ERROR ("failed to set gst_validate_deinit as exit function");
|
||||
}
|
||||
|
||||
gst_validate_init ();
|
||||
tcase_add_test (tc_chain, test_resolve_variables);
|
||||
gst_validate_deinit ();
|
||||
|
||||
return s;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user