From 23117379bc7cf8d4af2229417ab608903c5cc468 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sat, 13 Apr 2019 12:13:48 +0530 Subject: [PATCH] meson: Fix test failures on the CI around nunit-runner environment().prepend() does not stack. None of the operations on that object stack. This is documented in the Meson reference manual. Also avoid overriding previously-set operations because that will cause a warning in a future version of Meson. Also, we do not need to manually construct MONO_PATH values. We can pass an array and have Meson construct it for us. --- Tests/meson.build | 17 ++++++++++++++--- meson.build | 17 +++++++---------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Tests/meson.build b/Tests/meson.build index 129bd34eba..a7052bcf7a 100644 --- a/Tests/meson.build +++ b/Tests/meson.build @@ -1,6 +1,10 @@ nunit_console = find_program('nunit-console', 'nunitlite-runner', required: get_option('tests')) if nunit_console.found() + nunit_tests_env = environment() + # FIXME: port this to macOS and Windows + nunit_tests_env.prepend('LD_LIBRARY_PATH', testsenv_ld_library_path) + nunit_version = '3.10.1' get_nunit_res = run_command(nuget, 'get', '--builddir=NUnit', @@ -12,20 +16,27 @@ if nunit_console.found() ) + nunit_mono_path = [] nunit_dep = dependency('mono-nunit', required: false, version: ['>=2.6', '< 2.7']) if not nunit_dep.found() if get_nunit_res.returncode() != 0 message('Failed to get NUnit: ' + get_nunit_res.stderr()) else foreach path: get_nunit_res.stdout().split() - testsenv.prepend('MONO_PATH', - join_paths(meson.build_root(), path.strip('-r:'), '..')) + nunit_mono_path += [join_paths(meson.build_root(), path.strip('-r:'), '..')] endforeach nunit_dep = declare_dependency(link_args: get_nunit_res.stdout().split(), version: nunit_version) endif endif + + if nunit_mono_path.length() > 0 + nunit_tests_env.prepend('MONO_PATH', nunit_mono_path + mono_path) + else + nunit_tests_env.prepend('MONO_PATH', mono_path) + endif + if nunit_dep.found() foreach test: [ # 'PipelineTests', @@ -34,7 +45,7 @@ if nunit_console.found() lib = shared_library(test, test + '.cs', 'TestBase.cs', cs_args: ['-nowarn:169', '-nowarn:108', '-nowarn:114'], dependencies: [gst_sharp_dep, nunit_dep]) - test(test, nunit_console, args: [lib.full_path()], env: testsenv) + test(test, nunit_console, args: [lib.full_path()], env: nunit_tests_env) endforeach endif else diff --git a/meson.build b/meson.build index 53960fa023..9d4b763760 100644 --- a/meson.build +++ b/meson.build @@ -41,13 +41,7 @@ else required: false) endif -if host_machine.system() == 'windows' - pathsep = ';' -else - pathsep = ':' -endif -mono_path = gtk_sharp.get_variable('mono_path') + pathsep -mono_path += pathsep + join_paths(meson.current_build_dir(), 'sources') +mono_path = [gtk_sharp.get_variable('mono_path'), join_paths(meson.current_build_dir(), 'sources')] codegen_dependencies = [gapi_codegen, gapi_fixup, glib_sharp, gio_sharp] gapi_fixup = gapi_fixup.full_path() @@ -95,15 +89,16 @@ if ges_dep.found() gst_deps_defs += [ ['gst-editing-services', ['gst-editing-services', 'ges_dep'], 'libges'], ] - mono_path += pathsep + join_paths(meson.current_build_dir(), 'ges') + mono_path += [join_paths(meson.current_build_dir(), 'ges')] endif testsenv = environment() testsenv.prepend('MONO_PATH', mono_path) i = 0 +testsenv_ld_library_path = [] foreach dep: gst_deps + [ges_dep] if dep.type_name() == 'pkgconfig' - testsenv.prepend('LD_LIBRARY_PATH', dep.get_pkgconfig_variable('libdir')) + testsenv_ld_library_path += [dep.get_pkgconfig_variable('libdir')] else depdef = gst_deps_defs[i][1] libname = gst_deps_defs[i].get(2, '') @@ -118,11 +113,13 @@ foreach dep: gst_deps + [ges_dep] endif j += 1 endforeach - testsenv.prepend('LD_LIBRARY_PATH', dirname) + testsenv_ld_library_path += [dirname] endif endif i += 1 endforeach +# FIXME: port this to macOS and Windows +testsenv.prepend('LD_LIBRARY_PATH', testsenv_ld_library_path) subdir('sources') if ges_dep.found()