A utility for downloading and verifying FreeBSD releases and snapshots
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

11 lines
2.0 KiB

  1. test:
  2. (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 awk '"'"'function max(a, b) { if (a > b) return a; else return b; } function gendiff(a, b) { cnt = split(a, partsa); cntb = split(b, partsb); cnt = max(cnt, cntb); sep=""; print(NR " " a); printf("%s", NR " "); for (i = 1; i <= cnt; i++) { if (partsa[i] != partsb[i]) { v = partsa[i]; gsub(/./, "X", v); printf("%s%s", sep, v); } else { l = length(partsa[i]); printf("%s%*s", sep, l, "") }; sep=" "; }; print ""; print(NR " " b) } { getline orig < INP; if (orig != $$0) { diffcnt += 1; gendiff(orig, $$0) }} END { print "diff count: " diffcnt }'"'"' INP="$${i%txt}snapidx.out" "$${i%.txt}".test.out; echo base file: "$${i%txt}snapidx.out" ; exit 1; else echo "$$i ok"; fi; done; awk "{ print \$$9 }" fixtures/*.test.out | grep -v ^https'
  3. # snapaid.sh test is a bit slow. Make it's own special target.
  4. all-tests:
  5. (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'
  6. # example: make test-file FNAME=fixtures/11.4-stable.txt
  7. test-file:
  8. (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'