mirror of https://github.com/omar-polo/gmid.git
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.
This commit is contained in:
parent
1b9031f1fc
commit
611dffe816
|
@ -1,3 +1,7 @@
|
|||
2023-06-13 Omar Polo <op@omarpolo.com>
|
||||
|
||||
* regress/sha: remove regress/sha; sha256/sha256sum is no more required for the regress suite.
|
||||
|
||||
2022-09-10 Omar Polo <op@omarpolo.com>
|
||||
|
||||
* parse.y (string): retire the deprecated `mime' and `map' config options
|
||||
|
|
|
@ -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
|
||||
|
|
16
regress/sha
16
regress/sha
|
@ -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
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue