Add a script for doing very rudimentary regression testing

This is expected to fail if the encoder is updated in a way
that changes its output; in such cases, the test references need
to be updated.
This commit is contained in:
Martin Storsjo 2023-10-06 14:47:49 +03:00
parent 8e8b7a92b8
commit 3d67acd6f2
4 changed files with 33 additions and 0 deletions

View File

@ -300,5 +300,6 @@ EXTRA_DIST = \
$(top_srcdir)/METADATA \
$(top_srcdir)/PREUPLOAD.cfg \
$(top_srcdir)/sha1.h \
$(top_srcdir)/test/* \
$(top_srcdir)/win32/*.h

2
test/ref-mono.txt Normal file
View File

@ -0,0 +1,2 @@
encode hash: 516e51016cbba6068f1aa285a8fdd55b00ada6b0
decode hash: 3b3b3a17cc5ba50ade75b3ef1a37f96017935fe5

2
test/ref-stereo.txt Normal file
View File

@ -0,0 +1,2 @@
encode hash: 1179940ca3a5c62de45b6823efbdbe42fce11de2
decode hash: 85f2a154b46cc6cfa2792ff95c67b4200ce4463b

28
test/run-test.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
set -e
set -o pipefail
if [ ! -f Sample01_4.wav ]; then
curl -LO https://media.xiph.org/audio/HA_2011/Sample01_4.wav
fi
if [ "$(md5sum Sample01_4.wav | awk '{print $1}')" != "a5c105544c64ce92c6c5c06d280e6b9c" ]; then
echo Incorrect checksum for Sample01_4.wav
exit 1
fi
if [ ! -f Sample01_4-mono.wav ]; then
ffmpeg -i Sample01_4.wav -ac 1 -fflags +bitexact -y Sample01_4-mono.wav
fi
if [ "$(md5sum Sample01_4-mono.wav | awk '{print $1}')" != "3bfccac9f2e527ba3ef888874f09a409" ]; then
echo Incorrect checksum for Sample01_4-mono.wav
exit 1
fi
./test-encode-decode Sample01_4.wav | tee log-stereo.txt
./test-encode-decode Sample01_4-mono.wav | tee log-mono.txt
diff -u log-stereo.txt $(dirname $0)/ref-stereo.txt
diff -u log-mono.txt $(dirname $0)/ref-mono.txt