summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2020-10-01 11:45:57 +0200
committerSeungha Yang <seungha@centricular.com>2020-10-07 19:08:30 +0900
commit2b2fce99702bf314fb1e3150537e9fbf11083c00 (patch)
tree9b31b4d54f28453e816e5c16ed20ddc5931894a0
parent89bb244ab9fe57645c8da2ac7b267a0469048e4e (diff)
build: Re-enable unit tests
Looks like they weren't ported when we switched to meson Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-libav/-/merge_requests/100>
-rw-r--r--meson.build4
-rw-r--r--meson_options.txt3
-rw-r--r--tests/check/meson.build58
-rw-r--r--tests/meson.build3
4 files changed, 67 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 5462c3e..bcde45a 100644
--- a/meson.build
+++ b/meson.build
@@ -84,6 +84,9 @@ gst_dep = dependency('gstreamer-1.0', version : gst_req,
fallback : ['gstreamer', 'gst_dep'])
gstbase_dep = dependency('gstreamer-base-1.0', version : gst_req,
fallback : ['gstreamer', 'gst_base_dep'])
+gstcheck_dep = dependency('gstreamer-check-1.0', version : gst_req,
+ required : get_option('tests'),
+ fallback : ['gstreamer', 'gst_check_dep'])
gstvideo_dep = dependency('gstreamer-video-1.0', version : gst_req,
fallback : ['gst-plugins-base', 'video_dep'])
@@ -185,6 +188,7 @@ endif
plugins = []
subdir('ext/libav')
subdir('docs')
+subdir('tests')
# Set release date
if gst_version_nano == 0
diff --git a/meson_options.txt b/meson_options.txt
index e01317c..9d8a701 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,4 +4,5 @@ option('package-origin', type : 'string',
value : 'Unknown package origin', yield : true,
description : 'package origin URL to use in plugins')
option('doc', type : 'feature', value : 'auto', yield: true,
- description: 'Enable documentation.') \ No newline at end of file
+ description: 'Enable documentation.')
+option('tests', type : 'feature', value : 'auto', yield : true)
diff --git a/tests/check/meson.build b/tests/check/meson.build
new file mode 100644
index 0000000..4387e7b
--- /dev/null
+++ b/tests/check/meson.build
@@ -0,0 +1,58 @@
+# name, condition when to skip the test and extra dependencies
+libav_tests = [
+ [ 'elements/avdec_adpcm' ],
+ [ 'elements/avdemux_ape' ],
+ [ 'generic/libavcodec-locking' ],
+ [ 'generic/plugin-test' ]
+]
+
+test_defines = [
+ '-UG_DISABLE_ASSERT',
+ '-UG_DISABLE_CAST_CHECKS',
+ '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_PLUGIN_LOADING_WHITELIST"',
+ '-DGST_TEST_FILES_PATH="' + meson.current_source_dir() + '/../files"',
+ '-DGST_USE_UNSTABLE_API',
+]
+
+pluginsdirs = []
+if gst_dep.type_name() == 'pkgconfig'
+ pbase = dependency('gstreamer-plugins-base-' + api_version, required: true)
+ pluginsdirs = [gst_dep.get_pkgconfig_variable('pluginsdir'),
+ pbase.get_pkgconfig_variable('pluginsdir')]
+ gst_plugin_scanner_dir = gst_dep.get_pkgconfig_variable('pluginscannerdir')
+else
+ gst_plugin_scanner_dir = subproject('gstreamer').get_variable('gst_scanner_dir')
+endif
+gst_plugin_scanner_path = join_paths(gst_plugin_scanner_dir, 'gst-plugin-scanner')
+
+# FIXME: check, also + PTHREAD_CFLAGS
+test_deps = [gst_dep, gstbase_dep, gstcheck_dep, gstaudio_dep,
+ gstvideo_dep, gstpbutils_dep]
+
+# FIXME: add valgrind suppression common/gst.supp gst-libav.supp
+foreach t : libav_tests
+ fname = '@0@.c'.format(t.get(0))
+ test_name = t.get(0).underscorify()
+ extra_sources = t.get(3, [ ])
+ extra_deps = t.get(2, [ ])
+ skip_test = t.get(1, false)
+ if not skip_test
+ env = environment()
+ env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
+ env.set('CK_DEFAULT_TIMEOUT', '20')
+ env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer', 'gst-plugins-base',
+ 'gst-libav@' + meson.build_root())
+ env.set('GST_PLUGIN_PATH_1_0', [meson.build_root()] + pluginsdirs)
+ env.set('GSETTINGS_BACKEND', 'memory')
+
+ env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(test_name)))
+ env.set('GST_PLUGIN_SCANNER_1_0', gst_plugin_scanner_path)
+ exe = executable(test_name, fname, extra_sources,
+ include_directories : [configinc],
+ c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines,
+ dependencies : [libm] + test_deps + extra_deps,
+ )
+ test(test_name, exe, env: env, timeout: 3 * 60)
+ endif
+endforeach
+
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..3714641
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,3 @@
+if not get_option('tests').disabled() and gstcheck_dep.found()
+ subdir('check')
+endif