meson: Make use of new environment object and set plugin path to builddir
authorThibault Saunier <thibault.saunier@osg.samsung.com>
Tue, 4 Oct 2016 12:20:37 +0000 (09:20 -0300)
committerThibault Saunier <thibault.saunier@osg.samsung.com>
Fri, 14 Oct 2016 15:30:00 +0000 (17:30 +0200)
- Properly set where to find gst-plugin-scanner
- Use GST_LOADING_WHITELIST so that only core plugins are used

Bump meson requirement to 0.35

libs/gst/helpers/meson.build
meson.build
tests/check/meson.build

index b655995..be1a18d 100644 (file)
@@ -8,5 +8,7 @@ gst_plugin_scanner = executable('gst-plugin-scanner',
   install: true,
 )
 
+gst_scanner_dir = meson.current_build_dir()
+
 # FIXME: gst-ptp-helper
 # FIXME: gst-completion-helper
index c80b2b6..e90236b 100644 (file)
@@ -1,6 +1,6 @@
 project('gstreamer', 'c', 'cpp',
   version : '1.9.90',
-  meson_version : '>= 0.33.0',
+  meson_version : '>= 0.35.0',
   default_options : [ 'warning_level=1',
                       'c_std=c99',
                       'buildtype=debugoptimized' ])
index 06d3fd6..264be93 100644 (file)
@@ -4,106 +4,108 @@ have_parse = true # FIXME
 
 # tests and condition when to skip the test
 core_tests = [
-  [ 'gst/gst', not have_registry ],
-  [ 'gst/gstabi', not have_registry ],
-  [ 'gst/gstatomicqueue' ],
-  [ 'gst/gstbuffer' ],
-  [ 'gst/gstbufferlist' ],
-  [ 'gst/gstbufferpool' ],
-  [ 'gst/gstchildproxy', not have_registry ],
-  [ 'gst/gstclock' ],
-  [ 'gst/gstcontext' ],
-  [ 'gst/gstcontroller' ],
-  [ 'gst/gstcaps' ],
-  [ 'gst/gstcapsfeatures' ],
-  [ 'gst/gstdatetime' ],
-  [ 'gst/gstdevice' ],
-  [ 'gst/gstelement', not have_registry ],
-  [ 'gst/gstelementfactory', not have_registry ],
-  [ 'gst/gstghostpad', not have_registry ],
-  [ 'gst/gstinfo' ],
-  [ 'gst/gstiterator' ],
-  [ 'gst/gstmessage' ],
-  [ 'gst/gstmemory' ],
-  [ 'gst/gstmeta' ],
-  [ 'gst/gstminiobject' ],
-  [ 'gst/gstobject' ],
-  [ 'gst/gstpad', not have_registry ],
-  [ 'gst/gstparamspecs' ],
-  [ 'gst/gstprintf', not have_debug ],
-  [ 'gst/gstpipeline', not have_registry ],
-  [ 'gst/gstpoll' ],
-  [ 'gst/gstplugin', not have_registry ],
-  [ 'gst/gstpreset' ],
-  [ 'gst/gstprotection' ],
-  [ 'gst/gstquery', not have_registry ],
-  [ 'gst/gstregistry', not have_registry ],
-  [ 'gst/gstsegment' ],
-  [ 'gst/gststream' ],
-  [ 'gst/gststructure' ],
-  [ 'gst/gstsystemclock' ],
-  [ 'gst/gsttag' ],
-  [ 'gst/gsttagsetter' ],
-  [ 'gst/gsttask' ],
-  [ 'gst/gsttoc' ],
-  [ 'gst/gsttocsetter' ],
-  [ 'gst/gsttracerrecord' ],
-  [ 'gst/gsturi' ],
-  [ 'gst/gstutils', not have_registry ],
-  [ 'gst/gstvalue' ],
-  [ 'generic/states', not have_registry ],
-  [ 'libs/adapter' ],
-  [ 'libs/baseparse' ],
-  [ 'libs/basesrc', not have_registry ],
-  [ 'libs/basesink', not have_registry ],
-  [ 'libs/bitreader' ],
-  [ 'libs/bytereader' ],
-  [ 'libs/bytewriter' ],
-  [ 'libs/bitreader-noinline' ],
-  [ 'libs/bytereader-noinline' ],
-  [ 'libs/bytewriter-noinline' ],
-  [ 'libs/collectpads', not have_registry ],
-  [ 'libs/controller' ],
-  [ 'libs/flowcombiner' ],
-  [ 'libs/gstharness' ],
-  [ 'libs/gstnetclientclock' ],
-  [ 'libs/gstnettimeprovider' ],
-  [ 'libs/gsttestclock' ],
-  [ 'libs/libsabi' ],
-  [ 'libs/sparsefile' ],
-  [ 'libs/transform1' ],
-  [ 'libs/transform2' ],
-  [ 'libs/typefindhelper' ],
-  [ 'libs/queuearray' ],
-  [ 'elements/capsfilter', not have_registry ],
-  [ 'elements/concat', not have_registry ],
-  [ 'elements/fakesrc', not have_registry ],
-  [ 'elements/fdsrc', not have_registry ],
-  [ 'elements/filesink', not have_registry ],
-  [ 'elements/filesrc', not have_registry ],
-  [ 'elements/funnel', not have_registry ],
-  [ 'elements/identity', not have_registry ],
-  [ 'elements/multiqueue', not have_registry ],
-  [ 'elements/selector', not have_registry ],
-  [ 'elements/streamiddemux', not have_registry ],
-  [ 'elements/tee', not have_registry ],
-  [ 'elements/queue', not have_registry ],
-  [ 'elements/queue2', not have_registry ],
-  [ 'elements/valve', not have_registry ],
-  [ 'pipelines/seek', not have_registry ],
-  [ 'pipelines/queue-error', not have_registry ],
-  [ 'pipelines/parse-disabled', have_parse ],
-  [ 'pipelines/simple-launch-lines', not have_parse ],
-  [ 'pipelines/parse-launch', not have_parse ],
-  [ 'pipelines/cleanup', not have_parse ],
-  [ 'tools/gstinspect' ],
+  [ 'gst/gst.c', not have_registry ],
+  [ 'gst/gstabi.c', not have_registry ],
+  [ 'gst/gstatomicqueue.c' ],
+  [ 'gst/gstbuffer.c' ],
+  [ 'gst/gstbufferlist.c' ],
+  [ 'gst/gstbufferpool.c' ],
+  [ 'gst/gstchildproxy.c', not have_registry ],
+  [ 'gst/gstclock.c' ],
+  [ 'gst/gstcontext.c' ],
+  [ 'gst/gstcontroller.c' ],
+  [ 'gst/gstcaps.c' ],
+  [ 'gst/gstcapsfeatures.c' ],
+  [ 'gst/gstdatetime.c' ],
+  [ 'gst/gstdevice.c' ],
+  [ 'gst/gstelement.c', not have_registry ],
+  [ 'gst/gstelementfactory.c', not have_registry ],
+  [ 'gst/gstghostpad.c', not have_registry ],
+  [ 'gst/gstinfo.c' ],
+  [ 'gst/gstiterator.c' ],
+  [ 'gst/gstmessage.c' ],
+  [ 'gst/gstmemory.c' ],
+  [ 'gst/gstmeta.c' ],
+  [ 'gst/gstminiobject.c' ],
+  [ 'gst/gstobject.c' ],
+  [ 'gst/gstpad.c', not have_registry ],
+  [ 'gst/gstparamspecs.c' ],
+  [ 'gst/gstprintf.c', not have_debug ],
+  [ 'gst/gstpipeline.c', not have_registry ],
+  [ 'gst/gstpoll.c' ],
+  [ 'gst/gstplugin.c', not have_registry ],
+  [ 'gst/gstpreset.c' ],
+  [ 'gst/gstprotection.c' ],
+  [ 'gst/gstquery.c', not have_registry ],
+  [ 'gst/gstregistry.c', not have_registry ],
+  [ 'gst/gstsegment.c' ],
+  [ 'gst/gststream.c' ],
+  [ 'gst/gststructure.c' ],
+  [ 'gst/gstsystemclock.c' ],
+  [ 'gst/gsttag.c' ],
+  [ 'gst/gsttagsetter.c' ],
+  [ 'gst/gsttask.c' ],
+  [ 'gst/gsttoc.c' ],
+  [ 'gst/gsttocsetter.c' ],
+  [ 'gst/gsttracerrecord.c' ],
+  [ 'gst/gsturi.c' ],
+  [ 'gst/gstutils.c', not have_registry ],
+  [ 'gst/gstvalue.c' ],
+  [ 'generic/states.c', not have_registry ],
+  [ 'libs/adapter.c' ],
+  [ 'libs/baseparse.c' ],
+  [ 'libs/basesrc.c', not have_registry ],
+  [ 'libs/basesink.c', not have_registry ],
+  [ 'libs/bitreader.c' ],
+  [ 'libs/bytereader.c' ],
+  [ 'libs/bytewriter.c' ],
+  [ 'libs/bitreader-noinline.c' ],
+  [ 'libs/bytereader-noinline.c' ],
+  [ 'libs/bytewriter-noinline.c' ],
+  [ 'libs/collectpads.c', not have_registry ],
+  [ 'libs/controller.c' ],
+  [ 'libs/flowcombiner.c' ],
+  [ 'libs/gstharness.c' ],
+  [ 'libs/gstnetclientclock.c' ],
+  [ 'libs/gstnettimeprovider.c' ],
+  [ 'libs/gsttestclock.c' ],
+  [ 'libs/libsabi.c' ],
+  [ 'libs/sparsefile.c' ],
+  [ 'libs/transform1.c' ],
+  [ 'libs/transform2.c' ],
+  [ 'libs/typefindhelper.c' ],
+  [ 'libs/queuearray.c' ],
+  [ 'elements/capsfilter.c', not have_registry ],
+  [ 'elements/concat.c', not have_registry ],
+  [ 'elements/fakesrc.c', not have_registry ],
+  [ 'elements/fdsrc.c', not have_registry ],
+  [ 'elements/filesink.c', not have_registry ],
+  [ 'elements/filesrc.c', not have_registry ],
+  [ 'elements/funnel.c', not have_registry ],
+  [ 'elements/identity.c', not have_registry ],
+  [ 'elements/multiqueue.c', not have_registry ],
+  [ 'elements/selector.c', not have_registry ],
+  [ 'elements/streamiddemux.c', not have_registry ],
+  [ 'elements/tee.c', not have_registry ],
+  [ 'elements/queue.c', not have_registry ],
+  [ 'elements/queue2.c', not have_registry ],
+  [ 'elements/valve.c', not have_registry ],
+  [ 'pipelines/seek.c', not have_registry ],
+  [ 'pipelines/queue-error.c', not have_registry ],
+  [ 'pipelines/parse-disabled.c', have_parse ],
+  [ 'pipelines/simple-launch-lines.c', not have_parse ],
+  [ 'pipelines/parse-launch.c', not have_parse ],
+  [ 'pipelines/cleanup.c', not have_parse ],
+  [ 'tools/gstinspect.c' ],
   # These take quite long, put them at the end
-  [ 'elements/fakesink', not have_registry ],
-  [ 'gst/gstbin', not have_registry ],
-  [ 'gst/gstbus', not have_registry ],
-  [ 'gst/gstevent', not have_registry ],
-  [ 'pipelines/stress', not have_registry ],
-  [ 'generic/sinks', not have_registry ],
+  [ 'elements/fakesink.c', not have_registry ],
+  [ 'gst/gstbin.c', not have_registry ],
+  [ 'gst/gstbus.c', not have_registry ],
+  [ 'gst/gstevent.c', not have_registry ],
+  [ 'pipelines/stress.c', not have_registry ],
+  [ 'generic/sinks.c', not have_registry ],
+  [ 'gst/gstcpp.cc', not have_registry ],
+  [ 'libs/gstlibscpp.cc', false ],
 ]
 
 test_defines = [
@@ -114,47 +116,34 @@ test_defines = [
   '-DGST_USE_UNSTABLE_API',
 ]
 
-test_env = [
-  'GST_PLUGIN_SYSTEM_PATH_1_0=',
-  'GST_PLUGIN_PATH_1_0=' + meson.build_root() + '/plugins',
-  'GST_PLUGIN_SCANNER_1_0='+ meson.build_root() + '/libs/gst/helpers/gst-plugin-scanner',
-  'GST_STATE_IGNORE_ELEMENTS=',
-  'CK_DEFAULT_TIMEOUT=20',
-]
-
 glib_deps = [gio_dep, gobject_dep, gmodule_dep, glib_dep]
 gst_deps = [gst_dep, gst_base_dep, gst_check_dep, gst_net_dep, gst_controller_dep]
 
 foreach t : core_tests
-  test_name = t.get(0)
+  fname = t.get(0)
+  test_name = fname.split('.').get(0)
   if t.length() == 2
     skip_test = t.get(1)
   else
     skip_test = false
   endif
   if not skip_test
-    exe = executable(test_name, '@0@.c'.format(test_name),
-      c_args : gst_c_args + test_defines,
-      include_directories : [configinc],
-      dependencies : glib_deps + gst_deps,
+    exe = executable(test_name, fname,
+        c_args : gst_c_args + test_defines,
+        cpp_args : gst_c_args + test_defines,
+        include_directories : [configinc],
+        dependencies : glib_deps + gst_deps,
     )
-    test(test_name, exe,
-      env: test_env + ['GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name)],
-      timeout : 3 * 60
-    )
-  endif
-endforeach
 
-if have_registry
-  test('gstcpp', executable('gstcpp', 'gst/gstcpp.cc',
-    cpp_args : gst_c_args + test_defines,
-    include_directories : [configinc],
-    dependencies : glib_deps + gst_deps),
-    env: test_env + ['GST_REGISTRY=@0@/gstcpp.registry'.format(meson.current_build_dir())])
-endif
+    env = environment()
+    env.set('GST_PLUGIN_PATH_1_0', meson.build_root())
+    env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
+    env.set('GST_STATE_IGNORE_ELEMENTS', '')
+    env.set('CK_DEFAULT_TIMEOUT', '20')
+    env.set('GST_REGISTRY', '@0@/@1@.registry'.format(meson.current_build_dir(), test_name))
+    env.set('GST_PLUGIN_SCANNER_1_0', gst_scanner_dir + '/gst-plugin-scanner')
+    env.set('GST_PLUGIN_LOADING_WHITELIST', 'gstreamer')
 
-test('gstlibscpp', executable('gstlibscpp', 'libs/gstlibscpp.cc',
-    cpp_args : gst_c_args,
-    include_directories : [configinc],
-    dependencies : glib_deps + gst_deps),
-    env: test_env + ['GST_REGISTRY=@0@/gstlibscpp.registry'.format(meson.current_build_dir())])
+    test(test_name, exe, env: env, timeout : 3 * 60)
+  endif
+endforeach