From 3baa1d655c358a3d7f3df4b96a121d7d7338dc5e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 10 Sep 2016 10:05:28 +0100 Subject: [PATCH] tests: videoscale: split test into multiple ones The videoscale test takes eternities to run, that's not great. Split the test into multiple ones. That way they can be run in parallel. Reduces time to run all tests in -base from 29 secs to 12 secs when using meson/ninja. --- tests/check/Makefile.am | 23 ++++++++++++++++++++++- tests/check/elements/.gitignore | 1 + tests/check/elements/videoscale.c | 34 ++++++++++++++++++++++++++++++---- tests/check/meson.build | 12 ++++++++++++ 4 files changed, 65 insertions(+), 5 deletions(-) diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 9b9dc11..a70b3cf 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -122,7 +122,9 @@ check_videorate = endif if USE_PLUGIN_VIDEOSCALE -check_videoscale = elements/videoscale +check_videoscale = elements/videoscale elements/videoscale-1 \ + elements/videoscale-2 elements/videoscale-3 elements/videoscale-4 \ + elements/videoscale-5 elements/videoscale-6 else check_videoscale = endif @@ -589,6 +591,25 @@ elements_videoscale_LDADD = \ $(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_API_VERSION@.la \ $(GST_BASE_LIBS) $(LDADD) +elements_videoscale_1_SOURCES = elements/videoscale.c +elements_videoscale_1_CFLAGS = $(elements_videoscale_CFLAGS) -DVSCALE_TEST_GROUP=1 +elements_videoscale_1_LDADD = $(elements_videoscale_LDADD) +elements_videoscale_2_SOURCES = elements/videoscale.c +elements_videoscale_2_CFLAGS = $(elements_videoscale_CFLAGS) -DVSCALE_TEST_GROUP=2 +elements_videoscale_2_LDADD = $(elements_videoscale_LDADD) +elements_videoscale_3_SOURCES = elements/videoscale.c +elements_videoscale_3_CFLAGS = $(elements_videoscale_CFLAGS) -DVSCALE_TEST_GROUP=3 +elements_videoscale_3_LDADD = $(elements_videoscale_LDADD) +elements_videoscale_4_SOURCES = elements/videoscale.c +elements_videoscale_4_CFLAGS = $(elements_videoscale_CFLAGS) -DVSCALE_TEST_GROUP=4 +elements_videoscale_4_LDADD = $(elements_videoscale_LDADD) +elements_videoscale_5_SOURCES = elements/videoscale.c +elements_videoscale_5_CFLAGS = $(elements_videoscale_CFLAGS) -DVSCALE_TEST_GROUP=5 +elements_videoscale_5_LDADD = $(elements_videoscale_LDADD) +elements_videoscale_6_SOURCES = elements/videoscale.c +elements_videoscale_6_CFLAGS = $(elements_videoscale_CFLAGS) -DVSCALE_TEST_GROUP=6 +elements_videoscale_6_LDADD = $(elements_videoscale_LDADD) + gst_typefindfunctions_CFLAGS = $(GST_BASE_CFLAGS) $(AM_CFLAGS) gst_typefindfunctions_LDADD = $(GST_BASE_LIBS) $(LDADD) diff --git a/tests/check/elements/.gitignore b/tests/check/elements/.gitignore index b4346b8..cc78f03 100644 --- a/tests/check/elements/.gitignore +++ b/tests/check/elements/.gitignore @@ -21,6 +21,7 @@ typefindfunctions textoverlay videoconvert videoscale +videoscale-[1-6] vorbistag playbin playbin-compressed diff --git a/tests/check/elements/videoscale.c b/tests/check/elements/videoscale.c index 877df4f..c158061 100644 --- a/tests/check/elements/videoscale.c +++ b/tests/check/elements/videoscale.c @@ -29,6 +29,8 @@ /* kids, don't do this at home, skipping checks is *BAD* */ #define LINK_CHECK_FLAGS GST_PAD_LINK_CHECK_NOTHING +#ifndef VSCALE_TEST_GROUP + static guint get_num_formats (void) { @@ -157,6 +159,8 @@ GST_START_TEST (test_template_formats) GST_END_TEST; +#endif /* !defined(VSCALE_TEST_GROUP) */ + static GstCaps ** videoscale_get_allowed_caps_for_method (int method) { @@ -307,6 +311,8 @@ run_test (const GstCaps * caps, gint src_width, gint src_height, gst_object_unref (bus); } +#ifndef VSCALE_TEST_GROUP + static void on_sink_handoff_passthrough (GstElement * element, GstBuffer * buffer, GstPad * pad, gpointer user_data) @@ -409,6 +415,7 @@ GST_START_TEST (test_passthrough_method_3) } GST_END_TEST; +#endif /* !defined(VSCALE_TEST_GROUP) */ #define CREATE_TEST(name,method,src_width,src_height,dest_width,dest_height) \ GST_START_TEST (name) \ @@ -434,6 +441,7 @@ GST_START_TEST (name) \ \ GST_END_TEST; +#if defined(VSCALE_TEST_GROUP) && VSCALE_TEST_GROUP == 1 CREATE_TEST (test_downscale_640x480_320x240_method_0, 0, 640, 480, 320, 240); CREATE_TEST (test_downscale_640x480_320x240_method_1, 1, 640, 480, 320, 240); CREATE_TEST (test_downscale_640x480_320x240_method_2, 2, 640, 480, 320, 240); @@ -442,6 +450,7 @@ CREATE_TEST (test_upscale_320x240_640x480_method_0, 0, 320, 240, 640, 480); CREATE_TEST (test_upscale_320x240_640x480_method_1, 1, 320, 240, 640, 480); CREATE_TEST (test_upscale_320x240_640x480_method_2, 2, 320, 240, 640, 480); CREATE_TEST (test_upscale_320x240_640x480_method_3, 3, 320, 240, 640, 480); +#elif defined(VSCALE_TEST_GROUP) && VSCALE_TEST_GROUP == 2 CREATE_TEST (test_downscale_640x480_1x1_method_0, 0, 640, 480, 1, 1); CREATE_TEST (test_downscale_640x480_1x1_method_1, 1, 640, 480, 1, 1); CREATE_TEST (test_downscale_640x480_1x1_method_2, 2, 640, 480, 1, 1); @@ -450,6 +459,7 @@ CREATE_TEST (test_upscale_1x1_640x480_method_0, 0, 1, 1, 640, 480); CREATE_TEST (test_upscale_1x1_640x480_method_1, 1, 1, 1, 640, 480); CREATE_TEST (test_upscale_1x1_640x480_method_2, 2, 1, 1, 640, 480); CREATE_TEST (test_upscale_1x1_640x480_method_3, 3, 1, 1, 640, 480); +#elif defined(VSCALE_TEST_GROUP) && VSCALE_TEST_GROUP == 3 CREATE_TEST (test_downscale_641x481_111x30_method_0, 0, 641, 481, 111, 30); CREATE_TEST (test_downscale_641x481_111x30_method_1, 1, 641, 481, 111, 30); CREATE_TEST (test_downscale_641x481_111x30_method_2, 2, 641, 481, 111, 30); @@ -458,6 +468,7 @@ CREATE_TEST (test_upscale_111x30_641x481_method_0, 0, 111, 30, 641, 481); CREATE_TEST (test_upscale_111x30_641x481_method_1, 1, 111, 30, 641, 481); CREATE_TEST (test_upscale_111x30_641x481_method_2, 2, 111, 30, 641, 481); CREATE_TEST (test_upscale_111x30_641x481_method_3, 2, 111, 30, 641, 481); +#elif defined(VSCALE_TEST_GROUP) && VSCALE_TEST_GROUP == 4 CREATE_TEST (test_downscale_641x481_30x111_method_0, 0, 641, 481, 30, 111); CREATE_TEST (test_downscale_641x481_30x111_method_1, 1, 641, 481, 30, 111); CREATE_TEST (test_downscale_641x481_30x111_method_2, 2, 641, 481, 30, 111); @@ -466,6 +477,7 @@ CREATE_TEST (test_upscale_30x111_641x481_method_0, 0, 30, 111, 641, 481); CREATE_TEST (test_upscale_30x111_641x481_method_1, 1, 30, 111, 641, 481); CREATE_TEST (test_upscale_30x111_641x481_method_2, 2, 30, 111, 641, 481); CREATE_TEST (test_upscale_30x111_641x481_method_3, 3, 30, 111, 641, 481); +#elif defined(VSCALE_TEST_GROUP) && VSCALE_TEST_GROUP == 5 CREATE_TEST (test_downscale_640x480_320x1_method_0, 0, 640, 480, 320, 1); CREATE_TEST (test_downscale_640x480_320x1_method_1, 1, 640, 480, 320, 1); CREATE_TEST (test_downscale_640x480_320x1_method_2, 2, 640, 480, 320, 1); @@ -474,6 +486,7 @@ CREATE_TEST (test_upscale_320x1_640x480_method_0, 0, 320, 1, 640, 480); CREATE_TEST (test_upscale_320x1_640x480_method_1, 1, 320, 1, 640, 480); CREATE_TEST (test_upscale_320x1_640x480_method_2, 2, 320, 1, 640, 480); CREATE_TEST (test_upscale_320x1_640x480_method_3, 3, 320, 1, 640, 480); +#elif defined(VSCALE_TEST_GROUP) && VSCALE_TEST_GROUP == 6 CREATE_TEST (test_downscale_640x480_1x240_method_0, 0, 640, 480, 1, 240); CREATE_TEST (test_downscale_640x480_1x240_method_1, 1, 640, 480, 1, 240); CREATE_TEST (test_downscale_640x480_1x240_method_2, 2, 640, 480, 1, 240); @@ -482,6 +495,9 @@ CREATE_TEST (test_upscale_1x240_640x480_method_0, 0, 1, 240, 640, 480); CREATE_TEST (test_upscale_1x240_640x480_method_1, 1, 1, 240, 640, 480); CREATE_TEST (test_upscale_1x240_640x480_method_2, 2, 1, 240, 640, 480); CREATE_TEST (test_upscale_1x240_640x480_method_3, 3, 1, 240, 640, 480); +#endif + +#ifndef VSCALE_TEST_GROUP typedef struct { @@ -973,6 +989,8 @@ GST_START_TEST (test_basetransform_negotiation) GST_END_TEST; +#endif /* !defined(VSCALE_TEST_GROUP) */ + static Suite * videoscale_suite (void) { @@ -981,11 +999,18 @@ videoscale_suite (void) suite_add_tcase (s, tc_chain); tcase_set_timeout (tc_chain, 180); +#ifndef VSCALE_TEST_GROUP tcase_add_test (tc_chain, test_template_formats); tcase_add_test (tc_chain, test_passthrough_method_0); tcase_add_test (tc_chain, test_passthrough_method_1); tcase_add_test (tc_chain, test_passthrough_method_2); tcase_add_test (tc_chain, test_passthrough_method_3); + tcase_add_test (tc_chain, test_negotiation); +#if 0 + tcase_add_test (tc_chain, test_reverse_negotiation); +#endif + tcase_add_test (tc_chain, test_basetransform_negotiation); +#elif VSCALE_TEST_GROUP == 1 tcase_add_test (tc_chain, test_downscale_640x480_320x240_method_0); tcase_add_test (tc_chain, test_downscale_640x480_320x240_method_1); tcase_add_test (tc_chain, test_downscale_640x480_320x240_method_2); @@ -994,6 +1019,7 @@ videoscale_suite (void) tcase_add_test (tc_chain, test_upscale_320x240_640x480_method_1); tcase_add_test (tc_chain, test_upscale_320x240_640x480_method_2); tcase_add_test (tc_chain, test_upscale_320x240_640x480_method_3); +#elif VSCALE_TEST_GROUP == 2 tcase_add_test (tc_chain, test_downscale_640x480_1x1_method_0); tcase_add_test (tc_chain, test_downscale_640x480_1x1_method_1); tcase_add_test (tc_chain, test_downscale_640x480_1x1_method_2); @@ -1002,6 +1028,7 @@ videoscale_suite (void) tcase_add_test (tc_chain, test_upscale_1x1_640x480_method_1); tcase_add_test (tc_chain, test_upscale_1x1_640x480_method_2); tcase_add_test (tc_chain, test_upscale_1x1_640x480_method_3); +#elif VSCALE_TEST_GROUP == 3 tcase_add_test (tc_chain, test_downscale_641x481_111x30_method_0); tcase_add_test (tc_chain, test_downscale_641x481_111x30_method_1); tcase_add_test (tc_chain, test_downscale_641x481_111x30_method_2); @@ -1010,6 +1037,7 @@ videoscale_suite (void) tcase_add_test (tc_chain, test_upscale_111x30_641x481_method_1); tcase_add_test (tc_chain, test_upscale_111x30_641x481_method_2); tcase_add_test (tc_chain, test_upscale_111x30_641x481_method_3); +#elif VSCALE_TEST_GROUP == 4 tcase_add_test (tc_chain, test_downscale_641x481_30x111_method_0); tcase_add_test (tc_chain, test_downscale_641x481_30x111_method_1); tcase_add_test (tc_chain, test_downscale_641x481_30x111_method_2); @@ -1018,6 +1046,7 @@ videoscale_suite (void) tcase_add_test (tc_chain, test_upscale_30x111_641x481_method_1); tcase_add_test (tc_chain, test_upscale_30x111_641x481_method_2); tcase_add_test (tc_chain, test_upscale_30x111_641x481_method_3); +#elif VSCALE_TEST_GROUP == 5 tcase_add_test (tc_chain, test_downscale_640x480_320x1_method_0); tcase_add_test (tc_chain, test_downscale_640x480_320x1_method_1); tcase_add_test (tc_chain, test_downscale_640x480_320x1_method_2); @@ -1026,6 +1055,7 @@ videoscale_suite (void) tcase_add_test (tc_chain, test_upscale_320x1_640x480_method_1); tcase_add_test (tc_chain, test_upscale_320x1_640x480_method_2); tcase_skip_broken_test (tc_chain, test_upscale_320x1_640x480_method_3); +#elif VSCALE_TEST_GROUP == 6 tcase_add_test (tc_chain, test_downscale_640x480_1x240_method_0); tcase_add_test (tc_chain, test_downscale_640x480_1x240_method_1); tcase_add_test (tc_chain, test_downscale_640x480_1x240_method_2); @@ -1034,11 +1064,7 @@ videoscale_suite (void) tcase_add_test (tc_chain, test_upscale_1x240_640x480_method_1); tcase_add_test (tc_chain, test_upscale_1x240_640x480_method_2); tcase_add_test (tc_chain, test_upscale_1x240_640x480_method_3); - tcase_add_test (tc_chain, test_negotiation); -#if 0 - tcase_add_test (tc_chain, test_reverse_negotiation); #endif - tcase_add_test (tc_chain, test_basetransform_negotiation); return s; } diff --git a/tests/check/meson.build b/tests/check/meson.build index 1fa963d..dfc9346 100644 --- a/tests/check/meson.build +++ b/tests/check/meson.build @@ -131,6 +131,18 @@ foreach t : base_tests endif endforeach +# videoscale tests (split in groups) +foreach group : [1, 2, 3, 4, 5, 6] + vscale_test_name = 'elements/videoscale-@0@'.format(group) + exe = executable(vscale_test_name, 'elements/videoscale.c', + include_directories : [configinc], + c_args : ['-DHAVE_CONFIG_H=1', '-DVSCALE_TEST_GROUP=@0@'.format(group) ] + test_defines, + dependencies : [libm] + test_deps + extra_deps) + test(vscale_test_name, exe, + env: test_env + ['GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name)], + timeout: 3 * 60) +endforeach + # ===============> FIXME <========== test('gstlibscpp', executable('gstlibscpp', 'libs/gstlibscpp.cc', include_directories : [configinc], -- 2.7.4