Skip to content

Commit

Permalink
Consistent indentation for btest-diff, no other changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ckreibich committed Oct 7, 2020
1 parent c223369 commit 01cffdd
Showing 1 changed file with 54 additions and 54 deletions.
108 changes: 54 additions & 54 deletions btest-diff
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ if [ "$TEST_DIAGNOSTICS" = "" ]; then
fi

if [ "$#" -lt 1 ]; then
echo "btest-diff: wrong number of arguments" >$TEST_DIAGNOSTICS
exit 1
echo "btest-diff: wrong number of arguments" >$TEST_DIAGNOSTICS
exit 1
fi

input=$1
canon=`echo $input | sed 's#/#.#g'`
shift

if [ ! -f $input ]; then
echo "btest-diff: input $input does not exist." >$TEST_DIAGNOSTICS
exit 1
echo "btest-diff: input $input does not exist." >$TEST_DIAGNOSTICS
exit 1
fi

tmpfiles=""
function delete_tmps {
rm -f $tmpfiles 2>/dev/null
rm -f $tmpfiles 2>/dev/null
}

trap delete_tmps 0
Expand All @@ -65,70 +65,70 @@ else
fi

if [ -e $TEST_BASELINE/$canon ]; then
error=0

if [ "$TEST_DIFF_CANONIFIER" != "" ]; then
diff1=/tmp/test-diff.$$.$canon.baseline.tmp
diff2=/tmp/test-diff.$$.$canon.tmp
tmpfiles="$tmpfiles $diff1 $diff2"

eval $TEST_DIFF_CANONIFIER $TEST_BASELINE/$canon <$TEST_BASELINE/$canon >$diff1
if [ $? -ne 0 ]; then
error=1
echo "== Error ==============================" >>$TEST_DIAGNOSTICS
echo "btest-diff: TEST_DIFF_CANONIFIER failed on file '$TEST_BASELINE/$canon'" >>$TEST_DIAGNOSTICS
result=1
fi

eval $TEST_DIFF_CANONIFIER $input <$input >$diff2
if [ $? -ne 0 ]; then
error=1
echo "== Error ==============================" >>$TEST_DIAGNOSTICS
echo "btest-diff: TEST_DIFF_CANONIFIER failed on file '$input'" >>$TEST_DIAGNOSTICS
result=1
fi
else
diff1=$TEST_BASELINE/$canon
diff2=$input
fi

if [ $error -eq 0 ]; then
echo "== Diff ===============================" >>$TEST_DIAGNOSTICS
diff -au $@ $diff1 $diff2 >>$TEST_DIAGNOSTICS
result=$?
fi
error=0

if [ "$TEST_DIFF_CANONIFIER" != "" ]; then
diff1=/tmp/test-diff.$$.$canon.baseline.tmp
diff2=/tmp/test-diff.$$.$canon.tmp
tmpfiles="$tmpfiles $diff1 $diff2"

eval $TEST_DIFF_CANONIFIER $TEST_BASELINE/$canon <$TEST_BASELINE/$canon >$diff1
if [ $? -ne 0 ]; then
error=1
echo "== Error ==============================" >>$TEST_DIAGNOSTICS
echo "btest-diff: TEST_DIFF_CANONIFIER failed on file '$TEST_BASELINE/$canon'" >>$TEST_DIAGNOSTICS
result=1
fi

eval $TEST_DIFF_CANONIFIER $input <$input >$diff2
if [ $? -ne 0 ]; then
error=1
echo "== Error ==============================" >>$TEST_DIAGNOSTICS
echo "btest-diff: TEST_DIFF_CANONIFIER failed on file '$input'" >>$TEST_DIAGNOSTICS
result=1
fi
else
diff1=$TEST_BASELINE/$canon
diff2=$input
fi

if [ $error -eq 0 ]; then
echo "== Diff ===============================" >>$TEST_DIAGNOSTICS
diff -au $@ $diff1 $diff2 >>$TEST_DIAGNOSTICS
result=$?
fi
else
echo "== Error ==============================" >>$TEST_DIAGNOSTICS
echo "test-diff: no baseline found." >>$TEST_DIAGNOSTICS
result=100
echo "== Error ==============================" >>$TEST_DIAGNOSTICS
echo "test-diff: no baseline found." >>$TEST_DIAGNOSTICS
result=100
fi

echo "=======================================" >>$TEST_DIAGNOSTICS

if [ "$TEST_MODE" == "TEST" ]; then
exit $result
exit $result

elif [ "$TEST_MODE" == "UPDATE_INTERACTIVE" ]; then

if [ "$result" == 0 ]; then
exit 0
fi
if [ "$result" == 0 ]; then
exit 0
fi

btest-ask-update
rc=$?
btest-ask-update
rc=$?

echo -n "$TEST_NAME ..." >/dev/tty
echo -n "$TEST_NAME ..." >/dev/tty

if [ $rc == 0 ]; then
cp $input $TEST_BASELINE/$canon
exit 0
fi
if [ $rc == 0 ]; then
cp $input $TEST_BASELINE/$canon
exit 0
fi

exit $rc
exit $rc

elif [ "$TEST_MODE" == "UPDATE" ]; then
cp $input $TEST_BASELINE/$canon
exit 0
cp $input $TEST_BASELINE/$canon
exit 0
fi

echo "test-diff: unknown test mode $TEST_MODE" >$TEST_DIAGNOSTICS
Expand Down

0 comments on commit 01cffdd

Please sign in to comment.