test: (ls snapaid.sh mksnapidx.awk fixtures/*) | entr sh -c 'set -e; awk -f mksnapidx.awk -v DO_TESTS=1; export SNAPAID_SH=source; . ./snapaid.sh; for i in fixtures/*.txt; do minimizeemail < "$$i" | awk -f mksnapidx.awk > "$${i%.txt}".test.out; if ! cmp "$${i%.txt}".test.out "$${i%txt}snapidx.out"; then diff -u "$${i%.txt}".test.out "$${i%txt}snapidx.out"; exit 1; else echo "$$i ok"; fi; done; awk "{ print \$$9 }" fixtures/*.test.out | grep -v ^https' # snapaid.sh test is a bit slow. Make it's own special target. all-tests: (ls snapaid.sh mksnapidx.awk fixtures/*) | entr sh -c 'set -e; awk -f mksnapidx.awk -v DO_TESTS=1; bash snapaid.sh test; export SNAPAID_SH=source; . ./snapaid.sh; for i in fixtures/*.txt; do minimizeemail < "$$i" | awk -f mksnapidx.awk > "$${i%.txt}".test.out; if ! cmp "$${i%.txt}".test.out "$${i%txt}snapidx.out"; then diff -u "$${i%.txt}".test.out "$${i%txt}snapidx.out"; exit 1; else echo "$$i ok"; fi; done; awk "{ print \$$9 }" fixtures/*.test.out | grep -v ^https' # example: make test-file FNAME=fixtures/11.4-stable.txt test-file: (ls mksnapidx.awk $(FNAME) ) | entr sh -c 'set -e; export SNAPAID_SH=source; . ./snapaid.sh; for i in $(FNAME); do minimizeemail < "$$i" | awk -f mksnapidx.awk > "$${i%.txt}".test.out; if ! cmp "$${i%.txt}".test.out "$${i%txt}snapidx.out"; then diff -u "$${i%.txt}".test.out "$${i%txt}snapidx.out"; exit 1; else echo "$$i ok"; fi; done'