From: Tim-Philipp Müller Date: Fri, 15 May 2009 16:11:27 +0000 (+0100) Subject: checks: move files required by unit tests into tests/files and make sure they're... X-Git-Tag: 1.19.3~509^2~10373 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c014c4a621e1119ef8e2ca564de97878529b7197;p=platform%2Fupstream%2Fgstreamer.git checks: move files required by unit tests into tests/files and make sure they're disted Move unit test data into the directory where it belongs and make in particular the flacdec unit test cd into the directory with the test files instead of making assumptions about the current working directory in that unit test. As a side effect of movng those files, there's only one EXTRA_DIST in tests/check/Makefile.am now, which is likely to work better than having two. Hopefully fixes #582753. --- diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 88e8c16..22d0a49 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -10,11 +10,8 @@ TESTS_ENVIRONMENT = \ $(REGISTRY_ENVIRONMENT) \ GST_PLUGIN_SYSTEM_PATH= \ GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/ext:$(top_builddir)/sys:$(GSTPB_PLUGINS_DIR):$(GST_PLUGINS_DIR) \ - GST_TEST_FILES_PATH=$(TEST_FILES_DIRECTORY) \ STATE_IGNORE_ELEMENTS="aasink autoaudiosrc autoaudiosink autovideosrc autovideosink cacasink cairotextoverlay gconfaudiosrc gconfvideosrc gconfaudiosink gconfvideosink halaudiosrc halaudiosink v4l2src osssrc osssink pulsesink pulsesrc pulsemixer" -EXTRA_DIST = test-cert.pem test-key.pem audiotestsrc.flac - # ths core dumps of some machines have PIDs appended CLEANFILES = core.* test-registry.* @@ -115,7 +112,8 @@ TESTS = $(check_PROGRAMS) noinst_PROGRAMS = \ elements/autodetect -AM_CFLAGS = $(GST_OBJ_CFLAGS) $(GST_CHECK_CFLAGS) $(CHECK_CFLAGS) $(GST_OPTION_CFLAGS) +AM_CFLAGS = $(GST_OBJ_CFLAGS) $(GST_CHECK_CFLAGS) $(CHECK_CFLAGS) \ + $(GST_OPTION_CFLAGS) -DGST_TEST_FILES_PATH="\"$(TEST_FILES_DIRECTORY)\"" LDADD = $(GST_OBJ_LIBS) $(GST_CHECK_LIBS) $(CHECK_LIBS) # valgrind testing @@ -147,7 +145,7 @@ elements_deinterleave_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMIN elements_interleave_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS) elements_interleave_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD) -elements_souphttpsrc_CFLAGS = -DCHECKDATA_DIR="$(srcdir)" $(SOUP_CFLAGS) $(AM_CFLAGS) +elements_souphttpsrc_CFLAGS = $(SOUP_CFLAGS) $(AM_CFLAGS) elements_souphttpsrc_LDADD = $(SOUP_LIBS) $(LDADD) elements_sunaudio_CFLAGS = \ diff --git a/tests/check/elements/id3demux.c b/tests/check/elements/id3demux.c index a3eb77b..ef1d453 100644 --- a/tests/check/elements/id3demux.c +++ b/tests/check/elements/id3demux.c @@ -59,7 +59,6 @@ read_tags_from_file (const gchar * file, gboolean push_mode) GstMessage *msg; GstElement *src, *sep, *sink, *id3demux, *pipeline; GstBus *bus; - const gchar *dir; gchar *path; pipeline = gst_pipeline_new ("pipeline"); @@ -96,10 +95,7 @@ read_tags_from_file (const gchar * file, gboolean push_mode) /* can't link id3demux and sink yet, do that later */ g_signal_connect (id3demux, "pad-added", G_CALLBACK (pad_added_cb), pipeline); - dir = g_getenv ("GST_TEST_FILES_PATH"); - fail_unless (dir != NULL, "GST_TEST_FILES_PATH environment variable not set"); - - path = g_build_filename (dir, file, NULL); + path = g_build_filename (GST_TEST_FILES_PATH, file, NULL); GST_LOG ("reading file '%s'", path); g_object_set (src, "location", path, NULL); diff --git a/tests/check/elements/souphttpsrc.c b/tests/check/elements/souphttpsrc.c index 0112369..3c6f519 100644 --- a/tests/check/elements/souphttpsrc.c +++ b/tests/check/elements/souphttpsrc.c @@ -563,8 +563,8 @@ run_server (guint * http_port, guint * https_port) SoupServer *server, *ssl_server; guint port = SOUP_ADDRESS_ANY_PORT; guint ssl_port = SOUP_ADDRESS_ANY_PORT; - const char *ssl_cert_file = G_STRINGIFY (CHECKDATA_DIR) "/test-cert.pem"; - const char *ssl_key_file = G_STRINGIFY (CHECKDATA_DIR) "/test-key.pem"; + const char *ssl_cert_file = GST_TEST_FILES_PATH "/test-cert.pem"; + const char *ssl_key_file = GST_TEST_FILES_PATH "/test-key.pem"; static int server_running = 0; SoupAuthDomain *domain = NULL; diff --git a/tests/check/pipelines/flacdec.c b/tests/check/pipelines/flacdec.c index 3171025..ced6c34 100644 --- a/tests/check/pipelines/flacdec.c +++ b/tests/check/pipelines/flacdec.c @@ -18,6 +18,7 @@ */ #include +#include static guint16 buffer_get_first_sample (GstBuffer * buf) @@ -60,6 +61,8 @@ GST_START_TEST (test_decode) guint16 first_sample = 0; guint size = 0; + fail_unless_equals_int (g_chdir (GST_TEST_FILES_PATH), 0); + pipeline = gst_parse_launch ("filesrc location=audiotestsrc.flac" " ! flacdec ! appsink name=sink", NULL); fail_unless (pipeline != NULL); @@ -105,6 +108,8 @@ GST_START_TEST (test_decode_seek_full) gboolean result; guint size = 0; + fail_unless_equals_int (g_chdir (GST_TEST_FILES_PATH), 0); + pipeline = gst_parse_launch ("filesrc location=audiotestsrc.flac" " ! flacdec ! appsink name=sink", NULL); fail_unless (pipeline != NULL); @@ -158,6 +163,8 @@ GST_START_TEST (test_decode_seek_partial) guint size = 0; guint16 first_sample = 0; + fail_unless_equals_int (g_chdir (GST_TEST_FILES_PATH), 0); + pipeline = gst_parse_launch ("filesrc location=audiotestsrc.flac" " ! flacdec ! appsink name=sink", NULL); fail_unless (pipeline != NULL); @@ -206,7 +213,7 @@ GST_START_TEST (test_decode_seek_partial) GST_END_TEST; -Suite * +static Suite * flacdec_suite (void) { Suite *s = suite_create ("flacdec"); @@ -224,20 +231,4 @@ flacdec_suite (void) return s; } -int -main (int argc, char **argv) -{ - int nf; - - Suite *s = flacdec_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; -} +GST_CHECK_MAIN (flacdec); diff --git a/tests/files/Makefile.am b/tests/files/Makefile.am index dae803a..4f3d3a4 100644 --- a/tests/files/Makefile.am +++ b/tests/files/Makefile.am @@ -1,7 +1,10 @@ EXTRA_DIST = \ + audiotestsrc.flac \ id3-407349-1.tag \ id3-407349-2.tag \ id3-447000-wcop.tag \ - id3-577468-unsynced-tag.tag + id3-577468-unsynced-tag.tag \ + test-cert.pem \ + test-key.pem diff --git a/tests/check/audiotestsrc.flac b/tests/files/audiotestsrc.flac similarity index 100% rename from tests/check/audiotestsrc.flac rename to tests/files/audiotestsrc.flac diff --git a/tests/check/test-cert.pem b/tests/files/test-cert.pem similarity index 100% rename from tests/check/test-cert.pem rename to tests/files/test-cert.pem diff --git a/tests/check/test-key.pem b/tests/files/test-key.pem similarity index 100% rename from tests/check/test-key.pem rename to tests/files/test-key.pem