2005-07-12 Thomas Vander Stichele <thomas at apestaart dot org>
* check/Makefile.am:
+ add per-test valgrind targets
+ * check/gst-libs/gdp.c: (GST_START_TEST),
+ (gst_data_protocol_suite), (main):
+ clean up
+
+2005-07-12 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * check/Makefile.am:
instate more valgrindable tests
* check/elements/gstfakesrc.c: (chain_func), (event_func),
(GST_START_TEST), (fakesrc_suite):
+CHECK_REGISTRY=$(top_builddir)/check/test-registry.xml
+
TESTS_ENVIRONMENT=\
GST_PLUGIN_PATH_ONLY=yes \
GST_PLUGIN_PATH=$(top_builddir)/gst \
- GST_REGISTRY=$(top_builddir)/check/test-registry.xml
+ GST_REGISTRY=$(CHECK_REGISTRY)
plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
rm -rf $$i; \
done
+$(CHECK_REGISTRY):
+ $(TESTS_ENVIRONMENT) \
+ $(top_builddir)/tools/gst-register
+
# FIXME: it'd be nicer to run the versioned register, but in that case
# "make dist" complains about not finding gst-register-0.9.c
TESTS = $(top_builddir)/tools/gst-register \
gst/gstsystemclock \
gst/gsttag \
pipelines/cleanup \
- pipelines/simple_launch_lines \
- gst-libs/gdp
+ pipelines/simple_launch_lines
# these need fixing because the threads cause segfaults under valgrind
TESTS_THREADED = \
@true
endif
-valgrind:
+# valgrind any given test by running make test.valgrind
+%.valgrind: % $(CHECK_REGISTRY)
+ @$(TESTS_ENVIRONMENT) \
+ libtool --mode=execute \
+ $(VALGRIND_PATH) -q --suppressions=$(srcdir)/gst.supp \
+ --tool=memcheck --trace-children=yes \
+ $*
+
+# valgrind all tests
+valgrind: $(TESTS)
+ @echo "Valgrinding tests ..."
+ $(TESTS_ENVIRONMENT) $(top_builddir)/tools/gst-register
+ @failed=0; \
+ for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
+ make $$t.valgrind; \
+ if test "$$?" -ne 0; then \
+ echo "Valgrind error for test $$t"; \
+ failed=`expr $$failed + 1`; \
+ fi; \
+ done; \
+ if test "$$failed" -ne 0; then \
+ echo "$$failed tests had leaks under valgrind"; \
+ false; \
+ fi
+
+valgrindy: $(TESTS)
@echo "Valgrinding tests ..."
$(TESTS_ENVIRONMENT) $(top_builddir)/tools/gst-register
@failed=0; \
for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
$(TESTS_ENVIRONMENT) \
- CK_FORK=no \
libtool --mode=execute \
$(VALGRIND_PATH) -q --suppressions=$(srcdir)/gst.supp \
- --tool=memcheck $$t; \
+ --tool=memcheck --trace-children=yes \
+ $$t; \
if test "$$?" -ne 0; then \
echo "Valgrind error for test $$t"; \
failed=`expr $$failed + 1`; \
false; \
fi
+
"GST_WRITE_UINT64_BE: memcmp failed");
}
-GST_END_TEST
+GST_END_TEST;
+
/* test creation of header from buffer and back again */
GST_START_TEST (test_buffer)
{
fail_unless (GST_BUFFER_FLAG_IS_SET (newbuffer, GST_BUFFER_FLAG_IN_CAPS),
"GST_BUFFER_IN_CAPS flag should have been copied !");
+ /* clean up */
+ gst_buffer_unref (buffer);
+ gst_buffer_unref (newbuffer);
g_free (header);
}
-GST_END_TEST
+GST_END_TEST;
+
GST_START_TEST (test_caps)
{
gchar *string, *newstring;
"Could not validate packet");
newcaps = gst_dp_caps_from_packet (header_length, header, payload);
fail_unless (newcaps != NULL, "Could not create caps from packet");
- //g_return_val_if_fail (GST_IS_CAPS (newcaps), -1);
+ fail_unless (GST_IS_CAPS (newcaps));
newstring = gst_caps_to_string (newcaps);
g_message ("Received caps: %s\n", newstring);
fail_unless (strcmp (string, newstring) == 0,
"Created caps do not match original caps");
+
+ /* cleanup */
+ g_free (header);
+ g_free (payload);
g_free (string);
g_free (newstring);
}
-GST_END_TEST
+GST_END_TEST;
+
GST_START_TEST (test_event)
{
GstEvent *send;
"Received event is not EOS");
fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND,
"EOS timestamp is not 1.0 sec");
+
+ /* clean up */
+ g_free (header);
+ g_free (payload);
gst_event_unref (send);
gst_event_unref (receive);
"Received event is not flush");
fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 2,
"Flush timestamp is not 2.0 sec");
+
+ /* clean up */
+ g_free (header);
+ g_free (payload);
gst_event_unref (send);
gst_event_unref (receive);
"Seek format is not time");
fail_unless (GST_EVENT_SEEK_OFFSET (receive) == GST_SECOND,
"Seek offset is not 1.0 sec");
+
+ /* clean up */
+ g_free (header);
+ g_free (payload);
gst_event_unref (send);
gst_event_unref (receive);
}
-GST_END_TEST Suite *
-gst_object_suite (void)
+
+GST_END_TEST;
+
+Suite *
+gst_data_protocol_suite (void)
{
Suite *s = suite_create ("data protocol");
TCase *tc_chain = tcase_create ("general");
{
int nf;
- Suite *s = gst_object_suite ();
+ Suite *s = gst_data_protocol_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);
+CHECK_REGISTRY=$(top_builddir)/check/test-registry.xml
+
TESTS_ENVIRONMENT=\
GST_PLUGIN_PATH_ONLY=yes \
GST_PLUGIN_PATH=$(top_builddir)/gst \
- GST_REGISTRY=$(top_builddir)/check/test-registry.xml
+ GST_REGISTRY=$(CHECK_REGISTRY)
plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
rm -rf $$i; \
done
+$(CHECK_REGISTRY):
+ $(TESTS_ENVIRONMENT) \
+ $(top_builddir)/tools/gst-register
+
# FIXME: it'd be nicer to run the versioned register, but in that case
# "make dist" complains about not finding gst-register-0.9.c
TESTS = $(top_builddir)/tools/gst-register \
gst/gstsystemclock \
gst/gsttag \
pipelines/cleanup \
- pipelines/simple_launch_lines \
- gst-libs/gdp
+ pipelines/simple_launch_lines
# these need fixing because the threads cause segfaults under valgrind
TESTS_THREADED = \
@true
endif
-valgrind:
+# valgrind any given test by running make test.valgrind
+%.valgrind: % $(CHECK_REGISTRY)
+ @$(TESTS_ENVIRONMENT) \
+ libtool --mode=execute \
+ $(VALGRIND_PATH) -q --suppressions=$(srcdir)/gst.supp \
+ --tool=memcheck --trace-children=yes \
+ $*
+
+# valgrind all tests
+valgrind: $(TESTS)
+ @echo "Valgrinding tests ..."
+ $(TESTS_ENVIRONMENT) $(top_builddir)/tools/gst-register
+ @failed=0; \
+ for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
+ make $$t.valgrind; \
+ if test "$$?" -ne 0; then \
+ echo "Valgrind error for test $$t"; \
+ failed=`expr $$failed + 1`; \
+ fi; \
+ done; \
+ if test "$$failed" -ne 0; then \
+ echo "$$failed tests had leaks under valgrind"; \
+ false; \
+ fi
+
+valgrindy: $(TESTS)
@echo "Valgrinding tests ..."
$(TESTS_ENVIRONMENT) $(top_builddir)/tools/gst-register
@failed=0; \
for t in $(filter-out $(VALGRIND_TESTS_DISABLE),$(TESTS)); do \
$(TESTS_ENVIRONMENT) \
- CK_FORK=no \
libtool --mode=execute \
$(VALGRIND_PATH) -q --suppressions=$(srcdir)/gst.supp \
- --tool=memcheck $$t; \
+ --tool=memcheck --trace-children=yes \
+ $$t; \
if test "$$?" -ne 0; then \
echo "Valgrind error for test $$t"; \
failed=`expr $$failed + 1`; \
false; \
fi
+
"GST_WRITE_UINT64_BE: memcmp failed");
}
-GST_END_TEST
+GST_END_TEST;
+
/* test creation of header from buffer and back again */
GST_START_TEST (test_buffer)
{
fail_unless (GST_BUFFER_FLAG_IS_SET (newbuffer, GST_BUFFER_FLAG_IN_CAPS),
"GST_BUFFER_IN_CAPS flag should have been copied !");
+ /* clean up */
+ gst_buffer_unref (buffer);
+ gst_buffer_unref (newbuffer);
g_free (header);
}
-GST_END_TEST
+GST_END_TEST;
+
GST_START_TEST (test_caps)
{
gchar *string, *newstring;
"Could not validate packet");
newcaps = gst_dp_caps_from_packet (header_length, header, payload);
fail_unless (newcaps != NULL, "Could not create caps from packet");
- //g_return_val_if_fail (GST_IS_CAPS (newcaps), -1);
+ fail_unless (GST_IS_CAPS (newcaps));
newstring = gst_caps_to_string (newcaps);
g_message ("Received caps: %s\n", newstring);
fail_unless (strcmp (string, newstring) == 0,
"Created caps do not match original caps");
+
+ /* cleanup */
+ g_free (header);
+ g_free (payload);
g_free (string);
g_free (newstring);
}
-GST_END_TEST
+GST_END_TEST;
+
GST_START_TEST (test_event)
{
GstEvent *send;
"Received event is not EOS");
fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND,
"EOS timestamp is not 1.0 sec");
+
+ /* clean up */
+ g_free (header);
+ g_free (payload);
gst_event_unref (send);
gst_event_unref (receive);
"Received event is not flush");
fail_unless (GST_EVENT_TIMESTAMP (receive) == GST_SECOND * 2,
"Flush timestamp is not 2.0 sec");
+
+ /* clean up */
+ g_free (header);
+ g_free (payload);
gst_event_unref (send);
gst_event_unref (receive);
"Seek format is not time");
fail_unless (GST_EVENT_SEEK_OFFSET (receive) == GST_SECOND,
"Seek offset is not 1.0 sec");
+
+ /* clean up */
+ g_free (header);
+ g_free (payload);
gst_event_unref (send);
gst_event_unref (receive);
}
-GST_END_TEST Suite *
-gst_object_suite (void)
+
+GST_END_TEST;
+
+Suite *
+gst_data_protocol_suite (void)
{
Suite *s = suite_create ("data protocol");
TCase *tc_chain = tcase_create ("general");
{
int nf;
- Suite *s = gst_object_suite ();
+ Suite *s = gst_data_protocol_suite ();
SRunner *sr = srunner_create (s);
gst_check_init (&argc, &argv);