From 3f184c3abc553a44dcdf17c10563b330b560bdf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 16 Jan 2018 18:14:59 +0000 Subject: [PATCH] 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. --- tests/check/elements/adder.c | 2 -- tests/check/elements/appsink.c | 3 +++ tests/check/elements/audioconvert.c | 5 +++-- tests/check/elements/audioresample.c | 5 +++-- tests/check/elements/audiotestsrc.c | 4 +++- tests/check/elements/decodebin.c | 1 - tests/check/elements/libvisual.c | 3 +++ tests/check/elements/multisocketsink.c | 3 +++ tests/check/elements/opus.c | 4 +++- tests/check/elements/playbin.c | 1 - tests/check/elements/rawaudioparse.c | 5 ++++- tests/check/elements/rawvideoparse.c | 3 +++ tests/check/elements/textoverlay.c | 4 +++- tests/check/elements/videorate.c | 5 +++-- tests/check/elements/videotestsrc.c | 2 -- tests/check/elements/volume.c | 4 +++- tests/check/elements/vorbisdec.c | 5 +++-- tests/check/elements/vorbistag.c | 4 +++- tests/check/generic/clock-selection.c | 4 +++- tests/check/generic/states.c | 1 - tests/check/libs/audiocdsrc.c | 2 -- tests/check/libs/libsabi.c | 3 +++ tests/check/libs/pbutils.c | 6 +++--- tests/check/libs/profile.c | 10 ++++++++-- tests/check/libs/rtpbasedepayload.c | 3 +++ tests/check/libs/rtpbasepayload.c | 3 +++ tests/check/libs/rtspconnection.c | 2 -- tests/check/libs/video.c | 2 -- tests/check/meson.build | 10 ++++++---- tests/check/pipelines/capsfilter-renegotiation.c | 4 ++++ tests/check/pipelines/gio.c | 3 +++ tests/check/pipelines/streamsynchronizer.c | 3 +++ tests/check/pipelines/tcp.c | 7 ++++--- tests/check/pipelines/theoraenc.c | 3 +++ tests/check/pipelines/vorbisdec.c | 3 +++ tests/check/pipelines/vorbisenc.c | 3 +++ 36 files changed, 95 insertions(+), 40 deletions(-) diff --git a/tests/check/elements/adder.c b/tests/check/elements/adder.c index 64ed5b915e..3a229d0c87 100644 --- a/tests/check/elements/adder.c +++ b/tests/check/elements/adder.c @@ -28,8 +28,6 @@ # include #endif -#include - #include #include #include diff --git a/tests/check/elements/appsink.c b/tests/check/elements/appsink.c index 4d5ec345c7..03adf063a6 100644 --- a/tests/check/elements/appsink.c +++ b/tests/check/elements/appsink.c @@ -17,6 +17,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include diff --git a/tests/check/elements/audioconvert.c b/tests/check/elements/audioconvert.c index 05c9d12d8a..23c534128a 100644 --- a/tests/check/elements/audioconvert.c +++ b/tests/check/elements/audioconvert.c @@ -20,8 +20,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ - -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include diff --git a/tests/check/elements/audioresample.c b/tests/check/elements/audioresample.c index 701995d208..12236b1648 100644 --- a/tests/check/elements/audioresample.c +++ b/tests/check/elements/audioresample.c @@ -20,8 +20,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ - -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include diff --git a/tests/check/elements/audiotestsrc.c b/tests/check/elements/audiotestsrc.c index 5023772ad6..bb70c676d7 100644 --- a/tests/check/elements/audiotestsrc.c +++ b/tests/check/elements/audiotestsrc.c @@ -20,7 +20,9 @@ * Boston, MA 02110-1301, USA. */ -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include diff --git a/tests/check/elements/decodebin.c b/tests/check/elements/decodebin.c index 457cb36629..252ad033a3 100644 --- a/tests/check/elements/decodebin.c +++ b/tests/check/elements/decodebin.c @@ -25,7 +25,6 @@ #include #include -#include static const gchar dummytext[] = "Quick Brown Fox Jumps over a Lazy Frog Quick Brown " diff --git a/tests/check/elements/libvisual.c b/tests/check/elements/libvisual.c index 5dbee68bc0..40ee37c86d 100644 --- a/tests/check/elements/libvisual.c +++ b/tests/check/elements/libvisual.c @@ -17,6 +17,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include diff --git a/tests/check/elements/multisocketsink.c b/tests/check/elements/multisocketsink.c index de036c2a90..9ec0cc9a46 100644 --- a/tests/check/elements/multisocketsink.c +++ b/tests/check/elements/multisocketsink.c @@ -17,6 +17,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include diff --git a/tests/check/elements/opus.c b/tests/check/elements/opus.c index 88f87aaf28..abdda64193 100644 --- a/tests/check/elements/opus.c +++ b/tests/check/elements/opus.c @@ -20,7 +20,9 @@ * Boston, MA 02110-1301, USA. */ -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include diff --git a/tests/check/elements/playbin.c b/tests/check/elements/playbin.c index 170ddcef48..26e07a29e8 100644 --- a/tests/check/elements/playbin.c +++ b/tests/check/elements/playbin.c @@ -28,7 +28,6 @@ #include #include -#include #ifndef GST_DISABLE_REGISTRY diff --git a/tests/check/elements/rawaudioparse.c b/tests/check/elements/rawaudioparse.c index 029aab5564..c9c2c3660c 100644 --- a/tests/check/elements/rawaudioparse.c +++ b/tests/check/elements/rawaudioparse.c @@ -19,8 +19,11 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * 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 */ #define GLIB_DISABLE_DEPRECATION_WARNINGS diff --git a/tests/check/elements/rawvideoparse.c b/tests/check/elements/rawvideoparse.c index 159cc2da16..9888757c40 100644 --- a/tests/check/elements/rawvideoparse.c +++ b/tests/check/elements/rawvideoparse.c @@ -19,6 +19,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include diff --git a/tests/check/elements/textoverlay.c b/tests/check/elements/textoverlay.c index a39bd6cc4f..c97df51e87 100644 --- a/tests/check/elements/textoverlay.c +++ b/tests/check/elements/textoverlay.c @@ -18,7 +18,9 @@ * Boston, MA 02110-1301, USA. */ -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include diff --git a/tests/check/elements/videorate.c b/tests/check/elements/videorate.c index 7db55199ab..4aecdc9a9c 100644 --- a/tests/check/elements/videorate.c +++ b/tests/check/elements/videorate.c @@ -19,8 +19,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ - -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include diff --git a/tests/check/elements/videotestsrc.c b/tests/check/elements/videotestsrc.c index bf338d1c7d..4468f88a69 100644 --- a/tests/check/elements/videotestsrc.c +++ b/tests/check/elements/videotestsrc.c @@ -29,8 +29,6 @@ # include #endif -#include - #include #include diff --git a/tests/check/elements/volume.c b/tests/check/elements/volume.c index 9d8f215030..7eab992da9 100644 --- a/tests/check/elements/volume.c +++ b/tests/check/elements/volume.c @@ -20,7 +20,9 @@ * Boston, MA 02110-1301, USA. */ -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include diff --git a/tests/check/elements/vorbisdec.c b/tests/check/elements/vorbisdec.c index 456495283c..b18f97b196 100644 --- a/tests/check/elements/vorbisdec.c +++ b/tests/check/elements/vorbisdec.c @@ -19,8 +19,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ - -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include diff --git a/tests/check/elements/vorbistag.c b/tests/check/elements/vorbistag.c index 0ffa102ab9..4d273230ec 100644 --- a/tests/check/elements/vorbistag.c +++ b/tests/check/elements/vorbistag.c @@ -19,8 +19,10 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif -#include #include #include diff --git a/tests/check/generic/clock-selection.c b/tests/check/generic/clock-selection.c index cfea856d9c..ddfd069c40 100644 --- a/tests/check/generic/clock-selection.c +++ b/tests/check/generic/clock-selection.c @@ -20,7 +20,9 @@ * Boston, MA 02110-1301, USA. */ -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include diff --git a/tests/check/generic/states.c b/tests/check/generic/states.c index 64b2b40e51..11679164c0 100644 --- a/tests/check/generic/states.c +++ b/tests/check/generic/states.c @@ -24,7 +24,6 @@ # include "config.h" #endif -#include #include #include diff --git a/tests/check/libs/audiocdsrc.c b/tests/check/libs/audiocdsrc.c index b98a3ebc91..9dee80a96f 100644 --- a/tests/check/libs/audiocdsrc.c +++ b/tests/check/libs/audiocdsrc.c @@ -30,8 +30,6 @@ #include "config.h" #endif -#include - #include #include diff --git a/tests/check/libs/libsabi.c b/tests/check/libs/libsabi.c index 316826e45d..40595a9ccd 100644 --- a/tests/check/libs/libsabi.c +++ b/tests/check/libs/libsabi.c @@ -20,7 +20,10 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H #include +#endif + #include #include diff --git a/tests/check/libs/pbutils.c b/tests/check/libs/pbutils.c index dda8d78397..856b71e048 100644 --- a/tests/check/libs/pbutils.c +++ b/tests/check/libs/pbutils.c @@ -37,8 +37,8 @@ #include /* for chmod() */ #endif -#ifdef HAVE_UNISTD_H -#include /* for unlink() */ +#ifdef G_OS_UNIX +#include /* for getpid() */ #endif static void @@ -613,7 +613,7 @@ test_pb_utils_install_plugins_do_callout (const gchar * const *details, done: - unlink (path); + g_unlink (path); g_free (path); #endif /* G_OS_UNIX */ } diff --git a/tests/check/libs/profile.c b/tests/check/libs/profile.c index 44e9f39298..3faba3c1b3 100644 --- a/tests/check/libs/profile.c +++ b/tests/check/libs/profile.c @@ -22,8 +22,6 @@ #include "config.h" #endif -/* #include */ -#include #include #include #include @@ -31,6 +29,10 @@ #include #include +#ifdef G_OS_UNIX +#include /* For R_OK etc. */ +#endif + static inline gboolean gst_caps_is_equal_unref (GstCaps * caps1, GstCaps * caps2) { @@ -679,9 +681,13 @@ profile_suite (void) gchar *gst_dir; /* cehck if we can create profiles */ +#ifdef G_OS_UNIX 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); g_free (gst_dir); +#else + can_write = FALSE; /* FIXME: fix can_write test on Windows */ +#endif suite_add_tcase (s, tc_chain); diff --git a/tests/check/libs/rtpbasedepayload.c b/tests/check/libs/rtpbasedepayload.c index 63cbc87456..ed23ca1742 100644 --- a/tests/check/libs/rtpbasedepayload.c +++ b/tests/check/libs/rtpbasedepayload.c @@ -17,6 +17,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include diff --git a/tests/check/libs/rtpbasepayload.c b/tests/check/libs/rtpbasepayload.c index 3cc6e41495..15cfa16e03 100644 --- a/tests/check/libs/rtpbasepayload.c +++ b/tests/check/libs/rtpbasepayload.c @@ -17,6 +17,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include diff --git a/tests/check/libs/rtspconnection.c b/tests/check/libs/rtspconnection.c index d24fd54c43..56f83e5b96 100644 --- a/tests/check/libs/rtspconnection.c +++ b/tests/check/libs/rtspconnection.c @@ -26,8 +26,6 @@ #include #include -#include -#include #include diff --git a/tests/check/libs/video.c b/tests/check/libs/video.c index ce4c4f9d7e..7fffcddbfe 100644 --- a/tests/check/libs/video.c +++ b/tests/check/libs/video.c @@ -29,8 +29,6 @@ # include #endif -#include - #include #include diff --git a/tests/check/meson.build b/tests/check/meson.build index 94d6e7bc16..1c0c39e9d7 100644 --- a/tests/check/meson.build +++ b/tests/check/meson.build @@ -34,11 +34,12 @@ base_tests = [ [ 'elements/audiorate.c' ], [ 'elements/audiotestsrc.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/encodebin.c', not theoraenc_dep.found() or not vorbisenc_dep.found() ], - [ 'elements/multifdsink.c' ], - [ 'elements/multisocketsink.c' ], + [ 'elements/multifdsink.c', not core_conf.has('HAVE_SYS_SOCKET_H') or not core_conf.has('HAVE_UNISTD_H') ], + # 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-complex.c', not ogg_dep.found() ], [ 'elements/playsink.c' ], @@ -60,7 +61,8 @@ base_tests = [ [ 'pipelines/gio.c' ], [ 'pipelines/oggmux.c', not ogg_dep.found(), [ ogg_dep, ] ], [ '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/vorbisenc.c', not vorbisenc_dep.found() ], [ 'pipelines/vorbisdec.c', not vorbisenc_dep.found(),], diff --git a/tests/check/pipelines/capsfilter-renegotiation.c b/tests/check/pipelines/capsfilter-renegotiation.c index 4a3fc98abd..7ba6b893d2 100644 --- a/tests/check/pipelines/capsfilter-renegotiation.c +++ b/tests/check/pipelines/capsfilter-renegotiation.c @@ -21,6 +21,10 @@ /* Ideally this would be in core, but using videotestsrc makes it easier */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #define FIRST_CAPS "video/x-raw,width=(int)480,height=(int)320" diff --git a/tests/check/pipelines/gio.c b/tests/check/pipelines/gio.c index 60b45c2a9b..46ae0cd5e8 100644 --- a/tests/check/pipelines/gio.c +++ b/tests/check/pipelines/gio.c @@ -19,6 +19,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include diff --git a/tests/check/pipelines/streamsynchronizer.c b/tests/check/pipelines/streamsynchronizer.c index 59cfb7b8c1..07aa445669 100644 --- a/tests/check/pipelines/streamsynchronizer.c +++ b/tests/check/pipelines/streamsynchronizer.c @@ -18,6 +18,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include diff --git a/tests/check/pipelines/tcp.c b/tests/check/pipelines/tcp.c index 00bdaa3737..8701484d57 100644 --- a/tests/check/pipelines/tcp.c +++ b/tests/check/pipelines/tcp.c @@ -17,9 +17,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ - -#include -#include +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include @@ -33,6 +33,7 @@ #include #include +#include #include static gboolean diff --git a/tests/check/pipelines/theoraenc.c b/tests/check/pipelines/theoraenc.c index ff8b6e1fbc..c72956716f 100644 --- a/tests/check/pipelines/theoraenc.c +++ b/tests/check/pipelines/theoraenc.c @@ -19,6 +19,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include diff --git a/tests/check/pipelines/vorbisdec.c b/tests/check/pipelines/vorbisdec.c index 51b7f38bbf..4514e926b8 100644 --- a/tests/check/pipelines/vorbisdec.c +++ b/tests/check/pipelines/vorbisdec.c @@ -19,6 +19,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include diff --git a/tests/check/pipelines/vorbisenc.c b/tests/check/pipelines/vorbisenc.c index 6eeefcc66d..2a47907d0c 100644 --- a/tests/check/pipelines/vorbisenc.c +++ b/tests/check/pipelines/vorbisenc.c @@ -19,6 +19,9 @@ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include #include