mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
tests/check/: Add simple test that runs a device property probe on alsasrc, alsasink and alsamixer. Disable valgrind ...
Original commit message from CVS: * tests/check/Makefile.am: * tests/check/elements/alsa.c: (test_device_property_probe), (alsa_suite), (main): Add simple test that runs a device property probe on alsasrc, alsasink and alsamixer. Disable valgrind check for now (too many leaks in libasound, and valgrind ignored my suppressions additions).
This commit is contained in:
parent
f0f9f5ac7f
commit
da8a3c9b07
3 changed files with 122 additions and 1 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2006-05-18 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* tests/check/Makefile.am:
|
||||||
|
* tests/check/elements/alsa.c: (test_device_property_probe),
|
||||||
|
(alsa_suite), (main):
|
||||||
|
Add simple test that runs a device property probe on alsasrc,
|
||||||
|
alsasink and alsamixer. Disable valgrind check for now (too
|
||||||
|
many leaks in libasound, and valgrind ignored my suppressions
|
||||||
|
additions).
|
||||||
|
|
||||||
2006-05-18 Tim-Philipp Müller <tim at centricular dot net>
|
2006-05-18 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* ext/alsa/gstalsadeviceprobe.c: (gst_alsa_get_device_list),
|
* ext/alsa/gstalsadeviceprobe.c: (gst_alsa_get_device_list),
|
||||||
|
|
|
@ -21,6 +21,12 @@ $(CHECK_REGISTRY):
|
||||||
|
|
||||||
TESTS = $(check_PROGRAMS)
|
TESTS = $(check_PROGRAMS)
|
||||||
|
|
||||||
|
if USE_ALSA
|
||||||
|
check_alsa = elements/alsa
|
||||||
|
else
|
||||||
|
check_alsa =
|
||||||
|
endif
|
||||||
|
|
||||||
if USE_VORBIS
|
if USE_VORBIS
|
||||||
check_vorbis = elements/vorbisdec pipelines/vorbisenc
|
check_vorbis = elements/vorbisdec pipelines/vorbisenc
|
||||||
else
|
else
|
||||||
|
@ -33,7 +39,9 @@ else
|
||||||
check_theora =
|
check_theora =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
check_PROGRAMS = $(check_vorbis) \
|
check_PROGRAMS = \
|
||||||
|
$(check_alsa) \
|
||||||
|
$(check_vorbis) \
|
||||||
$(check_theora) \
|
$(check_theora) \
|
||||||
elements/audioconvert \
|
elements/audioconvert \
|
||||||
elements/audioresample \
|
elements/audioresample \
|
||||||
|
@ -52,6 +60,7 @@ check_PROGRAMS = $(check_vorbis) \
|
||||||
# elements/adder
|
# elements/adder
|
||||||
|
|
||||||
VALGRIND_TO_FIX = \
|
VALGRIND_TO_FIX = \
|
||||||
|
elements/alsa \
|
||||||
elements/audioresample \
|
elements/audioresample \
|
||||||
generic/states \
|
generic/states \
|
||||||
libs/cddabasesrc \
|
libs/cddabasesrc \
|
||||||
|
@ -77,6 +86,14 @@ libs_cddabasesrc_CFLAGS = \
|
||||||
-I$(top_srcdir)/gst-libs \
|
-I$(top_srcdir)/gst-libs \
|
||||||
$(CFLAGS) $(AM_CFLAGS)
|
$(CFLAGS) $(AM_CFLAGS)
|
||||||
|
|
||||||
|
elements_alsa_LDADD = \
|
||||||
|
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la \
|
||||||
|
$(LDADD)
|
||||||
|
|
||||||
|
elements_alsa_CFLAGS = \
|
||||||
|
-I$(top_srcdir)/gst-libs \
|
||||||
|
$(CFLAGS) $(AM_CFLAGS)
|
||||||
|
|
||||||
elements_audioconvert_LDADD = \
|
elements_audioconvert_LDADD = \
|
||||||
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
|
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
|
||||||
$(LDADD)
|
$(LDADD)
|
||||||
|
|
94
tests/check/elements/alsa.c
Normal file
94
tests/check/elements/alsa.c
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
/* GStreamer
|
||||||
|
*
|
||||||
|
* unit test for alsa elements
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <gst/check/gstcheck.h>
|
||||||
|
#include <gst/interfaces/propertyprobe.h>
|
||||||
|
|
||||||
|
/* just a simple test that runs device probing on
|
||||||
|
* an alsasrc, alsasink and alsamixer instance */
|
||||||
|
|
||||||
|
GST_START_TEST (test_device_property_probe)
|
||||||
|
{
|
||||||
|
const gchar *elements[] = { "alsasink", "alsasrc", "alsamixer" };
|
||||||
|
gint n;
|
||||||
|
|
||||||
|
for (n = 0; n < G_N_ELEMENTS (elements); ++n) {
|
||||||
|
GstPropertyProbe *probe;
|
||||||
|
GValueArray *arr;
|
||||||
|
GstElement *element;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
element = gst_element_factory_make (elements[n], elements[n]);
|
||||||
|
fail_unless (element != NULL);
|
||||||
|
|
||||||
|
probe = GST_PROPERTY_PROBE (element);
|
||||||
|
fail_unless (probe != NULL);
|
||||||
|
|
||||||
|
arr = gst_property_probe_probe_and_get_values_name (probe, "device");
|
||||||
|
|
||||||
|
for (i = 0; arr != NULL && i < arr->n_values; ++i) {
|
||||||
|
GValue *val;
|
||||||
|
|
||||||
|
val = g_value_array_get_nth (arr, i);
|
||||||
|
fail_unless (val != NULL);
|
||||||
|
fail_unless (G_VALUE_HOLDS_STRING (val));
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (element, "device[%d] = %s", i, g_value_get_string (val));
|
||||||
|
}
|
||||||
|
g_value_array_free (arr);
|
||||||
|
|
||||||
|
gst_object_unref (element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
|
Suite *
|
||||||
|
alsa_suite (void)
|
||||||
|
{
|
||||||
|
Suite *s = suite_create ("alsa");
|
||||||
|
TCase *tc_chain = tcase_create ("general");
|
||||||
|
|
||||||
|
suite_add_tcase (s, tc_chain);
|
||||||
|
tcase_add_test (tc_chain, test_device_property_probe);
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
int nf;
|
||||||
|
|
||||||
|
Suite *s = alsa_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;
|
||||||
|
}
|
Loading…
Reference in a new issue