Commit c014c4a6 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

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.
parent ad9b02b8
...@@ -10,11 +10,8 @@ TESTS_ENVIRONMENT = \ ...@@ -10,11 +10,8 @@ TESTS_ENVIRONMENT = \
$(REGISTRY_ENVIRONMENT) \ $(REGISTRY_ENVIRONMENT) \
GST_PLUGIN_SYSTEM_PATH= \ GST_PLUGIN_SYSTEM_PATH= \
GST_PLUGIN_PATH=$(top_builddir)/gst:$(top_builddir)/ext:$(top_builddir)/sys:$(GSTPB_PLUGINS_DIR):$(GST_PLUGINS_DIR) \ 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" 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 # ths core dumps of some machines have PIDs appended
CLEANFILES = core.* test-registry.* CLEANFILES = core.* test-registry.*
...@@ -115,7 +112,8 @@ TESTS = $(check_PROGRAMS) ...@@ -115,7 +112,8 @@ TESTS = $(check_PROGRAMS)
noinst_PROGRAMS = \ noinst_PROGRAMS = \
elements/autodetect 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) LDADD = $(GST_OBJ_LIBS) $(GST_CHECK_LIBS) $(CHECK_LIBS)
# valgrind testing # valgrind testing
...@@ -147,7 +145,7 @@ elements_deinterleave_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMIN ...@@ -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_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(CFLAGS) $(AM_CFLAGS)
elements_interleave_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(LDADD) 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_souphttpsrc_LDADD = $(SOUP_LIBS) $(LDADD)
elements_sunaudio_CFLAGS = \ elements_sunaudio_CFLAGS = \
......
...@@ -59,7 +59,6 @@ read_tags_from_file (const gchar * file, gboolean push_mode) ...@@ -59,7 +59,6 @@ read_tags_from_file (const gchar * file, gboolean push_mode)
GstMessage *msg; GstMessage *msg;
GstElement *src, *sep, *sink, *id3demux, *pipeline; GstElement *src, *sep, *sink, *id3demux, *pipeline;
GstBus *bus; GstBus *bus;
const gchar *dir;
gchar *path; gchar *path;
pipeline = gst_pipeline_new ("pipeline"); pipeline = gst_pipeline_new ("pipeline");
...@@ -96,10 +95,7 @@ read_tags_from_file (const gchar * file, gboolean push_mode) ...@@ -96,10 +95,7 @@ read_tags_from_file (const gchar * file, gboolean push_mode)
/* can't link id3demux and sink yet, do that later */ /* can't link id3demux and sink yet, do that later */
g_signal_connect (id3demux, "pad-added", G_CALLBACK (pad_added_cb), pipeline); g_signal_connect (id3demux, "pad-added", G_CALLBACK (pad_added_cb), pipeline);
dir = g_getenv ("GST_TEST_FILES_PATH"); path = g_build_filename (GST_TEST_FILES_PATH, file, NULL);
fail_unless (dir != NULL, "GST_TEST_FILES_PATH environment variable not set");
path = g_build_filename (dir, file, NULL);
GST_LOG ("reading file '%s'", path); GST_LOG ("reading file '%s'", path);
g_object_set (src, "location", path, NULL); g_object_set (src, "location", path, NULL);
......
...@@ -563,8 +563,8 @@ run_server (guint * http_port, guint * https_port) ...@@ -563,8 +563,8 @@ run_server (guint * http_port, guint * https_port)
SoupServer *server, *ssl_server; SoupServer *server, *ssl_server;
guint port = SOUP_ADDRESS_ANY_PORT; guint port = SOUP_ADDRESS_ANY_PORT;
guint ssl_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_cert_file = GST_TEST_FILES_PATH "/test-cert.pem";
const char *ssl_key_file = G_STRINGIFY (CHECKDATA_DIR) "/test-key.pem"; const char *ssl_key_file = GST_TEST_FILES_PATH "/test-key.pem";
static int server_running = 0; static int server_running = 0;
SoupAuthDomain *domain = NULL; SoupAuthDomain *domain = NULL;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <glib/gstdio.h>
static guint16 static guint16
buffer_get_first_sample (GstBuffer * buf) buffer_get_first_sample (GstBuffer * buf)
...@@ -60,6 +61,8 @@ GST_START_TEST (test_decode) ...@@ -60,6 +61,8 @@ GST_START_TEST (test_decode)
guint16 first_sample = 0; guint16 first_sample = 0;
guint size = 0; guint size = 0;
fail_unless_equals_int (g_chdir (GST_TEST_FILES_PATH), 0);
pipeline = gst_parse_launch ("filesrc location=audiotestsrc.flac" pipeline = gst_parse_launch ("filesrc location=audiotestsrc.flac"
" ! flacdec ! appsink name=sink", NULL); " ! flacdec ! appsink name=sink", NULL);
fail_unless (pipeline != NULL); fail_unless (pipeline != NULL);
...@@ -105,6 +108,8 @@ GST_START_TEST (test_decode_seek_full) ...@@ -105,6 +108,8 @@ GST_START_TEST (test_decode_seek_full)
gboolean result; gboolean result;
guint size = 0; guint size = 0;
fail_unless_equals_int (g_chdir (GST_TEST_FILES_PATH), 0);
pipeline = gst_parse_launch ("filesrc location=audiotestsrc.flac" pipeline = gst_parse_launch ("filesrc location=audiotestsrc.flac"
" ! flacdec ! appsink name=sink", NULL); " ! flacdec ! appsink name=sink", NULL);
fail_unless (pipeline != NULL); fail_unless (pipeline != NULL);
...@@ -158,6 +163,8 @@ GST_START_TEST (test_decode_seek_partial) ...@@ -158,6 +163,8 @@ GST_START_TEST (test_decode_seek_partial)
guint size = 0; guint size = 0;
guint16 first_sample = 0; guint16 first_sample = 0;
fail_unless_equals_int (g_chdir (GST_TEST_FILES_PATH), 0);
pipeline = gst_parse_launch ("filesrc location=audiotestsrc.flac" pipeline = gst_parse_launch ("filesrc location=audiotestsrc.flac"
" ! flacdec ! appsink name=sink", NULL); " ! flacdec ! appsink name=sink", NULL);
fail_unless (pipeline != NULL); fail_unless (pipeline != NULL);
...@@ -206,7 +213,7 @@ GST_START_TEST (test_decode_seek_partial) ...@@ -206,7 +213,7 @@ GST_START_TEST (test_decode_seek_partial)
GST_END_TEST; GST_END_TEST;
Suite * static Suite *
flacdec_suite (void) flacdec_suite (void)
{ {
Suite *s = suite_create ("flacdec"); Suite *s = suite_create ("flacdec");
...@@ -224,20 +231,4 @@ flacdec_suite (void) ...@@ -224,20 +231,4 @@ flacdec_suite (void)
return s; return s;
} }
int GST_CHECK_MAIN (flacdec);
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;
}
EXTRA_DIST = \ EXTRA_DIST = \
audiotestsrc.flac \
id3-407349-1.tag \ id3-407349-1.tag \
id3-407349-2.tag \ id3-407349-2.tag \
id3-447000-wcop.tag \ id3-447000-wcop.tag \
id3-577468-unsynced-tag.tag id3-577468-unsynced-tag.tag \
test-cert.pem \
test-key.pem
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment