From d7f4c306cd939b16c93b6995fdd8688d16f7da64 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sun, 5 May 2002 16:49:45 +0000 Subject: [PATCH] Fix the tests so that builds that are not --enable-plugin-builddir can register the plugins from the uninstalled gstr... Original commit message from CVS: Fix the tests so that builds that are not --enable-plugin-builddir can register the plugins from the uninstalled gstreamer directory. There is some small amount of voodoo here. Also, add gst-inspect-check to gstreamer/testsuite, where it probably belongs --- tests/old/testsuite/Makefile.am | 7 ++- tests/old/testsuite/caps/Makefile.am | 3 + tests/old/testsuite/clock/Makefile.am | 3 + tests/old/testsuite/elements/Makefile.am | 3 + tests/old/testsuite/gst-inspect-check | 73 ++++++++++++++++++++++++ tests/old/testsuite/plugin/Makefile.am | 3 + testsuite/Makefile.am | 7 ++- testsuite/caps/Makefile.am | 3 + testsuite/clock/Makefile.am | 3 + testsuite/elements/Makefile.am | 3 + testsuite/gst-inspect-check | 73 ++++++++++++++++++++++++ testsuite/plugin/Makefile.am | 3 + 12 files changed, 180 insertions(+), 4 deletions(-) create mode 100755 tests/old/testsuite/gst-inspect-check create mode 100755 testsuite/gst-inspect-check diff --git a/tests/old/testsuite/Makefile.am b/tests/old/testsuite/Makefile.am index e30ac2432a..76d666fc20 100644 --- a/tests/old/testsuite/Makefile.am +++ b/tests/old/testsuite/Makefile.am @@ -1,9 +1,12 @@ # FIXME : refcounting threads bytestream cleanup -SUBDIRS = caps plugin elements clock ## dynparams +SUBDIRS = . caps plugin elements clock ## dynparams + +GST_PLUGIN_PATH = $(shell cd $(top_builddir) && pwd) +TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=`pwd`/test-registry.xml testprogs = test_gst_init -TESTS = $(testprogs) +TESTS = $(top_builddir)/tools/gst-register $(testprogs) gst-inspect-check check_PROGRAMS = $(testprogs) diff --git a/tests/old/testsuite/caps/Makefile.am b/tests/old/testsuite/caps/Makefile.am index 887d141883..fcb4db64d8 100644 --- a/tests/old/testsuite/caps/Makefile.am +++ b/tests/old/testsuite/caps/Makefile.am @@ -1,3 +1,6 @@ +GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd) +TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=$(GST_PLUGIN_PATH)/testsuite/test-registry.xml + testprogs = intersection compatibility normalisation TESTS = $(testprogs) diff --git a/tests/old/testsuite/clock/Makefile.am b/tests/old/testsuite/clock/Makefile.am index 1d5ded210b..05d6f5e03b 100644 --- a/tests/old/testsuite/clock/Makefile.am +++ b/tests/old/testsuite/clock/Makefile.am @@ -1,3 +1,6 @@ +GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd) +TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=$(GST_PLUGIN_PATH)/testsuite/test-registry.xml + testprogs = clock1 TESTS = $(testprogs) diff --git a/tests/old/testsuite/elements/Makefile.am b/tests/old/testsuite/elements/Makefile.am index 61fabcdb57..983a56c22d 100644 --- a/tests/old/testsuite/elements/Makefile.am +++ b/tests/old/testsuite/elements/Makefile.am @@ -1,3 +1,6 @@ +GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd) +TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=$(GST_PLUGIN_PATH)/testsuite/test-registry.xml + testprogs = tee fake name TESTS = $(testprogs) diff --git a/tests/old/testsuite/gst-inspect-check b/tests/old/testsuite/gst-inspect-check new file mode 100755 index 0000000000..8f16ee7775 --- /dev/null +++ b/tests/old/testsuite/gst-inspect-check @@ -0,0 +1,73 @@ +#!/usr/bin/perl -w + +# checks all built plugins by running gst-inspect on each element +# and checking for warnings on stderr + +### packages + +use File::Basename; + +my $num_warnings = 0; + +sub check_all_elements +{ + #send stderr to /dev/null + my $command = "gst-inspect 2>/dev/null"; + my @lines = `$command`; + + while ($_ = shift(@lines)){ + my @matches = m/^\w+\s+element:\s+(\w+):/g; + if(@matches){ + check_element($matches[0]); + } + } + if ($num_warnings > 0){ + print("there are $num_warnings warnings to be fixed\n"); + return -1; + } + return 0; +} + +sub check_element($) +{ + my ($element) = @_; + print "running inspect on $element\n"; + + # capture stderr, send stdout to /dev/null + my $command = "gst-inspect $element 2>&1 1>/dev/null"; + + my @lines = `$command`; + + while ($_ = shift(@lines)){ + # ignore INFO lines, they are ok + if (! /INFO/){ + print $_; + + # do this to ignore empty lines + if (length > 1){ + $num_warnings++; + } + } + } + system("gst-inspect $element 2>/dev/null 1>/dev/null"); + if ($? != 0){ + my $exit_value = $? >> 8; + my $signal_num = $? & 127; + my $dumped_core = $? & 128; + if ($exit_value){ + print("error value on exit: $exit_value\n"); + } + if ($signal_num){ + print("signal caused exit: $signal_num\n"); + } + if ($dumped_core){ + print("dumped core: $dumped_core\n"); + } + $num_warnings++ + } +} + +### main + +exit check_all_elements (); + diff --git a/tests/old/testsuite/plugin/Makefile.am b/tests/old/testsuite/plugin/Makefile.am index 3f4b63c253..cd98dd776e 100644 --- a/tests/old/testsuite/plugin/Makefile.am +++ b/tests/old/testsuite/plugin/Makefile.am @@ -1,3 +1,6 @@ +GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd) +TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=$(GST_PLUGIN_PATH)/testsuite/test-registry.xml + # FIXME : tests need fixing testprogs = static # dynamic linked loading registry static2 # filterdir = $(libdir)/gst diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index e30ac2432a..76d666fc20 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -1,9 +1,12 @@ # FIXME : refcounting threads bytestream cleanup -SUBDIRS = caps plugin elements clock ## dynparams +SUBDIRS = . caps plugin elements clock ## dynparams + +GST_PLUGIN_PATH = $(shell cd $(top_builddir) && pwd) +TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=`pwd`/test-registry.xml testprogs = test_gst_init -TESTS = $(testprogs) +TESTS = $(top_builddir)/tools/gst-register $(testprogs) gst-inspect-check check_PROGRAMS = $(testprogs) diff --git a/testsuite/caps/Makefile.am b/testsuite/caps/Makefile.am index 887d141883..fcb4db64d8 100644 --- a/testsuite/caps/Makefile.am +++ b/testsuite/caps/Makefile.am @@ -1,3 +1,6 @@ +GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd) +TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=$(GST_PLUGIN_PATH)/testsuite/test-registry.xml + testprogs = intersection compatibility normalisation TESTS = $(testprogs) diff --git a/testsuite/clock/Makefile.am b/testsuite/clock/Makefile.am index 1d5ded210b..05d6f5e03b 100644 --- a/testsuite/clock/Makefile.am +++ b/testsuite/clock/Makefile.am @@ -1,3 +1,6 @@ +GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd) +TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=$(GST_PLUGIN_PATH)/testsuite/test-registry.xml + testprogs = clock1 TESTS = $(testprogs) diff --git a/testsuite/elements/Makefile.am b/testsuite/elements/Makefile.am index 61fabcdb57..983a56c22d 100644 --- a/testsuite/elements/Makefile.am +++ b/testsuite/elements/Makefile.am @@ -1,3 +1,6 @@ +GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd) +TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=$(GST_PLUGIN_PATH)/testsuite/test-registry.xml + testprogs = tee fake name TESTS = $(testprogs) diff --git a/testsuite/gst-inspect-check b/testsuite/gst-inspect-check new file mode 100755 index 0000000000..8f16ee7775 --- /dev/null +++ b/testsuite/gst-inspect-check @@ -0,0 +1,73 @@ +#!/usr/bin/perl -w + +# checks all built plugins by running gst-inspect on each element +# and checking for warnings on stderr + +### packages + +use File::Basename; + +my $num_warnings = 0; + +sub check_all_elements +{ + #send stderr to /dev/null + my $command = "gst-inspect 2>/dev/null"; + my @lines = `$command`; + + while ($_ = shift(@lines)){ + my @matches = m/^\w+\s+element:\s+(\w+):/g; + if(@matches){ + check_element($matches[0]); + } + } + if ($num_warnings > 0){ + print("there are $num_warnings warnings to be fixed\n"); + return -1; + } + return 0; +} + +sub check_element($) +{ + my ($element) = @_; + print "running inspect on $element\n"; + + # capture stderr, send stdout to /dev/null + my $command = "gst-inspect $element 2>&1 1>/dev/null"; + + my @lines = `$command`; + + while ($_ = shift(@lines)){ + # ignore INFO lines, they are ok + if (! /INFO/){ + print $_; + + # do this to ignore empty lines + if (length > 1){ + $num_warnings++; + } + } + } + system("gst-inspect $element 2>/dev/null 1>/dev/null"); + if ($? != 0){ + my $exit_value = $? >> 8; + my $signal_num = $? & 127; + my $dumped_core = $? & 128; + if ($exit_value){ + print("error value on exit: $exit_value\n"); + } + if ($signal_num){ + print("signal caused exit: $signal_num\n"); + } + if ($dumped_core){ + print("dumped core: $dumped_core\n"); + } + $num_warnings++ + } +} + +### main + +exit check_all_elements (); + diff --git a/testsuite/plugin/Makefile.am b/testsuite/plugin/Makefile.am index 3f4b63c253..cd98dd776e 100644 --- a/testsuite/plugin/Makefile.am +++ b/testsuite/plugin/Makefile.am @@ -1,3 +1,6 @@ +GST_PLUGIN_PATH=$(shell cd $(top_builddir) && pwd) +TESTS_ENVIRONMENT = GST_PLUGIN_PATH=$(GST_PLUGIN_PATH) GST_REGISTRY=$(GST_PLUGIN_PATH)/testsuite/test-registry.xml + # FIXME : tests need fixing testprogs = static # dynamic linked loading registry static2 # filterdir = $(libdir)/gst