#!/bin/sh
set -ex
# dep8 setting test for mystiq
# Author: Pablo Mestre
#
# This very simple test just checks that the binary starts at all.
#

# Use the virtual framebuffer to wrap mystiq, otherwise it would fail to start.
# Run in background, otherwise the prompt would be reserved forever.
xvfb-run mystiq > output.txt 2>&1 &

# Wait for program to run a bit
sleep 5

echo "Test that output.txt contains expected string..."
if ! grep --quiet "Reading preset file" output.txt
then
  echo "ERROR: Output did not contain expected string!"

  # Print out process list to debug on failure using tool from package psmisc
  pstree

  cat output.txt

  # Explicitly exit with failure to ensure autopkgtest sees this test failed
  exit 1
fi

# Shutdown
killall mystiq
