#!/bin/sh

set -e

# Test no action.

# the --no-action output contains full paths, so replace with reproducible placeholder
# We need to print the exit status of each command or otherwise one of them might
# fail without us noticing because they are run as part of a pipe.
{
  ret=0
  ${UCF_TEST_BINDIR}ucf --no-action input.conf $UCF_TEST_TARGET/input.conf 2>&1 || ret=$?
  echo "ucf exit: $ret"
  ret=0
  ${UCF_TEST_BINDIR}ucfr --no-action test-package $UCF_TEST_TARGET/input.conf 2>&1 || ret=$?
  echo "ucfr exit: $ret"
} | sed "s#\([ \"|]\)$(pwd)#\1.#g" \
  | sed "s#\([ \"]\)$DPKG_ROOT/var/lib/ucf/#\1{{ROOT}}/var/lib/ucf/#g" \
  | sed "s# $DPKG_ROOT/tmp/input.conf\$# {{ROOT}}/tmp/input.conf#g"
