tests: include config.h and don't include unix headers
authorTim-Philipp Müller <tim@centricular.com>
Tue, 16 Jan 2018 18:14:59 +0000 (18:14 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 16 Jan 2018 18:14:59 +0000 (18:14 +0000)
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.

36 files changed:
tests/check/elements/adder.c
tests/check/elements/appsink.c
tests/check/elements/audioconvert.c
tests/check/elements/audioresample.c
tests/check/elements/audiotestsrc.c
tests/check/elements/decodebin.c
tests/check/elements/libvisual.c
tests/check/elements/multisocketsink.c
tests/check/elements/opus.c
tests/check/elements/playbin.c
tests/check/elements/rawaudioparse.c
tests/check/elements/rawvideoparse.c
tests/check/elements/textoverlay.c
tests/check/elements/videorate.c
tests/check/elements/videotestsrc.c
tests/check/elements/volume.c
tests/check/elements/vorbisdec.c
tests/check/elements/vorbistag.c
tests/check/generic/clock-selection.c
tests/check/generic/states.c
tests/check/libs/audiocdsrc.c
tests/check/libs/libsabi.c
tests/check/libs/pbutils.c
tests/check/libs/profile.c
tests/check/libs/rtpbasedepayload.c
tests/check/libs/rtpbasepayload.c
tests/check/libs/rtspconnection.c
tests/check/libs/video.c
tests/check/meson.build
tests/check/pipelines/capsfilter-renegotiation.c
tests/check/pipelines/gio.c
tests/check/pipelines/streamsynchronizer.c
tests/check/pipelines/tcp.c
tests/check/pipelines/theoraenc.c
tests/check/pipelines/vorbisdec.c
tests/check/pipelines/vorbisenc.c

index 64ed5b9..3a229d0 100644 (file)
@@ -28,8 +28,6 @@
 # include <valgrind/valgrind.h>
 #endif
 
-#include <unistd.h>
-
 #include <gst/check/gstcheck.h>
 #include <gst/check/gstconsistencychecker.h>
 #include <gst/base/gstbasesrc.h>
index 4d5ec34..03adf06 100644 (file)
@@ -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 <gst/check/gstcheck.h>
 #include <gst/app/gstappsink.h>
index 05c9d12..23c5341 100644 (file)
@@ -20,8 +20,9 @@
  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
-
-#include <unistd.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <gst/check/gstcheck.h>
 #include <gst/audio/audio.h>
index 701995d..12236b1 100644 (file)
@@ -20,8 +20,9 @@
  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
-
-#include <unistd.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <gst/check/gstcheck.h>
 
index 5023772..bb70c67 100644 (file)
@@ -20,7 +20,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include <unistd.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <gst/check/gstcheck.h>
 #include <gst/audio/audio.h>
index 457cb36..252ad03 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <gst/check/gstcheck.h>
 #include <gst/base/gstbaseparse.h>
-#include <unistd.h>
 
 static const gchar dummytext[] =
     "Quick Brown Fox Jumps over a Lazy Frog Quick Brown "
index 5dbee68..40ee37c 100644 (file)
@@ -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 <gst/check/gstcheck.h>
 
index de036c2..9ec0cc9 100644 (file)
@@ -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 <unistd.h>
 #include <sys/ioctl.h>
index 88f87aa..abdda64 100644 (file)
@@ -20,7 +20,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include <unistd.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <gst/check/gstcheck.h>
 #include <gst/check/gstharness.h>
index 170ddce..26e07a2 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <gst/check/gstcheck.h>
 #include <gst/base/gstpushsrc.h>
-#include <unistd.h>
 
 #ifndef GST_DISABLE_REGISTRY
 
index 029aab5..c9c2c36 100644 (file)
  * 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
 
index 159cc2d..9888757 100644 (file)
@@ -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 <gst/check/gstcheck.h>
 #include <gst/video/video.h>
index a39bd6c..c97df51 100644 (file)
@@ -18,7 +18,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include <unistd.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <gst/check/gstcheck.h>
 #include <gst/video/video-overlay-composition.h>
index 7db5519..4aecdc9 100644 (file)
@@ -19,8 +19,9 @@
  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
-
-#include <unistd.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <gst/check/gstcheck.h>
 
index bf338d1..4468f88 100644 (file)
@@ -29,8 +29,6 @@
 # include <valgrind/valgrind.h>
 #endif
 
-#include <unistd.h>
-
 #include <gst/check/gstcheck.h>
 #include <gst/check/gstharness.h>
 
index 9d8f215..7eab992 100644 (file)
@@ -20,7 +20,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include <unistd.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <gst/base/gstbasetransform.h>
 #include <gst/check/gstcheck.h>
index 4564952..b18f97b 100644 (file)
@@ -19,8 +19,9 @@
  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
-
-#include <unistd.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <gst/check/gstcheck.h>
 
index 0ffa102..4d27323 100644 (file)
  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
-#include <unistd.h>
 #include <glib.h>
 
 #include <vorbis/codec.h>
index cfea856..ddfd069 100644 (file)
@@ -20,7 +20,9 @@
  * Boston, MA 02110-1301, USA.
  */
 
-#include <unistd.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <gst/check/gstcheck.h>
 
index 64b2b40..1167916 100644 (file)
@@ -24,7 +24,6 @@
 #  include "config.h"
 #endif
 
-#include <unistd.h>
 #include <gmodule.h>
 
 #include <gst/check/gstcheck.h>
index b98a3eb..9dee80a 100644 (file)
@@ -30,8 +30,6 @@
 #include "config.h"
 #endif
 
-#include <unistd.h>
-
 #include <gst/check/gstcheck.h>
 #include <gst/check/gstbufferstraw.h>
 
index 316826e..40595a9 100644 (file)
  * Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif
+
 #include <gst/check/gstcheck.h>
 
 #include <gst/app/gstappsrc.h>
index dda8d78..856b71e 100644 (file)
@@ -37,8 +37,8 @@
 #include <sys/stat.h>           /* for chmod() */
 #endif
 
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>             /* for unlink() */
+#ifdef G_OS_UNIX
+#include <unistd.h>             /* 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 */
 }
index 44e9f39..3faba3c 100644 (file)
@@ -22,8 +22,6 @@
 #include "config.h"
 #endif
 
-/* #include <fcntl.h> */
-#include <unistd.h>
 #include <glib.h>
 #include <glib/gstdio.h>
 #include <gst/check/gstcheck.h>
 #include <gst/pbutils/encoding-profile.h>
 #include <gst/pbutils/encoding-target.h>
 
+#ifdef G_OS_UNIX
+#include <unistd.h>             /* 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);
 
index 63cbc87..ed23ca1 100644 (file)
@@ -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 <gst/gst.h>
 #include <gst/check/gstcheck.h>
index 3cc6e41..15cfa16 100644 (file)
@@ -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 <gst/gst.h>
 #include <gst/check/gstcheck.h>
index d24fd54..56f83e5 100644 (file)
@@ -26,8 +26,6 @@
 #include <gst/check/gstcheck.h>
 
 #include <gst/rtsp/gstrtspconnection.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
 #include <string.h>
 
 
index ce4c4f9..7fffcdd 100644 (file)
@@ -29,8 +29,6 @@
 # include <valgrind/valgrind.h>
 #endif
 
-#include <unistd.h>
-
 #include <gst/check/gstcheck.h>
 
 #include <gst/video/video.h>
index 94d6e7b..1c0c39e 100644 (file)
@@ -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(),],
index 4a3fc98..7ba6b89 100644 (file)
 
 /* 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>
 
 #define FIRST_CAPS  "video/x-raw,width=(int)480,height=(int)320"
index 60b45c2..46ae0cd 100644 (file)
@@ -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 <gst/check/gstcheck.h>
 #include <gst/check/gstbufferstraw.h>
index 59cfb7b..07aa445 100644 (file)
@@ -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 <gst/check/gstcheck.h>
 
index 00bdaa3..8701484 100644 (file)
@@ -17,9 +17,9 @@
  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
-
-#include <unistd.h>
-#include <sys/socket.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include <gio/gio.h>
 #include <gst/check/gstcheck.h>
@@ -33,6 +33,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/socket.h>
 #include <unistd.h>
 
 static gboolean
index ff8b6e1..c729567 100644 (file)
@@ -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 <gst/check/gstcheck.h>
 #include <gst/check/gstbufferstraw.h>
index 51b7f38..4514e92 100644 (file)
@@ -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 <gst/check/gstcheck.h>
 #include <gst/check/gstbufferstraw.h>
index 6eeefcc..2a47907 100644 (file)
@@ -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 <gst/check/gstcheck.h>
 #include <gst/check/gstbufferstraw.h>