1#!/bin/sh23TESTRUNNER="$(pwd)/../cmd2yaml"45dir=${TMPDIR:-/tmp}/libmpdserver6trap "rm -rf '${dir}' 2>/dev/null" INT EXIT7mkdir -p "${dir}"89result=010for test in *; do11 [ -d "${test}" ] || continue1213 name=${test##*/}14 printf "Running test case '%s': " "${name}"1516 (cd "${test}" && "${TESTRUNNER}" <input >"${dir}/out.pre")17 ret=$?1819 test -r "${test}/output.yml"20 expected=$?2122 if [ ${ret} -ne ${expected} ]; then23 printf "FAIL: Expected '%d', got '%d'.\n" \24 "${expected}" "${ret}"2526 result=127 continue28 fi2930 sed 's/[ \t]*$//' < "${dir}/out.pre" > "${dir}/out"31 if [ ${ret} -eq 0 ] && ! cmp -s "${dir}/out" "${test}/output.yml"; then32 printf "FAIL: Output didn't match.\n"33 diff -u "${dir}/out" "${test}/output.yml"3435 result=136 continue37 fi3839 printf "OK.\n"40done4142exit "${result}"