check: Use GST_CHECK_MAIN () macro everywhere

Makes source code smaller, and ensures we go through common initialization
path (like the one that sets up XML unit test output ...)
This commit is contained in:
Edward Hervey 2015-06-02 16:27:24 +02:00 committed by Edward Hervey
parent 647eefea67
commit d524439b35
35 changed files with 66 additions and 593 deletions

View file

@ -240,6 +240,11 @@ aacparse_suite (void)
Suite *s = suite_create ("aacparse"); Suite *s = suite_create ("aacparse");
TCase *tc_chain = tcase_create ("general"); TCase *tc_chain = tcase_create ("general");
/* init test context */
ctx_factory = "aacparse";
ctx_sink_template = &sinktemplate;
ctx_src_template = &srctemplate;
suite_add_tcase (s, tc_chain); suite_add_tcase (s, tc_chain);
/* ADIF tests */ /* ADIF tests */
tcase_add_test (tc_chain, test_parse_adif_normal); tcase_add_test (tc_chain, test_parse_adif_normal);
@ -267,25 +272,4 @@ aacparse_suite (void)
* - Both push- and pull-modes need to be tested * - Both push- and pull-modes need to be tested
* * Pull-mode & EOS * * Pull-mode & EOS
*/ */
GST_CHECK_MAIN (aacparse);
int
main (int argc, char **argv)
{
int nf;
Suite *s = aacparse_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
/* init test context */
ctx_factory = "aacparse";
ctx_sink_template = &sinktemplate;
ctx_src_template = &srctemplate;
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -122,6 +122,11 @@ ac3parse_suite (void)
Suite *s = suite_create ("ac3parse"); Suite *s = suite_create ("ac3parse");
TCase *tc_chain = tcase_create ("general"); TCase *tc_chain = tcase_create ("general");
/* init test context */
ctx_factory = "ac3parse";
ctx_sink_template = &sinktemplate;
ctx_src_template = &srctemplate;
suite_add_tcase (s, tc_chain); suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_parse_normal); tcase_add_test (tc_chain, test_parse_normal);
tcase_add_test (tc_chain, test_parse_drain_single); tcase_add_test (tc_chain, test_parse_drain_single);
@ -139,25 +144,4 @@ ac3parse_suite (void)
* - Both push- and pull-modes need to be tested * - Both push- and pull-modes need to be tested
* * Pull-mode & EOS * * Pull-mode & EOS
*/ */
GST_CHECK_MAIN (ac3parse);
int
main (int argc, char **argv)
{
int nf;
Suite *s = ac3parse_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
/* init test context */
ctx_factory = "ac3parse";
ctx_sink_template = &sinktemplate;
ctx_src_template = &srctemplate;
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -408,19 +408,4 @@ apev2mux_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (apev2mux);
main (int argc, char **argv)
{
int nf;
Suite *s = apev2mux_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -172,19 +172,4 @@ aspectratiocrop_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (aspectratiocrop);
main (int argc, char **argv)
{
int nf;
Suite *s = aspectratiocrop_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -464,19 +464,4 @@ amplify_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (amplify);
main (int argc, char **argv)
{
int nf;
Suite *s = amplify_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -1667,19 +1667,4 @@ audiochebband_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (audiochebband);
main (int argc, char **argv)
{
int nf;
Suite *s = audiochebband_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -1083,19 +1083,4 @@ audiocheblimit_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (audiocheblimit);
main (int argc, char **argv)
{
int nf;
Suite *s = audiocheblimit_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -439,19 +439,4 @@ dynamic_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (dynamic);
main (int argc, char **argv)
{
int nf;
Suite *s = dynamic_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -281,19 +281,4 @@ invert_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (invert);
main (int argc, char **argv)
{
int nf;
Suite *s = invert_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -1134,19 +1134,4 @@ audiowsincband_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (audiowsincband);
main (int argc, char **argv)
{
int nf;
Suite *s = audiowsincband_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -785,19 +785,4 @@ audiowsinclimit_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (audiowsinclimit);
main (int argc, char **argv)
{
int nf;
Suite *s = audiowsinclimit_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -266,19 +266,4 @@ avimux_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (avimux);
main (int argc, char **argv)
{
int nf;
Suite *s = avimux_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -377,19 +377,4 @@ equalizer_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (equalizer);
main (int argc, char **argv)
{
int nf;
Suite *s = equalizer_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -250,6 +250,19 @@ flacparse_suite (void)
Suite *s = suite_create ("flacparse"); Suite *s = suite_create ("flacparse");
TCase *tc_chain = tcase_create ("general"); TCase *tc_chain = tcase_create ("general");
/* init test context */
ctx_factory = "flacparse";
ctx_sink_template = &sinktemplate;
ctx_src_template = &srctemplate;
ctx_discard = 3;
ctx_headers[0].data = streaminfo_header;
ctx_headers[0].size = sizeof (streaminfo_header);
ctx_headers[1].data = comment_header;
ctx_headers[1].size = sizeof (comment_header);
/* custom offsets, and ts always repeatedly 0 */
ctx_no_metadata = TRUE;
suite_add_tcase (s, tc_chain); suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_parse_flac_normal); tcase_add_test (tc_chain, test_parse_flac_normal);
tcase_add_test (tc_chain, test_parse_flac_drain_single); tcase_add_test (tc_chain, test_parse_flac_drain_single);
@ -269,32 +282,4 @@ flacparse_suite (void)
* - Both push- and pull-modes need to be tested * - Both push- and pull-modes need to be tested
* * Pull-mode & EOS * * Pull-mode & EOS
*/ */
GST_CHECK_MAIN (flacparse);
int
main (int argc, char **argv)
{
int nf;
Suite *s = flacparse_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
/* init test context */
ctx_factory = "flacparse";
ctx_sink_template = &sinktemplate;
ctx_src_template = &srctemplate;
ctx_discard = 3;
ctx_headers[0].data = streaminfo_header;
ctx_headers[0].size = sizeof (streaminfo_header);
ctx_headers[1].data = comment_header;
ctx_headers[1].size = sizeof (comment_header);
/* custom offsets, and ts always repeatedly 0 */
ctx_no_metadata = TRUE;
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -518,19 +518,4 @@ id3v2mux_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (id3v2mux);
main (int argc, char **argv)
{
int nf;
Suite *s = id3v2mux_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -138,19 +138,4 @@ jpegdec_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (jpegdec);
main (int argc, char **argv)
{
int nf;
Suite *s = jpegdec_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -236,19 +236,4 @@ jpegenc_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (jpegenc);
main (int argc, char **argv)
{
int nf;
Suite *s = jpegenc_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -477,19 +477,4 @@ matroskamux_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (matroskamux);
main (int argc, char **argv)
{
int nf;
Suite *s = matroskamux_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -129,6 +129,12 @@ mpegaudioparse_suite (void)
Suite *s = suite_create ("mpegaudioparse"); Suite *s = suite_create ("mpegaudioparse");
TCase *tc_chain = tcase_create ("general"); TCase *tc_chain = tcase_create ("general");
/* init test context */
ctx_factory = "mpegaudioparse";
ctx_sink_template = &sinktemplate;
ctx_src_template = &srctemplate;
suite_add_tcase (s, tc_chain); suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_parse_normal); tcase_add_test (tc_chain, test_parse_normal);
tcase_add_test (tc_chain, test_parse_drain_single); tcase_add_test (tc_chain, test_parse_drain_single);
@ -146,25 +152,4 @@ mpegaudioparse_suite (void)
* - Both push- and pull-modes need to be tested * - Both push- and pull-modes need to be tested
* * Pull-mode & EOS * * Pull-mode & EOS
*/ */
GST_CHECK_MAIN (mpegaudioparse);
int
main (int argc, char **argv)
{
int nf;
Suite *s = mpegaudioparse_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
/* init test context */
ctx_factory = "mpegaudioparse";
ctx_sink_template = &sinktemplate;
ctx_src_template = &srctemplate;
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -1976,19 +1976,4 @@ rganalysis_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (rganalysis);
main (int argc, char **argv)
{
gint nf;
Suite *s = rganalysis_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_ENV);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -274,19 +274,4 @@ rglimiter_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (rglimiter);
main (int argc, char **argv)
{
gint nf;
Suite *s = rglimiter_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_ENV);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -669,19 +669,4 @@ rgvolume_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (rgvolume);
main (int argc, char **argv)
{
gint nf;
Suite *s = rgvolume_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_ENV);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -687,7 +687,7 @@ GST_START_TEST (test_aux_receiver)
GST_END_TEST; GST_END_TEST;
static Suite * static Suite *
gstrtpbin_suite (void) rtpbin_suite (void)
{ {
Suite *s = suite_create ("rtpbin"); Suite *s = suite_create ("rtpbin");
TCase *tc_chain = tcase_create ("general"); TCase *tc_chain = tcase_create ("general");
@ -706,19 +706,4 @@ gstrtpbin_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (rtpbin);
main (int argc, char **argv)
{
int nf;
Suite *s = gstrtpbin_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -566,7 +566,7 @@ GST_START_TEST (test_internal_sources_timeout)
GST_END_TEST; GST_END_TEST;
static Suite * static Suite *
gstrtpsession_suite (void) rtpsession_suite (void)
{ {
Suite *s = suite_create ("rtpsession"); Suite *s = suite_create ("rtpsession");
TCase *tc_chain = tcase_create ("general"); TCase *tc_chain = tcase_create ("general");
@ -579,19 +579,4 @@ gstrtpsession_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (rtpsession);
main (int argc, char **argv)
{
int nf;
Suite *s = gstrtpsession_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -538,19 +538,4 @@ spectrum_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (spectrum);
main (int argc, char **argv)
{
int nf;
Suite *s = spectrum_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -220,19 +220,4 @@ videobox_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (videobox);
main (int argc, char **argv)
{
int nf;
Suite *s = videobox_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -816,19 +816,4 @@ videocrop_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (videocrop);
main (int argc, char **argv)
{
int nf;
Suite *s = videocrop_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -263,19 +263,4 @@ videofilter_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (videofilter);
main (int argc, char **argv)
{
int nf;
Suite *s = videofilter_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -240,19 +240,4 @@ wavpackdec_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (wavpackdec);
main (int argc, char **argv)
{
int nf;
Suite *s = wavpackdec_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -179,19 +179,4 @@ wavpackenc_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (wavpackenc);
main (int argc, char **argv)
{
int nf;
Suite *s = wavpackenc_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -231,19 +231,4 @@ wavpackparse_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (wavpackparse);
main (int argc, char **argv)
{
int nf;
Suite *s = wavpackparse_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -165,19 +165,4 @@ y4menc_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (y4menc);
main (int argc, char **argv)
{
int nf;
Suite *s = y4menc_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -303,19 +303,4 @@ simple_launch_lines_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (simple_launch_lines);
main (int argc, char **argv)
{
int nf;
Suite *s = simple_launch_lines_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -353,20 +353,4 @@ metadata_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (metadata);
main (int argc, char **argv)
{
int nf;
Suite *s = metadata_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -202,18 +202,4 @@ wavpack_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (wavpack);
main (int argc, char **argv)
{
int nf;
Suite *s = wavpack_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}