Skip to content

Use /bin/sh instead of /bin/bash and respect environment variables set by users when running tests

Ting-Wei Lan requested to merge wip/lantw/use-sh-and-respect-env-var into master

FreeBSD doesn't install bash in /bin:

$ ninja test
[0/1] Running all tests.
1/2 regression                              OK       0.04 s 
Traceback (most recent call last):
  File "/home/lantw44/gnome/devinstall/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 127, in run
    return options.run_func(options)
  File "/home/lantw44/gnome/devinstall/lib/python3.6/site-packages/mesonbuild/mtest.py", line 1020, in run
    return th.doit()
  File "/home/lantw44/gnome/devinstall/lib/python3.6/site-packages/mesonbuild/mtest.py", line 780, in doit
    self.run_tests(tests)
  File "/home/lantw44/gnome/devinstall/lib/python3.6/site-packages/mesonbuild/mtest.py", line 930, in run_tests
    self.drain_futures(futures)
  File "/home/lantw44/gnome/devinstall/lib/python3.6/site-packages/mesonbuild/mtest.py", line 946, in drain_futures
    self.process_test_result(result.result())
  File "/usr/local/lib/python3.6/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/usr/local/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/lantw44/gnome/devinstall/lib/python3.6/site-packages/mesonbuild/mtest.py", line 483, in run
    return self._run_cmd(wrap + cmd + self.test.cmd_args + self.options.test_args)
  File "/home/lantw44/gnome/devinstall/lib/python3.6/site-packages/mesonbuild/mtest.py", line 538, in _run_cmd
    preexec_fn=preexec_fn if not is_windows() else None)
  File "/usr/local/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/usr/local/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/lantw44/gnome/build/gexiv2/test/python3-test': '/home/lantw44/gnome/build/gexiv2/test/python3-test'
FAILED: meson-test 
/home/lantw44/gnome/devinstall/bin/meson test --no-rebuild --print-errorlogs
ninja: build stopped: subcommand failed.

Many PATH-like environment variables are necessary for libraries and programs to work properly in JHBuild environment, so we should use prepend instead of setting them directly. For example, in JHBuild environment, libraries installed in JHBuild prefix are preferred to libraries shipped with the system. If existing value of LD_LIBRARY_PATH is ignored, it is possible for gexiv2 to link against GLib installed on the system instead of the version in JHBuild prefix, which may cause it to fail to run if the version installed on the system is too old.

Merge request reports