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.
This commit is contained in:
Tim-Philipp Müller 2009-05-15 17:11:27 +01:00
parent ad9b02b881
commit c014c4a621
8 changed files with 19 additions and 31 deletions

View file

@ -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 = \

View file

@ -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);

View file

@ -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;

View file

@ -18,6 +18,7 @@
*/
#include <gst/check/gstcheck.h>
#include <glib/gstdio.h>
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);

View file

@ -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