commit 611dffe81628683ebd2b48ae6f02f9bff6081ee9 from: Omar Polo date: Tue Jun 13 10:59:50 2023 UTC remove regress/sha we can use cmp to tell if two files are different, which also has the benefit of being available everywhere and reporting the byte offset of the first difference. Reduces the test dependencies on some systems. commit - 1b9031f1fccde6f61363328c6efebf045dd97dec commit + 611dffe81628683ebd2b48ae6f02f9bff6081ee9 blob - 3d6c516a2ec48ced96f74b8d55ac85c4551d4582 blob + 78270cab948ad5bdf15fc35b53ad49e4e0640dfd --- ChangeLog +++ ChangeLog @@ -1,3 +1,7 @@ +2023-06-13 Omar Polo + + * regress/sha: remove regress/sha; sha256/sha256sum is no more required for the regress suite. + 2022-09-10 Omar Polo * parse.y (string): retire the deprecated `mime' and `map' config options blob - a40d9c266382f89e4c6afc0c9dc3e47053e6e1ec blob + 2e09681657abee2968ee371bebaf94ea13296635 --- regress/Makefile +++ regress/Makefile @@ -16,7 +16,6 @@ DISTFILES = Makefile \ puny-test.c \ regress \ serve-bigfile \ - sha \ slow \ tests.sh \ valid.ext @@ -96,9 +95,7 @@ clean: testdata: fill-file mkdir testdata ./fill-file testdata/bigfile - ./sha testdata/bigfile testdata/bigfile.sha printf "# hello world\n" > testdata/index.gmi - ./sha testdata/index.gmi testdata/index.gmi.sha cp hello slow err invalid serve-bigfile env testdata/ cp max-length-reply testdata mkdir testdata/dir @@ -111,4 +108,4 @@ dist: ${DISTFILES} mkdir -p ${DESTDIR}/ ${INSTALL} -m 0644 ${DISTFILES} ${DESTDIR}/ cd ${DESTDIR}/ && chmod +x env err hello invalid \ - max-length-reply regress sha slow + max-length-reply regress slow blob - 6fc6273a73d1e0b915c51d88657ef811d11b2fce (mode 755) blob + /dev/null --- regress/sha +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# USAGE: ./sha in out -# writes the sha256 of in to file out - -if command -v sha256 >/dev/null; then - exec sha256 < "$1" > "$2" -fi - -if command -v sha256sum >/dev/null; then - sha256sum "$1" | awk '{print $1}' > "$2" - exit $? -fi - -echo "No sha binary found" -exit 1 blob - eb9b54f3eed539ff6e3d6cafe75dc91522848d4f blob + 5ebc33bdd15f4ea9e6c987995d6c00c0eb5ba344 --- regress/tests.sh +++ regress/tests.sh @@ -48,10 +48,20 @@ test_serve_big_files() { hdr="$(head /bigfile)" get /bigfile > bigfile - ./sha bigfile bigfile.sha - body="$(cat bigfile.sha)" - check_reply "20 application/octet-stream" "$(cat testdata/bigfile.sha)" + want="20 application/octet-stream" + if [ "$hdr" != "$want" ]; then + echo "Header mismatch" >&2 + echo "wants : $want" >&2 + echo "got : $hdr" >&2 + return 1 + fi + + if ! cmp -s bigfile testdata/bigfile; then + echo "received bigfile is not as expected" + cmp bigfile testdata/bigfile + return 1 + fi } test_dont_execute_scripts() {