meson test: Enable libs tests
authorMathieu Duponchelle <mathieu@centricular.com>
Mon, 16 Oct 2017 17:51:36 +0000 (19:51 +0200)
committerMathieu Duponchelle <mathieu@centricular.com>
Fri, 8 Dec 2017 17:42:22 +0000 (18:42 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=789064

meson_options.txt
tests/check/media/download-media [new file with mode: 0755]
tests/check/media/meson.build [new file with mode: 0644]
tests/check/meson.build

index f1ab3f0..fbcf625 100644 (file)
@@ -12,3 +12,5 @@ option('with-package-name', type : 'string',
        description : 'package name to use in plugins')
 option('with-package-origin', type : 'string', value : 'Unknown package origin',
        description : 'package origin URL to use in plugins')
+option('enable_gst_player_tests', type: 'boolean', value: false,
+       description: 'Enable GstPlayer tests that need network access')
diff --git a/tests/check/media/download-media b/tests/check/media/download-media
new file mode 100755 (executable)
index 0000000..f522ff0
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/env python3
+
+import urllib.request
+import shutil
+import sys
+import os
+
+os.makedirs(os.path.dirname(sys.argv[2]), exist_ok=True)
+
+with urllib.request.urlopen(sys.argv[1]) as response, open(sys.argv[2], 'wb') as out_file:
+    shutil.copyfileobj(response, out_file)
diff --git a/tests/check/media/meson.build b/tests/check/media/meson.build
new file mode 100644 (file)
index 0000000..7094d2d
--- /dev/null
@@ -0,0 +1,19 @@
+test_media = [
+  'audio.ogg',
+  'audio-video.ogg',
+  'audio-short.ogg',
+  'audio-video-short.ogg',
+  'sintel.mkv',
+  'test_sub.srt',
+]
+
+download_media = find_program('download-media')
+
+foreach m: test_media
+  downloaded_media = custom_target(m,
+    input : [],
+    output : m,
+    command: [download_media, 'http://gstreamer.freedesktop.org/data/media/small/' + m, '@OUTPUT@'],
+    build_by_default: true,
+    install: false)
+endforeach
index f0a8ec1..d2c7a0d 100644 (file)
@@ -11,6 +11,8 @@ libparser_dep = declare_dependency(link_with: libparser,
 
 exif_dep = dependency('libexif', version : '>= 0.6.16', required : false)
 
+enable_gst_player_tests = get_option('enable_gst_player_tests')
+
 # name, condition when to skip the test and extra dependencies
 base_tests = [
   [['elements/aiffparse.c']],
@@ -55,7 +57,22 @@ base_tests = [
   [['elements/voaacenc.c'], not voaac_dep.found(), [voaac_dep]],
   [['elements/x265enc.c'], not x265_dep.found(), [x265_dep]],
   [['elements/zbar.c'], not zbar_dep.found(), [zbar_dep]],
+  [['libs/gstglcolorconvert.c'], not build_gstgl, [gstgl_dep]],
+  [['libs/gstglcontext.c'], not build_gstgl, [gstgl_dep]],
+  [['libs/gstglheaders.c'], not build_gstgl, [gstgl_dep]],
+  [['libs/gstglmatrix.c'], not build_gstgl, [gstgl_dep]],
+  [['libs/gstglmemory.c'], not build_gstgl, [gstgl_dep]],
+  [['libs/gstglquery.c'], not build_gstgl, [gstgl_dep]],
+  [['libs/gstglsl.c'], not build_gstgl, [gstgl_dep]],
+  [['libs/gstglupload.c'], not build_gstgl, [gstgl_dep]],
+  [['libs/h264parser.c'], false, [gstcodecparsers_dep]],
+  [['libs/insertbin.c'], false, [gstinsertbin_dep]],
   [['libs/isoff.c'], not xml2_dep.found(), [gstisoff_dep, xml2_dep]],
+  [['libs/mpegts.c'], false, [gstmpegts_dep]],
+  [['libs/mpegvideoparser.c'], false, [gstcodecparsers_dep]],
+  [['libs/player.c'], not enable_gst_player_tests, [gstplayer_dep]],
+  [['libs/vc1parser.c'], false, [gstcodecparsers_dep]],
+  [['libs/vp8parser.c'], false, [gstcodecparsers_dep]],
 ]
 
 test_defines = [
@@ -63,6 +80,7 @@ test_defines = [
   '-UG_DISABLE_CAST_CHECKS',
   '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_STATE_IGNORE_ELEMENTS"',
   '-DGST_TEST_FILES_PATH="' + meson.current_source_dir() + '/../files"',
+  '-DTEST_PATH="' + meson.current_build_dir() + '/media"',
   '-DDASH_MPD_DATADIR=' + meson.current_source_dir() + '/elements/dash_mpd_data',
   '-DGST_USE_UNSTABLE_API',
 ]
@@ -113,3 +131,7 @@ foreach t : base_tests
     test(test_name, exe, env: env, timeout: 3 * 60)
   endif
 endforeach
+
+if enable_gst_player_tests
+  subdir ('media')
+endif