#!/bin/sh # Basic integration test for mkups set -e mkups=mkups if [ -n "$1" ]; then mkups="$1" fi gethash() { sha256sum "$1" | awk '{ print $1 }' } t="$(mktemp -d)" trap 'rm -rf "$t"' EXIT echo "snowy landscape" > "$t/input" echo "sleet snowscape" > "$t/patched" $mkups create "$t/input" "$t/patched" > "$t/test.ups" actual_hash="$(gethash "$t/test.ups")" expected_hash="97b0aef051cc7f72df767f79a66d61482995bcb07a50a3f661f04ebcfa37f74e" if [ "$actual_hash" != "$expected_hash" ]; then echo "mkups create: incorrect .ups file generated (got sha256=$actual_hash):" xxd "$t/test.ups" exit 1 fi echo "Create OK" $mkups apply "$t/input" "$t/test.ups" > "$t/patched2" if [ "$(gethash "$t/patched")" != "$(gethash "$t/patched2")" ]; then echo "mkups apply: incorrect output file generated:" xxd "$t/patched2" exit 1 fi echo "Apply OK" $mkups show "$t/test.ups" > /dev/null echo "Show OK" echo "GIANT DUCK passed"