check/: added pipeline tester for (http://bugzilla.gnome.org/show_bug.cgi?id=315126)
authorStefan Kost <ensonic@users.sourceforge.net>
Tue, 6 Sep 2005 12:37:05 +0000 (12:37 +0000)
committerStefan Kost <ensonic@users.sourceforge.net>
Tue, 6 Sep 2005 12:37:05 +0000 (12:37 +0000)
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/.cvsignore:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (GST_START_TEST), (simple_launch_lines_suite),
(main):
added pipeline tester for (http://bugzilla.gnome.org/show_bug.cgi?id=315126)

ChangeLog
check/Makefile.am
check/pipelines/.gitignore [new file with mode: 0644]
check/pipelines/simple_launch_lines.c [new file with mode: 0644]
common
tests/check/Makefile.am
tests/check/pipelines/.gitignore [new file with mode: 0644]
tests/check/pipelines/simple-launch-lines.c [new file with mode: 0644]

index 7e31451..07370ee 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-09-06  Stefan Kost  <ensonic@users.sf.net>
+
+       * check/Makefile.am:
+       * check/pipelines/.cvsignore:
+       * check/pipelines/simple_launch_lines.c: (setup_pipeline),
+       (run_pipeline), (GST_START_TEST), (simple_launch_lines_suite),
+       (main):
+          added pipeline tester for (http://bugzilla.gnome.org/show_bug.cgi?id=315126)
+
 2005-09-05  Michael Smith <msmith@fluendo.com>
 
        * ext/vorbis/vorbisenc.c: (gst_vorbisenc_class_init):
@@ -44,7 +53,7 @@
        Resync if the buffer timestamps drift more than a 10th 
        of a second.
 
-2005-08-31  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-31  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_set_property),
        (gst_v4lsrc_get_property):
          Added rtp timestamp -> gst timestamp conversion.
          Fixed several problems with queue.
 
-2005-08-09  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-09  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst-libs/gst/audio/gstaudioclock.h:
        * gst-libs/gst/audio/gstaudiofilter.h:
          Add padding (you will need to rebuild gst-plugins-base,
          gst-plugins and all applications afterwards!)
 
-2005-08-09  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-09  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst-libs/gst/riff/riff-read.c: (gst_riff_read_chunk),
        (gst_riff_parse_chunk):
        New API functions. The device should be opened before acquiring
        and closed after releasing.
 
-2005-08-08  Tim-Philipp Müller  <tim at centricular dot net>
+2005-08-08  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst-libs/gst/interfaces/mixer.h:
          Reset padding to GST_PADDING.
        * ext/alsa/gstalsasink.c (alsasink_sink_factory): Advertise our
        support of both endiannesses.
 
-2005-07-28  Tim-Philipp Müller  <tim at centricular dot net>
+2005-07-28  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * ext/vorbis/vorbisdec.c: (vorbis_dec_src_query):
          Fix confusing debug message (s/event/query/)
 
-2005-07-28  Tim-Philipp Müller  <tim at centricular dot net>
+2005-07-28  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/videotestsrc/videotestsrc.h:
          Use "_stdint.h" instead of <stdint.h>
 
 2005-02-22  Luca Ognibene  <luogni@tin.it>
 
-       Reviewed by: Tim-Philipp Müller  <tim at centricular dot net>
+       Reviewed by: Tim-Philipp M??ller  <tim at centricular dot net>
 
        * ext/gdk_pixbuf/pixbufscale.c: (gst_pixbufscale_link):
          Don't leak caps string (fixes #168134)
        (gst_jpegenc_change_state):
          Don't leak line buffers and context struct (fixes #168133).
 
-2005-02-21  Tim-Philipp Müller  <tim at centricular dot net>
+2005-02-21  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * configure.ac:
        * ext/dirac/gstdiracdec.cc:
        * gst/dvdlpcmdec/gstdvdlpcmdec.c: (gst_dvdlpcmdec_chain):
           Make sure we only write to writable buffers
 
-2005-02-20  Tim-Philipp Müller  <tim at centricular dot net>
+2005-02-20  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst-libs/gst/riff/riff-media.c:
        (gst_riff_create_audio_caps_with_data):
 
 2005-02-19  Martin Holters  <martin.holters@gmx.de>
 
-       Reviewed by: Tim-Philipp Müller  <tim at centricular dot net>
+       Reviewed by: Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/audioconvert/bufferframesconvert.c:
        (buffer_frames_convert_link):
        (gst_visual_change_state):
          Support libvisual 0.2.0.
 
-2005-02-18  Tim-Philipp Müller  <tim at centricular dot net>
+2005-02-18  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * ext/jpeg/gstjpegdec.c: (gst_jpegdec_chain):
        * ext/jpeg/gstjpegenc.c: (gst_jpegenc_resync), (gst_jpegenc_chain):
          Use same rowstrides for I420 as used everywhere else.
 
-2005-02-17  Tim-Philipp Müller  <tim at centricular dot net>
+2005-02-17  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/avi/gstavidemux.c: (gst_avi_demux_invert):
          Declare variables at beginning of block and make gcc-2.95 happy
 
 2005-02-17  Luca Ognibene  <luogni at tin dot it>
 
-       Reviewed by: Tim-Philipp Müller  <tim at centricular dot net>
+       Reviewed by: Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/tcp/gsttcpserversink.c: (gst_tcpserversink_init_send):
          Don't pass uninitialised values to setsockopt(). (fixes #167704)
          events into the stream thread from whichever thread
          sends them.
 
-2005-02-15  Tim-Philipp Müller  <tim at centricular dot net>
+2005-02-15  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/speed/demo-mp3.c: (time_tick_cb), (main):
          Display current position and track length; misc. clean-ups.
          channel. Previously used different signs made the signals cancel
          each other out and appear like silence. (fixes #167269)
 
-2005-02-12  Tim-Philipp Müller  <tim at centricular dot net>
+2005-02-12  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/ffmpegcolorspace/avcodec.h:
        * gst/ffmpegcolorspace/gstffmpegcodecmap.c:
        (gst_xvimagesink_buffer_alloc), (gst_xvimagesink_set_xwindow_id),
        (gst_xvimagesink_expose): Check for xcontext before trying to link.
 
-2005-02-12  Tim-Philipp Müller  <tim at centricular dot net>
+2005-02-12  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_open):
          Don't send "Hey! You gave me a NULL pointer you naughty person" as
        * gst/librfb/rfbdecoder.h:
        * gst/librfb/rfbutil.h:
 
-2005-02-10  Tim-Philipp Müller  <tim at centricular dot net>
+2005-02-10  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/speed/Makefile.am:
        * gst/speed/demo-mp3.c: (main):
           Don't clobber the stack constructing the channels array.
          Make the element chain-based. DTS tracks can now be played.
          
-2005-02-09  Tim-Philipp Müller  <tim at centricular dot net>
+2005-02-09  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst-libs/gst/audio/multichannel.h:
        * gst-libs/gst/gconf/gconf.h:
        * gst/law/mulaw-encode.c: (mulawenc_link):
          Fix caps memleaks (#166600).
 
-2005-02-08  Tim-Philipp Müller  <tim at centricular dot net>
+2005-02-08  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * ext/tarkin/mem.h:
        * ext/tarkin/wavelet.h:
        * gst/subparse/gstsubparse.c:
          Fix OSX buildbot.
 
-2005-01-31  Tim-Philipp Müller  <tim at centricular dot net>
+2005-01-31  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * ext/theora/theoraenc.c: (theora_buffer_from_packet),
        (theora_enc_chain), (theora_enc_change_state):
          Set granulepos and timestamp correctly for streams not
          starting at 0, taking into account the initial delay.
 
-2005-01-31  Tim-Philipp Müller  <tim at centricular dot net>
+2005-01-31  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/mpegstream/gstdvddemux.c:
          Add audio/x-dts to audio pad template caps
        * ext/cairo/gsttextoverlay.c: include  string.h and strings.h to fix
        build failure on amd64
 
-2005-01-26  Tim-Philipp Müller  <tim at centricular dot net>
+2005-01-26  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * ext/mad/gstid3tag.c: (mad_id3_parse_latin1_string),
        (mad_id3_parse_comment_frame), (gst_mad_id3_to_tag_list):
          Allow for 0-sized buffers. Fixes length query problems in
          starwars.mkv from the testsuite.
 
-2005-01-19  Tim-Philipp Müller  <tim at centricular dot net>
+2005-01-19  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/videobox/gstvideobox.c: (gst_video_box_copy_plane_i420),
        (gst_video_box_i420), (gst_video_box_chain):
          Fix off-by-one bug. Fixes warnings during playback of sincity.mp4
          when fixating to six channels in Totem.
 
-2005-01-17  Tim-Philipp Müller  <tim at centricular dot net>
+2005-01-17  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * ext/dvdread/dvdreadsrc.c: (get_next_cell_for):
          Fix compile warnings on Solaris 10 buildbot
 
-2005-01-17  Tim-Philipp Müller  <tim at centricular dot net>
+2005-01-17  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * ext/dvdread/dvdreadsrc.c: (_read):
          Don't read beyond the last cell in a chapter (fixes 
          invalid memory access)
 
-2005-01-17  Tim-Philipp Müller  <tim at centricular dot net>
+2005-01-17  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * ext/dvdread/stream_labels.c:
        (dvdreadsrc_get_audio_stream_labels):
 2005-01-14  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
        * sys/v4l/gstv4lelement.c: (gst_v4l_iface_supported):
-         Revert Johan´s 1.35->1.36 since it breaks compat.
+         Revert Johan??s 1.35->1.36 since it breaks compat.
 
 2005-01-14  Stephane LOEUILLET  <stephane.loeuillet@tiscali.fr>
 
        * gst/playback/gstplaybasebin.h:
          Multiple .sub files is just a stupid idea... Fix some threading
          mistakes. Interestingly, external .sub files cause playbin to
-         hang, I don't know why... Parsing fixes contributed by François
+         hang, I don't know why... Parsing fixes contributed by Fran??ois
          Kooman <fkooman@tuxed.net>.
 
 2005-01-09  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
 2005-01-05  Thomas Vander Stichele  <thomas at apestaart dot org>
 
-       patch by: Tim-Philipp Müller  <t.i.m@zen.co.uk>
+       patch by: Tim-Philipp M??ller  <t.i.m@zen.co.uk>
 
        * gst/playback/gstplaybasebin.c:
         Fix for #162924 - free caps after use, not before
        Fix code to not use GCC extensions (and c99 extensions that
        Forte does not like.)
 
-2004-12-19  Tim-Philipp Müller  <t.i.m@zen.co.uk>
+2004-12-19  Tim-Philipp M??ller  <t.i.m@zen.co.uk>
 
        Reviewed by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
 
 2004-11-23  Thomas Vander Stichele  <thomas at apestaart dot org>
 
-       patch by: Tim-Philipp Müller <t.i.m@zen.co.uk>
+       patch by: Tim-Philipp M??ller <t.i.m@zen.co.uk>
 
        * ext/dvdread/dvdreadsrc.c:
          Fixes invalid reads (#158462)
          wouldn't do anything because we're not negotiated yet, leading
          to an infinite loop. Showed in e.g. Rhythmbox. Fixes #158006.
 
-2004-11-11  Tim-Philipp Müller  <t.i.m@zen.co.uk>
+2004-11-11  Tim-Philipp M??ller  <t.i.m@zen.co.uk>
 
        reviewed by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
        * ext/mad/gstid3tag.c: (gst_id3_tag_do_typefind):
          Hide unused glory.
 
-2004-11-06  Tim-Philipp Müller  <t.i.m@zen.co.uk>
+2004-11-06  Tim-Philipp M??ller  <t.i.m@zen.co.uk>
 
        reviewed by: Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
        * ext/vorbis/vorbisenc.c: (raw_caps_factory):
          Fix weird caps (#157548).
 
-2004-11-06  Tim-Philipp Müller  <t.i.m@zen.co.uk>
+2004-11-06  Tim-Philipp M??ller  <t.i.m@zen.co.uk>
 
        Reviewed by: Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
        * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_src_link), (gst_v4lsrc_getcaps):
        Fix for webcams that support only specific width or height
 
-2004-10-09  Tim-Philipp Müller  <t.i.m@zen.co.uk>
+2004-10-09  Tim-Philipp M??ller  <t.i.m@zen.co.uk>
 
        Reviewed by:  Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
        * gst/auparse/gstauparse.c: (gst_auparse_chain):
          Error out on invalid data (fixes #154807).
 
-2004-10-09  Tim-Philipp Müller  <t.i.m@zen.co.uk>
+2004-10-09  Tim-Philipp M??ller  <t.i.m@zen.co.uk>
 
        Reviewed by: Ronald S. Bultje  <rbultje@ronald.bitfreak.net>
 
        Add support for the new_media flag when sending DISCONT events
        Make the querying work when video pad is not linked
 
-2004-06-07  Tim-Philipp Müller  <t.i.m@zen.co.uk>
+2004-06-07  Tim-Philipp M??ller  <t.i.m@zen.co.uk>
 
        reviewed by Benjamin Otte  <otte@gnome.org>
 
          bogus timestamps and screwing sync.
        (fixes #143454)
 
-2004-06-07  Tim-Philipp Müller  <t.i.m@zen.co.uk>
+2004-06-07  Tim-Philipp M??ller  <t.i.m@zen.co.uk>
 
        reviewed by Benjamin Otte  <otte@gnome.org>
 
        * sys/oss/.cvsignore:
          add for oss_probe
 
-2004-04-03  Tim-Phillip Müller <t.i.m@zen.co.uk>
+2004-04-03  Tim-Phillip M??ller <t.i.m@zen.co.uk>
 
        reviewed by Benjamin Otte  <otte@gnome.org>
 
 
 2004-03-29  Thomas Vander Stichele  <thomas at apestaart dot org>
 
-       * po/LINGUAS: adding Azerbaijani (Mətin Əmirov)
+       * po/LINGUAS: adding Azerbaijani (M??tin ??mirov)
        * po/az.po:
 
 2004-03-28  Benjamin Otte  <otte@gnome.org>
 
        * configure.ac: GST_PACKAGE default: s/GStreamer/GStreamer Plugins/
 
-2004-03-20  Tim-Phillip Müller <t.i.m@zen.co.uk>
+2004-03-20  Tim-Phillip M??ller <t.i.m@zen.co.uk>
 
        reviewed by: Benjamin Otte  <otte@gnome.org>
 
index c0a58fa..b1703db 100644 (file)
@@ -33,6 +33,7 @@ check_PROGRAMS = \
        elements/audioconvert \
        elements/audioresample \
        elements/volume \
+        pipelines/simple_launch_lines \
        $(check_vorbis)
 
 # these tests don't even pass
diff --git a/check/pipelines/.gitignore b/check/pipelines/.gitignore
new file mode 100644 (file)
index 0000000..0305d7f
--- /dev/null
@@ -0,0 +1,2 @@
+.dirstamp
+simple_launch_lines
diff --git a/check/pipelines/simple_launch_lines.c b/check/pipelines/simple_launch_lines.c
new file mode 100644 (file)
index 0000000..9c05436
--- /dev/null
@@ -0,0 +1,124 @@
+/* GStreamer
+ * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
+ *
+ * simple_launch_lines.c: Unit test for simple pipelines
+ *
+ * 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 <gst/check/gstcheck.h>
+
+
+static GstElement *
+setup_pipeline (gchar * pipe_descr)
+{
+  GstElement *pipeline;
+
+  pipeline = gst_parse_launch (pipe_descr, NULL);
+  g_return_val_if_fail (GST_IS_PIPELINE (pipeline), NULL);
+  return pipeline;
+}
+
+/* 
+ * run_pipeline:
+ * @pipe: the pipeline to run
+ * @desc: the description for use in messages
+ * @events: is a mask of expected events
+ * @tevent: is the expected terminal event.
+ *
+ * the poll call will time out after half a second.
+ */
+static void
+run_pipeline (GstElement * pipe, gchar * descr,
+    GstMessageType events, GstMessageType tevent)
+{
+  GstBus *bus;
+  GstMessageType revent;
+
+  g_assert (pipe);
+  bus = gst_element_get_bus (pipe);
+  g_assert (bus);
+  if (gst_element_set_state (pipe,
+          GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) {
+    g_critical ("Couldn't set pipeline to PLAYING");
+    goto done;
+  }
+
+  while (1) {
+    revent = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 2);
+
+    /* always have to pop the message before getting back into poll */
+    if (revent != GST_MESSAGE_UNKNOWN)
+      gst_message_unref (gst_bus_pop (bus));
+
+    if (revent == tevent) {
+      break;
+    } else if (revent == GST_MESSAGE_UNKNOWN) {
+      g_critical ("Unexpected timeout in gst_bus_poll, looking for %d: %s",
+          tevent, descr);
+      break;
+    } else if (revent & events) {
+      continue;
+    }
+    g_critical ("Unexpected message received of type %d, looking for %d: %s",
+        revent, tevent, descr);
+  }
+
+done:
+  gst_element_set_state (pipe, GST_STATE_NULL);
+  gst_object_unref (pipe);
+}
+
+GST_START_TEST (test_element_negotiation)
+{
+  gchar *s;
+
+  /* see http://bugzilla.gnome.org/show_bug.cgi?id=315126 */
+  s = "fakesrc ! audio/x-raw-int,width=16,depth=16,rate=22050,channels=1 ! audioconvert ! audio/x-raw-int,width=16,depth=16,rate=22050,channels=1 ! fakesink";
+  run_pipeline (setup_pipeline (s), s,
+      GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
+      GST_MESSAGE_UNKNOWN);
+}
+GST_END_TEST Suite * simple_launch_lines_suite (void)
+{
+  Suite *s = suite_create ("Pipelines");
+  TCase *tc_chain = tcase_create ("linear");
+
+  /* time out after 20s, not the default 3 */
+  tcase_set_timeout (tc_chain, 20);
+
+  suite_add_tcase (s, tc_chain);
+  tcase_add_test (tc_chain, test_element_negotiation);
+  return s;
+}
+
+int
+main (int argc, char **argv)
+{
+  int nf;
+
+  Suite *s = simple_launch_lines_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;
+}
diff --git a/common b/common
index 9c13bc7..00cc4f5 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 9c13bc791b9ed7739526a1e60032f2b9be086d6d
+Subproject commit 00cc4f5af95a15be55b8c1b3eed09f4738412f91
index c0a58fa..b1703db 100644 (file)
@@ -33,6 +33,7 @@ check_PROGRAMS = \
        elements/audioconvert \
        elements/audioresample \
        elements/volume \
+        pipelines/simple_launch_lines \
        $(check_vorbis)
 
 # these tests don't even pass
diff --git a/tests/check/pipelines/.gitignore b/tests/check/pipelines/.gitignore
new file mode 100644 (file)
index 0000000..0305d7f
--- /dev/null
@@ -0,0 +1,2 @@
+.dirstamp
+simple_launch_lines
diff --git a/tests/check/pipelines/simple-launch-lines.c b/tests/check/pipelines/simple-launch-lines.c
new file mode 100644 (file)
index 0000000..9c05436
--- /dev/null
@@ -0,0 +1,124 @@
+/* GStreamer
+ * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
+ *
+ * simple_launch_lines.c: Unit test for simple pipelines
+ *
+ * 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 <gst/check/gstcheck.h>
+
+
+static GstElement *
+setup_pipeline (gchar * pipe_descr)
+{
+  GstElement *pipeline;
+
+  pipeline = gst_parse_launch (pipe_descr, NULL);
+  g_return_val_if_fail (GST_IS_PIPELINE (pipeline), NULL);
+  return pipeline;
+}
+
+/* 
+ * run_pipeline:
+ * @pipe: the pipeline to run
+ * @desc: the description for use in messages
+ * @events: is a mask of expected events
+ * @tevent: is the expected terminal event.
+ *
+ * the poll call will time out after half a second.
+ */
+static void
+run_pipeline (GstElement * pipe, gchar * descr,
+    GstMessageType events, GstMessageType tevent)
+{
+  GstBus *bus;
+  GstMessageType revent;
+
+  g_assert (pipe);
+  bus = gst_element_get_bus (pipe);
+  g_assert (bus);
+  if (gst_element_set_state (pipe,
+          GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) {
+    g_critical ("Couldn't set pipeline to PLAYING");
+    goto done;
+  }
+
+  while (1) {
+    revent = gst_bus_poll (bus, GST_MESSAGE_ANY, GST_SECOND / 2);
+
+    /* always have to pop the message before getting back into poll */
+    if (revent != GST_MESSAGE_UNKNOWN)
+      gst_message_unref (gst_bus_pop (bus));
+
+    if (revent == tevent) {
+      break;
+    } else if (revent == GST_MESSAGE_UNKNOWN) {
+      g_critical ("Unexpected timeout in gst_bus_poll, looking for %d: %s",
+          tevent, descr);
+      break;
+    } else if (revent & events) {
+      continue;
+    }
+    g_critical ("Unexpected message received of type %d, looking for %d: %s",
+        revent, tevent, descr);
+  }
+
+done:
+  gst_element_set_state (pipe, GST_STATE_NULL);
+  gst_object_unref (pipe);
+}
+
+GST_START_TEST (test_element_negotiation)
+{
+  gchar *s;
+
+  /* see http://bugzilla.gnome.org/show_bug.cgi?id=315126 */
+  s = "fakesrc ! audio/x-raw-int,width=16,depth=16,rate=22050,channels=1 ! audioconvert ! audio/x-raw-int,width=16,depth=16,rate=22050,channels=1 ! fakesink";
+  run_pipeline (setup_pipeline (s), s,
+      GST_MESSAGE_ANY & ~(GST_MESSAGE_ERROR | GST_MESSAGE_WARNING),
+      GST_MESSAGE_UNKNOWN);
+}
+GST_END_TEST Suite * simple_launch_lines_suite (void)
+{
+  Suite *s = suite_create ("Pipelines");
+  TCase *tc_chain = tcase_create ("linear");
+
+  /* time out after 20s, not the default 3 */
+  tcase_set_timeout (tc_chain, 20);
+
+  suite_add_tcase (s, tc_chain);
+  tcase_add_test (tc_chain, test_element_negotiation);
+  return s;
+}
+
+int
+main (int argc, char **argv)
+{
+  int nf;
+
+  Suite *s = simple_launch_lines_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;
+}