File: run_test_env.sh

package info (click to toggle)
gimp 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 222,880 kB
  • sloc: ansic: 870,914; python: 10,965; lisp: 10,857; cpp: 7,355; perl: 4,536; sh: 1,753; xml: 972; yacc: 609; lex: 348; javascript: 150; makefile: 42
file content (43 lines) | stat: -rw-r--r-- 1,507 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
#
# Wrapper script to use for the Meson test setup.
#
# Define the "UI_TEST" for all tests that should run headless

if [ -n "${UI_TEST}" ]; then
  # Use Xvfb to simulate a graphical session; note that this needs
  # a new enough version which has the -d option.
  #
  # Also use dbus-run-session to make sure parallel tests aren't failing
  # as they simultaneously try to own the "org.gimp.GIMP.UI" D-Bus name

  # This is weird but basically on a Debian testing/bookworm, apparently
  # the --auto-display (neither the short version -d) option does not
  # exist and ends up in error:
  # > xvfb-run: unrecognized option '--auto-display'
  # There only --auto-servernum works fine.
  #
  # On a recent Fedora (33 in my case), the later exists but a few of
  # the tests fail with some weirder:
  # > /usr/bin/xvfb-run: line 186: kill: (53539) - No such process
  # There using --auto-display instead (supposed to deprecate
  # --auto-servernum) works instead, but only in its short form (-d).
  # The long form --auto-display also results in the "unrecognized
  # option" error even though the help output lists it.
  # Yep it's a huge mess.
  xvfb-run 2>&1|grep --quiet auto-display
  HAS_AUTO_DISPLAY="$?"
  if [ "$HAS_AUTO_DISPLAY" -eq 0 ]; then
    OPT="-d"
  else
    OPT="--auto-servernum"
  fi
  xvfb-run $OPT --server-args="-screen 0 1280x1024x24" \
    dbus-run-session -- "$@"

else
  # Run the executable directly,
  # i.e. no need to run Xvfb (which will have a timeout)

  "$@"
fi