From 58c374c8e223d15987b075a7080ea6886e55acda Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Mon, 16 Oct 2017 19:51:36 +0200 Subject: [PATCH] meson test: Enable libs tests https://bugzilla.gnome.org/show_bug.cgi?id=789064 --- meson_options.txt | 2 ++ tests/check/media/download-media | 11 +++++++++++ tests/check/media/meson.build | 19 +++++++++++++++++++ tests/check/meson.build | 22 ++++++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100755 tests/check/media/download-media create mode 100644 tests/check/media/meson.build diff --git a/meson_options.txt b/meson_options.txt index f1ab3f046e..fbcf625bf4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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 index 0000000000..f522ff00e5 --- /dev/null +++ b/tests/check/media/download-media @@ -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 index 0000000000..7094d2dfca --- /dev/null +++ b/tests/check/media/meson.build @@ -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 diff --git a/tests/check/meson.build b/tests/check/meson.build index f0a8ec120a..d2c7a0dc6f 100644 --- a/tests/check/meson.build +++ b/tests/check/meson.build @@ -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