tests: include config.h and don't include unix headers

In many cases the unistd.h includes weren't actually needed.

Don't build tests that need it on windows with MSVC
(multifdsink, multisocketsink, pipelines/tcp).

Preparation for making tests work on Windows with MSVC.
This commit is contained in:
Tim-Philipp Müller 2018-01-16 18:14:59 +00:00
parent 0ffc2015aa
commit 3f184c3abc
36 changed files with 95 additions and 40 deletions

View file

@ -28,8 +28,6 @@
# include <valgrind/valgrind.h> # include <valgrind/valgrind.h>
#endif #endif
#include <unistd.h>
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/check/gstconsistencychecker.h> #include <gst/check/gstconsistencychecker.h>
#include <gst/base/gstbasesrc.h> #include <gst/base/gstbasesrc.h>

View file

@ -17,6 +17,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/app/gstappsink.h> #include <gst/app/gstappsink.h>

View file

@ -20,8 +20,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include <unistd.h> #include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/audio/audio.h> #include <gst/audio/audio.h>

View file

@ -20,8 +20,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include <unistd.h> #include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>

View file

@ -20,7 +20,9 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#include <unistd.h> #ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/audio/audio.h> #include <gst/audio/audio.h>

View file

@ -25,7 +25,6 @@
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/base/gstbaseparse.h> #include <gst/base/gstbaseparse.h>
#include <unistd.h>
static const gchar dummytext[] = static const gchar dummytext[] =
"Quick Brown Fox Jumps over a Lazy Frog Quick Brown " "Quick Brown Fox Jumps over a Lazy Frog Quick Brown "

View file

@ -17,6 +17,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>

View file

@ -17,6 +17,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <unistd.h> #include <unistd.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>

View file

@ -20,7 +20,9 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#include <unistd.h> #ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/check/gstharness.h> #include <gst/check/gstharness.h>

View file

@ -28,7 +28,6 @@
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/base/gstpushsrc.h> #include <gst/base/gstpushsrc.h>
#include <unistd.h>
#ifndef GST_DISABLE_REGISTRY #ifndef GST_DISABLE_REGISTRY

View file

@ -19,8 +19,11 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* FIXME: GValueArray is deprecated, but there is currently no viabla alternative /* FIXME: GValueArray is deprecated, but there is currently no viable alternatives
* See https://bugzilla.gnome.org/show_bug.cgi?id=667228 */ * See https://bugzilla.gnome.org/show_bug.cgi?id=667228 */
#define GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS

View file

@ -19,6 +19,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/video/video.h> #include <gst/video/video.h>

View file

@ -18,7 +18,9 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#include <unistd.h> #ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/video/video-overlay-composition.h> #include <gst/video/video-overlay-composition.h>

View file

@ -19,8 +19,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include <unistd.h> #include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>

View file

@ -29,8 +29,6 @@
# include <valgrind/valgrind.h> # include <valgrind/valgrind.h>
#endif #endif
#include <unistd.h>
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/check/gstharness.h> #include <gst/check/gstharness.h>

View file

@ -20,7 +20,9 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#include <unistd.h> #ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/base/gstbasetransform.h> #include <gst/base/gstbasetransform.h>
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>

View file

@ -19,8 +19,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include <unistd.h> #include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>

View file

@ -19,8 +19,10 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <unistd.h>
#include <glib.h> #include <glib.h>
#include <vorbis/codec.h> #include <vorbis/codec.h>

View file

@ -20,7 +20,9 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#include <unistd.h> #ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>

View file

@ -24,7 +24,6 @@
# include "config.h" # include "config.h"
#endif #endif
#include <unistd.h>
#include <gmodule.h> #include <gmodule.h>
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>

View file

@ -30,8 +30,6 @@
#include "config.h" #include "config.h"
#endif #endif
#include <unistd.h>
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/check/gstbufferstraw.h> #include <gst/check/gstbufferstraw.h>

View file

@ -20,7 +20,10 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/app/gstappsrc.h> #include <gst/app/gstappsrc.h>

View file

@ -37,8 +37,8 @@
#include <sys/stat.h> /* for chmod() */ #include <sys/stat.h> /* for chmod() */
#endif #endif
#ifdef HAVE_UNISTD_H #ifdef G_OS_UNIX
#include <unistd.h> /* for unlink() */ #include <unistd.h> /* for getpid() */
#endif #endif
static void static void
@ -613,7 +613,7 @@ test_pb_utils_install_plugins_do_callout (const gchar * const *details,
done: done:
unlink (path); g_unlink (path);
g_free (path); g_free (path);
#endif /* G_OS_UNIX */ #endif /* G_OS_UNIX */
} }

View file

@ -22,8 +22,6 @@
#include "config.h" #include "config.h"
#endif #endif
/* #include <fcntl.h> */
#include <unistd.h>
#include <glib.h> #include <glib.h>
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
@ -31,6 +29,10 @@
#include <gst/pbutils/encoding-profile.h> #include <gst/pbutils/encoding-profile.h>
#include <gst/pbutils/encoding-target.h> #include <gst/pbutils/encoding-target.h>
#ifdef G_OS_UNIX
#include <unistd.h> /* For R_OK etc. */
#endif
static inline gboolean static inline gboolean
gst_caps_is_equal_unref (GstCaps * caps1, GstCaps * caps2) gst_caps_is_equal_unref (GstCaps * caps1, GstCaps * caps2)
{ {
@ -679,9 +681,13 @@ profile_suite (void)
gchar *gst_dir; gchar *gst_dir;
/* cehck if we can create profiles */ /* cehck if we can create profiles */
#ifdef G_OS_UNIX
gst_dir = g_build_filename (g_get_user_data_dir (), "gstreamer-1.0", NULL); gst_dir = g_build_filename (g_get_user_data_dir (), "gstreamer-1.0", NULL);
can_write = (g_access (gst_dir, R_OK | W_OK | X_OK) == 0); can_write = (g_access (gst_dir, R_OK | W_OK | X_OK) == 0);
g_free (gst_dir); g_free (gst_dir);
#else
can_write = FALSE; /* FIXME: fix can_write test on Windows */
#endif
suite_add_tcase (s, tc_chain); suite_add_tcase (s, tc_chain);

View file

@ -17,6 +17,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>

View file

@ -17,6 +17,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>

View file

@ -26,8 +26,6 @@
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/rtsp/gstrtspconnection.h> #include <gst/rtsp/gstrtspconnection.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h> #include <string.h>

View file

@ -29,8 +29,6 @@
# include <valgrind/valgrind.h> # include <valgrind/valgrind.h>
#endif #endif
#include <unistd.h>
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/video/video.h> #include <gst/video/video.h>

View file

@ -34,11 +34,12 @@ base_tests = [
[ 'elements/audiorate.c' ], [ 'elements/audiorate.c' ],
[ 'elements/audiotestsrc.c' ], [ 'elements/audiotestsrc.c' ],
[ 'elements/audioresample.c' ], [ 'elements/audioresample.c' ],
[ 'elements/libvisual.c', not libvisual_dep.found() ], [ 'elements/libvisual.c', not is_variable('libvisual_dep') or not libvisual_dep.found() ],
[ 'elements/decodebin.c' ], [ 'elements/decodebin.c' ],
[ 'elements/encodebin.c', not theoraenc_dep.found() or not vorbisenc_dep.found() ], [ 'elements/encodebin.c', not theoraenc_dep.found() or not vorbisenc_dep.found() ],
[ 'elements/multifdsink.c' ], [ 'elements/multifdsink.c', not core_conf.has('HAVE_SYS_SOCKET_H') or not core_conf.has('HAVE_UNISTD_H') ],
[ 'elements/multisocketsink.c' ], # FIXME: multisocketsink test on windows/msvc
[ 'elements/multisocketsink.c', not core_conf.has('HAVE_SYS_SOCKET_H') or not core_conf.has('HAVE_UNISTD_H') ],
[ 'elements/playbin.c' ], [ 'elements/playbin.c' ],
[ 'elements/playbin-complex.c', not ogg_dep.found() ], [ 'elements/playbin-complex.c', not ogg_dep.found() ],
[ 'elements/playsink.c' ], [ 'elements/playsink.c' ],
@ -60,7 +61,8 @@ base_tests = [
[ 'pipelines/gio.c' ], [ 'pipelines/gio.c' ],
[ 'pipelines/oggmux.c', not ogg_dep.found(), [ ogg_dep, ] ], [ 'pipelines/oggmux.c', not ogg_dep.found(), [ ogg_dep, ] ],
[ 'pipelines/streamsynchronizer.c' ], [ 'pipelines/streamsynchronizer.c' ],
[ 'pipelines/tcp.c' ], # FIXME: -DHAVE_GIO_UNIX_2_0=1 # FIXME: tcp test on windows/msvc
[ 'pipelines/tcp.c', not core_conf.has('HAVE_SYS_SOCKET_H') or not core_conf.has('HAVE_UNISTD_H') ],
[ 'pipelines/theoraenc.c', not theoraenc_dep.found(), [ theoraenc_dep ] ], [ 'pipelines/theoraenc.c', not theoraenc_dep.found(), [ theoraenc_dep ] ],
[ 'pipelines/vorbisenc.c', not vorbisenc_dep.found() ], [ 'pipelines/vorbisenc.c', not vorbisenc_dep.found() ],
[ 'pipelines/vorbisdec.c', not vorbisenc_dep.found(),], [ 'pipelines/vorbisdec.c', not vorbisenc_dep.found(),],

View file

@ -21,6 +21,10 @@
/* Ideally this would be in core, but using videotestsrc makes it easier */ /* Ideally this would be in core, but using videotestsrc makes it easier */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#define FIRST_CAPS "video/x-raw,width=(int)480,height=(int)320" #define FIRST_CAPS "video/x-raw,width=(int)480,height=(int)320"

View file

@ -19,6 +19,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/check/gstbufferstraw.h> #include <gst/check/gstbufferstraw.h>

View file

@ -18,6 +18,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>

View file

@ -17,9 +17,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include <unistd.h> #include "config.h"
#include <sys/socket.h> #endif
#include <gio/gio.h> #include <gio/gio.h>
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
@ -33,6 +33,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/socket.h>
#include <unistd.h> #include <unistd.h>
static gboolean static gboolean

View file

@ -19,6 +19,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/check/gstbufferstraw.h> #include <gst/check/gstbufferstraw.h>

View file

@ -19,6 +19,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/check/gstbufferstraw.h> #include <gst/check/gstbufferstraw.h>

View file

@ -19,6 +19,9 @@
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <gst/check/gstcheck.h> #include <gst/check/gstcheck.h>
#include <gst/check/gstbufferstraw.h> #include <gst/check/gstbufferstraw.h>