tests: add libscpp unit test to make sure g++ likes our library headers

This commit is contained in:
Tim-Philipp Müller 2011-03-12 17:51:41 +00:00
parent 40eaac6191
commit fae2e1bc2d
4 changed files with 165 additions and 9 deletions

View file

@ -135,18 +135,20 @@ dnl *** checks for programs ***
dnl find a compiler dnl find a compiler
AC_PROG_CC AC_PROG_CC
AC_PROG_CC_STDC AC_PROG_CC_STDC
AC_PROG_CXX
dnl determine if c++ is available on this system
AC_CHECK_PROG(HAVE_CXX, $CXX, yes, no)
dnl determine c++ preprocessor
dnl FIXME: do we need this ?
AC_PROG_CXXCPP
dnl check if the compiler supports '-c' and '-o' options dnl check if the compiler supports '-c' and '-o' options
AM_PROG_CC_C_O AM_PROG_CC_C_O
dnl determine if c++ is available on this system
AC_PROG_CXX
dnl CXX may be set to some default even if no c++ compiler is available
dnl (thanks autotools!), so just try to compile some c++ code to make sure
AC_LANG_PUSH([C++])
AC_TRY_COMPILE([ class Foo { int bar; };], , working_cxx=yes, working_cxx=no)
AC_LANG_POP([C++])
AC_MSG_NOTICE([working c++ compiler found: $working_cxx])
AM_CONDITIONAL(HAVE_CXX, test "x$working_cxx" = "xyes")
AC_PATH_PROG(VALGRIND_PATH, valgrind, no) AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno") AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")

View file

@ -99,6 +99,12 @@ else
check_orc = check_orc =
endif endif
if HAVE_CXX
cxx_checks = libs/gstlibscpp
else
cxx_checks =
endif
check_PROGRAMS = \ check_PROGRAMS = \
$(check_alsa) \ $(check_alsa) \
$(check_gnomevfs) \ $(check_gnomevfs) \
@ -144,6 +150,7 @@ check_PROGRAMS = \
libs/rtsp \ libs/rtsp \
libs/tag \ libs/tag \
libs/video \ libs/video \
$(cxx_checks) \
$(check_orc) \ $(check_orc) \
pipelines/simple-launch-lines \ pipelines/simple-launch-lines \
pipelines/streamheader \ pipelines/streamheader \
@ -170,7 +177,12 @@ noinst_HEADERS = \
# libs/struct_sparc.h \ # libs/struct_sparc.h \
# libs/struct_x86_64.h # libs/struct_x86_64.h
AM_CFLAGS = $(GST_CFLAGS) $(GST_CHECK_CFLAGS) \ AM_CFLAGS = -I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
$(GST_CFLAGS) $(GST_CHECK_CFLAGS) \
-DGST_TEST_FILES_PATH="\"$(TEST_FILES_DIRECTORY)\"" \
-UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS
AM_CXXFLAGS = -I$(top_srcdir)/gst-libs -I$(top_builddir)/gst-libs \
$(GST_CXXFLAGS) $(GST_CHECK_CFLAGS) \
-DGST_TEST_FILES_PATH="\"$(TEST_FILES_DIRECTORY)\"" \ -DGST_TEST_FILES_PATH="\"$(TEST_FILES_DIRECTORY)\"" \
-UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS -UG_DISABLE_ASSERT -UG_DISABLE_CAST_CHECKS
LDADD = $(GST_LIBS) $(GST_CHECK_LIBS) LDADD = $(GST_LIBS) $(GST_CHECK_LIBS)
@ -295,6 +307,8 @@ libs_profile_CFLAGS = \
libs_profile_LDADD = \ libs_profile_LDADD = \
$(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la $(LDADD) $(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la $(LDADD)
libs_gstlibscpp_SOURCES = libs/gstlibscpp.cc
elements_appsink_CFLAGS = \ elements_appsink_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) \
$(AM_CFLAGS) $(AM_CFLAGS)

View file

@ -2,6 +2,7 @@
audio audio
cddabasesrc cddabasesrc
fft fft
gstlibscpp
mixer mixer
navigation navigation
netbuffer netbuffer

View file

@ -0,0 +1,139 @@
/* GStreamer
* Copyright (C) 2011 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.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <gst/gst.h>
#include <gst/check/gstcheck.h>
#include <gst/app/gstappbuffer.h>
#include <gst/app/gstapp-marshal.h>
#include <gst/app/gstappsink.h>
#include <gst/app/gstappsrc.h>
#include <gst/audio/audio-enumtypes.h>
#include <gst/audio/audio.h>
#include <gst/audio/gstaudioclock.h>
#include <gst/audio/gstaudiofilter.h>
#include <gst/audio/gstaudiosink.h>
#include <gst/audio/gstaudiosrc.h>
#include <gst/audio/gstbaseaudiosink.h>
#include <gst/audio/gstbaseaudiosrc.h>
#include <gst/audio/gstringbuffer.h>
#include <gst/audio/mixerutils.h>
#include <gst/audio/multichannel.h>
#include <gst/cdda/gstcddabasesrc.h>
#include <gst/fft/gstfftf32.h>
#include <gst/fft/gstfftf64.h>
#include <gst/fft/gstfft.h>
#include <gst/fft/gstffts16.h>
#include <gst/fft/gstffts32.h>
#include <gst/floatcast/floatcast.h>
#include <gst/interfaces/colorbalancechannel.h>
#include <gst/interfaces/colorbalance.h>
#include <gst/interfaces/interfaces-enumtypes.h>
#include <gst/interfaces/interfaces-marshal.h>
#include <gst/interfaces/mixer.h>
#include <gst/interfaces/mixeroptions.h>
#include <gst/interfaces/mixertrack.h>
#include <gst/interfaces/navigation.h>
#include <gst/interfaces/propertyprobe.h>
#include <gst/interfaces/streamvolume.h>
#include <gst/interfaces/tunerchannel.h>
#include <gst/interfaces/tuner.h>
#include <gst/interfaces/tunernorm.h>
#include <gst/interfaces/videoorientation.h>
#include <gst/interfaces/xoverlay.h>
#include <gst/netbuffer/gstnetbuffer.h>
#include <gst/pbutils/codec-utils.h>
#include <gst/pbutils/descriptions.h>
#include <gst/pbutils/encoding-profile.h>
#include <gst/pbutils/encoding-target.h>
#include <gst/pbutils/gstdiscoverer.h>
#include <gst/pbutils/gstpluginsbaseversion.h>
#include <gst/pbutils/install-plugins.h>
#include <gst/pbutils/missing-plugins.h>
#include <gst/pbutils/pbutils-enumtypes.h>
#include <gst/pbutils/pbutils.h>
#include <gst/pbutils/pbutils-marshal.h>
#include <gst/riff/riff-ids.h>
#include <gst/riff/riff-media.h>
#include <gst/riff/riff-read.h>
#include <gst/rtp/gstbasertpaudiopayload.h>
#include <gst/rtp/gstbasertpdepayload.h>
#include <gst/rtp/gstbasertppayload.h>
#include <gst/rtp/gstrtcpbuffer.h>
#include <gst/rtp/gstrtpbuffer.h>
#include <gst/rtp/gstrtppayloads.h>
#include <gst/rtsp/gstrtspbase64.h>
#include <gst/rtsp/gstrtspconnection.h>
#include <gst/rtsp/gstrtspdefs.h>
#include <gst/rtsp/gstrtsp-enumtypes.h>
#include <gst/rtsp/gstrtspextension.h>
#include <gst/rtsp/gstrtsp.h>
#include <gst/rtsp/gstrtsp-marshal.h>
#include <gst/rtsp/gstrtspmessage.h>
#include <gst/rtsp/gstrtsprange.h>
#include <gst/rtsp/gstrtsptransport.h>
#include <gst/rtsp/gstrtspurl.h>
#include <gst/sdp/gstsdp.h>
#include <gst/sdp/gstsdpmessage.h>
#include <gst/tag/gsttagdemux.h>
#include <gst/tag/tag.h>
#include <gst/video/gstvideofilter.h>
#include <gst/video/gstvideosink.h>
#include <gst/video/video-enumtypes.h>
#include <gst/video/video.h>
/* we mostly just want to make sure that our library headers don't
* contain anything a C++ compiler might not like */
GST_START_TEST (test_nothing)
{
gst_init (NULL, NULL);
}
GST_END_TEST;
static Suite *
libscpp_suite (void)
{
Suite *s = suite_create ("GstLibsCpp");
TCase *tc_chain = tcase_create ("C++ libs header tests");
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_nothing);
return s;
}
GST_CHECK_MAIN (libscpp);