#!/usr/bin/env bash EXTRA_DUMP_ARGS="${EXTRA_DUMP_ARGS:-}" EMITTER_DUMP_ARGS="${EMITTER_DUMP_ARGS:---dump}" EMITTER_PARSE_ARGS="${EMITTER_PARSE_ARGS:---testsuite --disable-flow-markers}" if [ "x$1" = "x--streaming" ]; then EXTRA_DUMP_ARGS="$EXTRA_DUMP_ARGS --streaming" elif [ "x$1" = "x--restreaming" ]; then EXTRA_DUMP_ARGS="$EXTRA_DUMP_ARGS --streaming --recreating" fi count=0 for f in "${SRCDIR}"/emitter-examples/*.yaml; do count=`expr $count + 1` done # output plan echo 1..$count i=0 run_one() { f="$1" i=`expr $i + 1` tf=`basename "$f"` t1=`mktemp` t2=`mktemp` res="not ok" pass_parse=0 # Intentionally expand the argument variables as shell words. ${TOP_BUILDDIR}/src/fy-tool ${EMITTER_PARSE_ARGS} "$f" >"$t1" if [ $? -eq 0 ]; then ${TOP_BUILDDIR}/src/fy-tool ${EMITTER_DUMP_ARGS} ${EXTRA_DUMP_ARGS} "$f" | \ ${TOP_BUILDDIR}/src/fy-tool ${EMITTER_PARSE_ARGS} - >"$t2" if [ $? -eq 0 ]; then pass_parse=1 fi fi if [ "$pass_parse" = "1" ]; then diff -u "$t1" "$t2" if [ $? -eq 0 ]; then res="ok" else res="not ok" fi else res="not ok" fi rm -f "$t1" "$t2" echo "$res $i $tf" } for f in "${SRCDIR}"/emitter-examples/*.yaml; do run_one "$f" done