[directory]
tests = ${:srv}/tests

[xserver]
display-num = 42
resolution = 1920x1080x24

[wmctrl]
recipe = slapos.cookbook:wrapper
command-line = {{ wmctrl_bin }}
wrapper-path = ${directory:bin}/wmctrl
environment =
  XORG_LOCK_DIR=${xserver:lock-dir}
  DISPLAY=${xserver:display}

[xdotool]
recipe = slapos.cookbook:wrapper
command-line = {{ xdotool_bin }}
wrapper-path = ${directory:bin}/xdotool
environment =
  XORG_LOCK_DIR=${xserver:lock-dir}
  DISPLAY=${xserver:display}

[runTestSuite]
env.sh  = ${beremiz-env.sh:output}
workdir = {{ nxdtest_dir }}

[beremiz-tests]
recipe = slapos.recipe.template
inline =
  #!/bin/sh -e
  cd {{ beremiz_location }}/tests
  make test_dir=${directory:tests} xserver_command='echo "Using ${xserver:display} on Slapos X Server !";' "$@"
output = ${directory:bin}/beremiztest

[sikulix]
recipe = slapos.cookbook:wrapper
command-line = {{ sikulix_bin }} -v
wrapper-path = ${directory:bin}/sikulix
environment =
  JAVA_TOOL_OPTIONS=-Duser.home=${buildout:directory} -Djava.io.tmpdir=${directory:tmp}

[libopencv_java430.so]
recipe = plone.recipe.command
opencv-link = ${buildout:directory}/.Sikulix/SikulixLibs/libopencv_java430.so
# We run sikulix with a random not existing projet so it will initialise all files
# and extract libopencv_java430.so from jar. We can then replace it with slapos
# compiled lib which solves GLIBC issues (version `GLIBC_2.27' not found).
command =
  LINK=${:opencv-link}
  if [ ! -e "$LINK" ]; then
    ${sikulix:wrapper-path} -r not_found_for_slapos.sikulix > /dev/null 2>&1 || true
  fi
  rm -f $LINK
  ln -sf {{ opencv_location }}/lib/libopencv_java430.so $LINK
update-command = ${:command}
stop-on-error = true

[buildout]
extends =
  {{ instance_nxdtest }}
  {{ instance_beremiz }}

parts +=
  sikulix
  wmctrl
  xdotool
  beremiz-tests
  runTestSuite
  libopencv_java430.so

eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
