tests: Initialize GES only once in the main process

Fixing calling deinit in a process where init was not called
when libcheck is forking.
This commit is contained in:
Thibault Saunier 2017-07-11 11:40:55 -04:00
parent c5eae31cf7
commit 5e4770ccb9
12 changed files with 21 additions and 135 deletions

View file

@ -27,8 +27,6 @@ GST_START_TEST (test_test_source_basic)
{
GESTestClip *source;
ges_init ();
source = ges_test_clip_new ();
fail_unless (source != NULL);
@ -45,8 +43,6 @@ GST_START_TEST (test_test_source_properties)
GESLayer *layer;
GESTrackElement *trackelement;
ges_init ();
track = ges_track_new (GES_TRACK_TYPE_AUDIO, gst_caps_ref (GST_CAPS_ANY));
fail_unless (track != NULL);
@ -129,8 +125,6 @@ GST_START_TEST (test_test_source_in_layer)
GESVideoTestPattern ptrn;
gdouble freq, volume;
ges_init ();
timeline = ges_timeline_new ();
layer = ges_layer_new ();
a = GES_TRACK (ges_audio_track_new ());
@ -258,8 +252,6 @@ GST_START_TEST (test_gap_filling_basic)
GstElement *nlesrc, *nlesrc1, *gap = NULL;
GESTrackElement *trackelement, *trackelement1, *trackelement2;
ges_init ();
track = GES_TRACK (ges_audio_track_new ());
fail_unless (track != NULL);
@ -362,8 +354,6 @@ GST_START_TEST (test_gap_filling_empty_track)
GESLayer *layer;
GESClip *clip;
ges_init ();
track = GES_TRACK (ges_audio_track_new ());
layer = ges_layer_new ();
@ -405,6 +395,7 @@ ges_suite (void)
Suite *s = suite_create ("ges-backgroundsource");
TCase *tc_chain = tcase_create ("backgroundsource");
ges_init ();
if (atexit (ges_deinit) != 0) {
GST_ERROR ("failed to set ges_deinit as exit function");
}

View file

@ -24,13 +24,6 @@
#include <ges/ges.h>
#include <gst/check/gstcheck.h>
GST_START_TEST (test_ges_init)
{
/* Yes, I know.. minimalistic... */
ges_init ();
}
GST_END_TEST;
GST_START_TEST (test_ges_scenario)
{
@ -274,8 +267,6 @@ GST_START_TEST (test_ges_timeline_add_layer_first)
GESTestClip *s1, *s2, *s3;
GList *trackelements, *tmp, *layers;
ges_init ();
/* Timeline and 1 Layer */
GST_DEBUG ("Create a timeline");
timeline = ges_timeline_new ();
@ -376,8 +367,6 @@ GST_START_TEST (test_ges_timeline_remove_track)
GESTrackElement *t1, *t2, *t3;
GList *trackelements, *tmp, *layers;
ges_init ();
/* Timeline and 1 Layer */
GST_DEBUG ("Create a timeline");
timeline = ges_timeline_new ();
@ -536,8 +525,6 @@ GST_START_TEST (test_ges_timeline_multiple_tracks)
GList *trackelements, *tmp, *layers;
SelectTracksData st_data = { &s1, &s2, &s3, &track1, &track2 };
ges_init ();
/* Timeline and 1 Layer */
GST_DEBUG ("Create a timeline");
timeline = ges_timeline_new ();
@ -680,8 +667,6 @@ GST_START_TEST (test_ges_pipeline_change_state)
GESTimeline *timeline;
GESPipeline *pipeline;
ges_init ();
layer = ges_layer_new ();
timeline = ges_timeline_new_audio_video ();
fail_unless (ges_timeline_add_layer (timeline, layer));
@ -713,8 +698,6 @@ GST_START_TEST (test_ges_timeline_element_name)
GESTimeline *timeline;
GESLayer *layer;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
fail_unless (ges_timeline_add_layer (timeline, layer));
@ -776,13 +759,14 @@ ges_suite (void)
Suite *s = suite_create ("ges-basic");
TCase *tc_chain = tcase_create ("basic");
ges_init ();
if (atexit (ges_deinit) != 0) {
GST_ERROR ("failed to set ges_deinit as exit function");
}
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_ges_init);
tcase_add_test (tc_chain, test_ges_scenario);
tcase_add_test (tc_chain, test_ges_timeline_add_layer);
tcase_add_test (tc_chain, test_ges_timeline_add_layer_first);

View file

@ -30,8 +30,6 @@ GST_START_TEST (test_object_properties)
GESLayer *layer;
GESTrackElement *trackelement;
ges_init ();
track = GES_TRACK (ges_video_track_new ());
fail_unless (track != NULL);
@ -116,8 +114,6 @@ GST_START_TEST (test_split_direct_bindings)
GESTrackElement *element;
ges_init ();
fail_unless ((timeline = ges_timeline_new ()));
fail_unless ((layer = ges_layer_new ()));
fail_unless (ges_timeline_add_track (timeline,
@ -202,8 +198,6 @@ GST_START_TEST (test_split_direct_absolute_bindings)
GESTrackElement *element;
ges_init ();
fail_unless ((timeline = ges_timeline_new ()));
fail_unless ((layer = ges_layer_new ()));
fail_unless (ges_timeline_add_track (timeline,
@ -284,8 +278,6 @@ GST_START_TEST (test_split_object)
GList *splittrackelements;
GESTrackElement *trackelement, *splittrackelement;
ges_init ();
layer = ges_layer_new ();
fail_unless (layer != NULL);
timeline = ges_timeline_new_audio_video ();
@ -377,8 +369,6 @@ GST_START_TEST (test_clip_group_ungroup)
GESContainer *regrouped_clip;
GESTrack *audio_track, *video_track;
ges_init ();
timeline = ges_timeline_new ();
layer = ges_layer_new ();
audio_track = GES_TRACK (ges_audio_track_new ());
@ -509,8 +499,6 @@ GST_START_TEST (test_clip_refcount_remove_child)
gboolean called;
GESTrackElement *effect;
ges_init ();
clip = GES_CLIP (ges_test_clip_new ());
track = GES_TRACK (ges_audio_track_new ());
effect = GES_TRACK_ELEMENT (ges_effect_new ("identity"));
@ -544,8 +532,6 @@ GST_START_TEST (test_clip_find_track_element)
GESTrackElement *effect, *effect1, *effect2, *foundelem;
ges_init ();
clip = GES_CLIP (ges_test_clip_new ());
track = GES_TRACK (ges_audio_track_new ());
track1 = GES_TRACK (ges_audio_track_new ());
@ -610,8 +596,6 @@ GST_START_TEST (test_effects_priorities)
GESTrackElement *effect, *effect1, *effect2;
ges_init ();
clip = GES_CLIP (ges_test_clip_new ());
audio_track = GES_TRACK (ges_audio_track_new ());
video_track = GES_TRACK (ges_video_track_new ());
@ -699,6 +683,8 @@ ges_suite (void)
Suite *s = suite_create ("ges-clip");
TCase *tc_chain = tcase_create ("clip");
ges_init ();
if (atexit (ges_deinit) != 0) {
GST_ERROR ("failed to set ges_deinit as exit function");
}

View file

@ -29,8 +29,6 @@ GST_START_TEST (test_effect_basic)
{
GESEffect *effect;
ges_init ();
effect = ges_effect_new ("agingtv");
fail_unless (effect != NULL);
gst_object_unref (effect);
@ -46,8 +44,6 @@ GST_START_TEST (test_add_effect_to_clip)
GESEffect *effect;
GESTestClip *source;
ges_init ();
timeline = ges_timeline_new ();
layer = ges_layer_new ();
track_audio = GES_TRACK (ges_audio_track_new ());
@ -93,8 +89,6 @@ GST_START_TEST (test_get_effects_from_tl)
GList *effects, *tmp = NULL;
gint effect_prio = -1;
ges_init ();
timeline = ges_timeline_new ();
layer = ges_layer_new ();
track_video = GES_TRACK (ges_video_track_new ());
@ -186,8 +180,6 @@ GST_START_TEST (test_effect_clip)
GES_TRACK_TYPE_AUDIO
};
ges_init ();
timeline = ges_timeline_new ();
layer = ges_layer_new ();
track_audio = GES_TRACK (ges_audio_track_new ());
@ -254,8 +246,6 @@ GST_START_TEST (test_priorities_clip)
gint effect_prio = -1;
ges_init ();
timeline = ges_timeline_new ();
layer = ges_layer_new ();
track_audio = GES_TRACK (ges_audio_track_new ());
@ -369,8 +359,6 @@ GST_START_TEST (test_effect_set_properties)
GValue val = { 0 };
GValue nval = { 0 };
ges_init ();
timeline = ges_timeline_new ();
layer = ges_layer_new ();
track_video = GES_TRACK (ges_video_track_new ());
@ -456,8 +444,6 @@ GST_START_TEST (test_clip_signals)
GValue val = { 0, };
gboolean effect_added = FALSE;
ges_init ();
timeline = ges_timeline_new ();
layer = ges_layer_new ();
track_video = GES_TRACK (ges_video_track_new ());
@ -509,8 +495,6 @@ GST_START_TEST (test_split_clip_effect_priorities)
GESEffect *effect;
GESTrackElement *source, *nsource, *neffect;
ges_init ();
timeline = ges_timeline_new ();
layer = ges_layer_new ();
track_video = GES_TRACK (ges_video_track_new ());
@ -561,6 +545,8 @@ ges_suite (void)
Suite *s = suite_create ("ges");
TCase *tc_chain = tcase_create ("effect");
ges_init ();
if (atexit (ges_deinit) != 0) {
GST_ERROR ("failed to set ges_deinit as exit function");
}

View file

@ -32,8 +32,6 @@ GST_START_TEST (test_move_group)
GList *clips = NULL;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_timeline_append_layer (timeline);
@ -334,8 +332,6 @@ GST_START_TEST (test_group_in_group)
guint nb_layer_notifies = 0;
GList *clips = NULL;
ges_init ();
timeline = ges_timeline_new_audio_video ();
/* Our timeline
@ -515,8 +511,6 @@ GST_START_TEST (test_group_in_group_layer_moving)
GList *clips = NULL;
ges_init ();
timeline = ges_timeline_new_audio_video ();
/* Our timeline
@ -643,8 +637,6 @@ GST_START_TEST (test_group_in_self)
GList *clips = NULL;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_timeline_append_layer (timeline);
@ -693,8 +685,6 @@ GST_START_TEST (test_group_serialization)
GError *err = NULL;
GList *tmp, *clips = NULL;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_timeline_append_layer (timeline);
@ -764,6 +754,7 @@ ges_suite (void)
Suite *s = suite_create ("ges-group");
TCase *tc_chain = tcase_create ("group");
ges_init ();
if (atexit (ges_deinit) != 0) {
GST_ERROR ("failed to set ges_deinit as exit function");
}

View file

@ -31,8 +31,6 @@ GST_START_TEST (test_layer_properties)
GESTrackElement *trackelement;
GESClip *clip;
ges_init ();
/* Timeline and 1 Layer */
timeline = ges_timeline_new ();
layer = (GESLayer *) ges_layer_new ();
@ -121,8 +119,6 @@ GST_START_TEST (test_layer_priorities)
guint prio1, prio2, prio3;
GList *objs;
ges_init ();
/* Timeline and 3 Layer */
timeline = ges_timeline_new ();
layer1 = (GESLayer *) ges_layer_new ();
@ -252,8 +248,6 @@ GST_START_TEST (test_timeline_auto_transition)
GESTimeline *timeline;
GESLayer *layer, *layer1, *layer2;
ges_init ();
asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
fail_unless (GES_IS_ASSET (asset));
@ -316,8 +310,6 @@ GST_START_TEST (test_single_layer_automatic_transition)
GESLayer *layer;
GESTimelineElement *src, *src1, *src2;
ges_init ();
asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
fail_unless (GES_IS_ASSET (asset));
@ -712,8 +704,6 @@ GST_START_TEST (test_multi_layer_automatic_transition)
GESLayer *layer, *layer1;
GESTimelineElement *src, *src1, *src2, *src3;
ges_init ();
asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
fail_unless (GES_IS_ASSET (asset));
@ -1201,8 +1191,6 @@ GST_START_TEST (test_layer_activate_automatic_transition)
GESClip *transition;
GESTimelineElement *src, *src1, *src2, *src3;
ges_init ();
asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
transition_asset =
ges_asset_request (GES_TYPE_TRANSITION_CLIP, "crossfade", NULL);
@ -1429,8 +1417,6 @@ GST_START_TEST (test_layer_meta_string)
GESLayer *layer;
const gchar *result;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1452,8 +1438,6 @@ GST_START_TEST (test_layer_meta_boolean)
GESLayer *layer;
gboolean result;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1474,8 +1458,6 @@ GST_START_TEST (test_layer_meta_int)
GESLayer *layer;
gint result;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1496,8 +1478,6 @@ GST_START_TEST (test_layer_meta_uint)
GESLayer *layer;
guint result;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1518,8 +1498,6 @@ GST_START_TEST (test_layer_meta_int64)
GESLayer *layer;
gint64 result;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1540,8 +1518,6 @@ GST_START_TEST (test_layer_meta_uint64)
GESLayer *layer;
guint64 result;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1562,8 +1538,6 @@ GST_START_TEST (test_layer_meta_float)
GESLayer *layer;
gfloat result;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1585,8 +1559,6 @@ GST_START_TEST (test_layer_meta_double)
GESLayer *layer;
gdouble result;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1611,8 +1583,6 @@ GST_START_TEST (test_layer_meta_date)
GDate *input;
GDate *result;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1639,8 +1609,6 @@ GST_START_TEST (test_layer_meta_date_time)
GstDateTime *input;
GstDateTime *result = NULL;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1672,8 +1640,6 @@ GST_START_TEST (test_layer_meta_value)
GValue data = G_VALUE_INIT;
const GValue *result;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1700,8 +1666,6 @@ GST_START_TEST (test_layer_meta_register)
GESLayer *layer;
const gchar *result;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1736,8 +1700,6 @@ GST_START_TEST (test_layer_meta_foreach)
GESTimeline *timeline;
GESLayer *layer;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1760,8 +1722,6 @@ GST_START_TEST (test_layer_get_clips_in_interval)
GESClip *clip, *clip2, *clip3;
GList *objects, *current;
ges_init ();
timeline = ges_timeline_new_audio_video ();
layer = ges_layer_new ();
ges_timeline_add_layer (timeline, layer);
@ -1866,6 +1826,8 @@ ges_suite (void)
Suite *s = suite_create ("ges-layer");
TCase *tc_chain = tcase_create ("timeline-layer");
ges_init ();
if (atexit (ges_deinit) != 0) {
GST_ERROR ("failed to set ges_deinit as exit function");
}

View file

@ -25,8 +25,6 @@ GST_START_TEST (test_overlay_basic)
{
GESTextOverlayClip *source;
ges_init ();
source = ges_text_overlay_clip_new ();
fail_unless (source != NULL);
@ -43,8 +41,6 @@ GST_START_TEST (test_overlay_properties)
GESLayer *layer;
GESTrackElement *trackelement;
ges_init ();
track = ges_track_new (GES_TRACK_TYPE_VIDEO, gst_caps_ref (GST_CAPS_ANY));
fail_unless (track != NULL);
layer = ges_layer_new ();
@ -118,8 +114,6 @@ GST_START_TEST (test_overlay_in_layer)
gdouble xpos;
gdouble ypos;
ges_init ();
timeline = ges_timeline_new ();
layer = (GESLayer *) ges_layer_new ();
a = GES_TRACK (ges_audio_track_new ());
@ -207,6 +201,8 @@ ges_suite (void)
Suite *s = suite_create ("ges-overlays");
TCase *tc_chain = tcase_create ("overlays");
ges_init ();
if (atexit (ges_deinit) != 0) {
GST_ERROR ("failed to set ges_deinit as exit function");
}

View file

@ -33,8 +33,6 @@ GST_START_TEST (test_tempochange)
GList *tmp;
int found;
ges_init ();
timeline = ges_timeline_new ();
layer = ges_layer_new ();
track_audio = GES_TRACK (ges_audio_track_new ());
@ -134,6 +132,8 @@ ges_suite (void)
GstPluginFeature *pitch = gst_registry_find_feature (gst_registry_get (),
"pitch", GST_TYPE_ELEMENT_FACTORY);
ges_init ();
if (atexit (ges_deinit) != 0) {
GST_ERROR ("failed to set ges_deinit as exit function");
}

View file

@ -25,8 +25,6 @@ GST_START_TEST (test_title_source_basic)
{
GESTitleClip *source;
ges_init ();
source = ges_title_clip_new ();
fail_unless (source != NULL);
@ -43,8 +41,6 @@ GST_START_TEST (test_title_source_properties)
GESLayer *layer;
GESTrackElement *trackelement;
ges_init ();
track = GES_TRACK (ges_video_track_new ());
fail_unless (track != NULL);
layer = ges_layer_new ();
@ -118,8 +114,6 @@ GST_START_TEST (test_title_source_in_layer)
gdouble xpos;
gdouble ypos;
ges_init ();
timeline = ges_timeline_new ();
layer = ges_layer_new ();
a = GES_TRACK (ges_audio_track_new ());
@ -211,6 +205,8 @@ ges_suite (void)
Suite *s = suite_create ("ges-titles");
TCase *tc_chain = tcase_create ("titles");
ges_init ();
if (atexit (ges_deinit) != 0) {
GST_ERROR ("failed to set ges_deinit as exit function");
}

View file

@ -41,7 +41,6 @@ GST_START_TEST (test_update_restriction_caps)
GstCaps *new;
GstCaps *current;
ges_init ();
track = GES_TRACK (ges_audio_track_new ());
original = gst_caps_from_string ("audio/x-raw, format=S32LE");
@ -94,6 +93,7 @@ ges_suite (void)
Suite *s = suite_create ("ges-track");
TCase *tc_chain = tcase_create ("track");
ges_init ();
if (atexit (ges_deinit) != 0) {
GST_ERROR ("failed to set ges_deinit as exit function");
}

View file

@ -33,8 +33,6 @@ GST_START_TEST (test_transition_basic)
GESTransitionClip *tr1, *tr2;
GESTrackElement *trackelement;
ges_init ();
track = GES_TRACK (ges_video_track_new ());
layer = ges_layer_new ();
timeline = ges_timeline_new ();
@ -74,8 +72,6 @@ GST_START_TEST (test_transition_properties)
GESLayer *layer;
GESTrackElement *trackelement;
ges_init ();
clip = GES_CLIP (ges_transition_clip_new
(GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE));
@ -178,6 +174,8 @@ ges_suite (void)
Suite *s = suite_create ("ges-transition");
TCase *tc_chain = tcase_create ("transition");
ges_init ();
if (atexit (ges_deinit) != 0) {
GST_ERROR ("failed to set ges_deinit as exit function");
}

View file

@ -84,8 +84,6 @@ GST_START_TEST (test_filesource_basic)
GESTimeline *timeline;
GESLayer *layer;
fail_unless (ges_init ());
mainloop = g_main_loop_new (NULL, FALSE);
timeline = ges_timeline_new_audio_video ();
@ -125,8 +123,6 @@ GST_START_TEST (test_filesource_properties)
GESLayer *layer;
GESTrackElement *trackelement;
ges_init ();
track = ges_track_new (GES_TRACK_TYPE_AUDIO, gst_caps_ref (GST_CAPS_ANY));
fail_unless (track != NULL);
@ -214,8 +210,6 @@ GST_START_TEST (test_filesource_images)
GESLayer *layer;
GESTrackElement *track_element;
ges_init ();
a = GES_TRACK (ges_audio_track_new ());
v = GES_TRACK (ges_video_track_new ());
@ -290,6 +284,8 @@ main (int argc, char **argv)
gst_check_init (&argc, &argv);
ges_init ();
if (atexit (ges_deinit) != 0) {
GST_ERROR ("failed to set ges_deinit as exit function");
}