summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-09-12 15:26:31 +0300
committerVadim Yanitskiy <axilirator@gmail.com>2017-12-31 12:21:00 +0100
commitf069eb37fe48df4e6897d0614e008b676e06db8e (patch)
tree397fd2a82a1473decdc3291590f70bdf646127c8 /tests
parentf496a998e520c3ab99d09cf279e64b0b9e52318e (diff)
Init automake test environment
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am58
-rw-r--r--tests/common.sh13
-rwxr-xr-xtests/play_all_formats.sh14
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16bin0 -> 80000 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.amr-efrbin0 -> 8006 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.amr-efr.s16bin0 -> 80000 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.gsmbin0 -> 8250 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.gsm.s16bin0 -> 80000 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.racal-efrbin0 -> 7750 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.racal-efr.s16bin0 -> 80000 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.racal-frbin0 -> 8250 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.racal-fr.s16bin0 -> 80000 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.racal-hrbin0 -> 3500 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.racal-hr.s16bin0 -> 80000 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.rtp-efrbin0 -> 7750 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.rtp-efr.s16bin0 -> 80000 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.rtp-hr-etsibin0 -> 3500 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.rtp-hr-etsi.s16bin0 -> 80000 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.rtp-hr-ietfbin0 -> 3750 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.rtp-hr-ietf.s16bin0 -> 80000 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.ti-efrbin0 -> 8250 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.ti-efr.s16bin0 -> 80000 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.ti-frbin0 -> 8250 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.ti-fr.s16bin0 -> 80000 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.ti-hrbin0 -> 8250 bytes
-rw-r--r--tests/ref-files/hhgttg_part1_5.s16.ti-hr.s16bin0 -> 80000 bytes
-rwxr-xr-xtests/test_all_formats.sh62
-rw-r--r--tests/testsuite.at2
-rwxr-xr-xtests/update_ref_files.sh22
29 files changed, 171 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..940e350
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,58 @@
+AM_CPPFLAGS = \
+ $(all_includes) \
+ -I$(top_builddir) \
+ -I$(top_srcdir)/include \
+ $(NULL)
+
+AM_CFLAGS = \
+ -Wall \
+ $(LIBOSMOCORE_CFLAGS) \
+ $(LIBOSMOCODEC_CFLAGS) \
+ $(NULL)
+
+check_PROGRAMS = \
+ $(NULL)
+
+# The `:;' works around a Bash 3.2 bug when the output is not writeable.
+$(srcdir)/package.m4: $(top_srcdir)/configure.ac
+ :;{ \
+ echo '# Signature of the current package.' && \
+ echo 'm4_define([AT_PACKAGE_NAME],' && \
+ echo ' [$(PACKAGE_NAME)])' && \
+ echo 'm4_define([AT_PACKAGE_TARNAME],' && \
+ echo ' [$(PACKAGE_TARNAME)])' && \
+ echo 'm4_define([AT_PACKAGE_VERSION],' && \
+ echo ' [$(PACKAGE_VERSION)])' && \
+ echo 'm4_define([AT_PACKAGE_STRING],' && \
+ echo ' [$(PACKAGE_STRING)])' && \
+ echo 'm4_define([AT_PACKAGE_BUGREPORT],' && \
+ echo ' [$(PACKAGE_BUGREPORT)])'; \
+ echo 'm4_define([AT_PACKAGE_URL],' && \
+ echo ' [$(PACKAGE_URL)])'; \
+ } >'$(srcdir)/package.m4'
+
+EXTRA_DIST = \
+ testsuite.at \
+ $(TESTSUITE) \
+ $(srcdir)/package.m4 \
+ $(NULL)
+
+DISTCLEANFILES = atconfig
+TESTSUITE = $(srcdir)/testsuite
+
+check-local: atconfig $(TESTSUITE)
+ $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
+
+installcheck-local: atconfig $(TESTSUITE)
+ $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \
+ $(TESTSUITEFLAGS)
+
+clean-local:
+ test ! -f '$(TESTSUITE)' || \
+ $(SHELL) '$(TESTSUITE)' --clean
+
+AUTOM4TE = $(SHELL) $(top_srcdir)/missing --run autom4te
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4
+ $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
+ mv $@.tmp $@
diff --git a/tests/common.sh b/tests/common.sh
new file mode 100644
index 0000000..5fded94
--- /dev/null
+++ b/tests/common.sh
@@ -0,0 +1,13 @@
+# directory containing the reference files for comparing against
+REFDIR=./ref-files
+
+if [ -f ../src/osmo-gapk ]; then
+ GAPK=../src/osmo-gapk
+elif [ -f `which osmo-gapk` ]; then
+ GAPK=`which osmo-gapk`
+else
+ exit 1
+fi
+echo Using osmo-gapk found at $GAPK
+
+FORMATS="amr-efr gsm racal-hr racal-fr racal-efr ti-hr ti-fr ti-efr rtp-efr rtp-hr-etsi rtp-hr-ietf"
diff --git a/tests/play_all_formats.sh b/tests/play_all_formats.sh
new file mode 100755
index 0000000..5cebffb
--- /dev/null
+++ b/tests/play_all_formats.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+OUTDIR=/tmp
+INFILE=$1
+
+. ./common.sh
+
+for f in $FORMATS; do
+ BASE=`basename $INFILE`
+ PLAYFILE=$OUTDIR/$BASE.$f
+ echo
+ echo Format $f: Playing back $PLAYFILE
+ echo $GAPK -f $f -i $PLAYFILE -g rawpcm-s16le -A default
+ $GAPK -f $f -i $PLAYFILE -g rawpcm-s16le -A default
+done
diff --git a/tests/ref-files/hhgttg_part1_5.s16 b/tests/ref-files/hhgttg_part1_5.s16
new file mode 100644
index 0000000..80a594d
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.amr-efr b/tests/ref-files/hhgttg_part1_5.s16.amr-efr
new file mode 100644
index 0000000..00a11b0
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.amr-efr
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.amr-efr.s16 b/tests/ref-files/hhgttg_part1_5.s16.amr-efr.s16
new file mode 100644
index 0000000..829ed67
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.amr-efr.s16
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.gsm b/tests/ref-files/hhgttg_part1_5.s16.gsm
new file mode 100644
index 0000000..ad3cf8f
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.gsm
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.gsm.s16 b/tests/ref-files/hhgttg_part1_5.s16.gsm.s16
new file mode 100644
index 0000000..28aa317
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.gsm.s16
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.racal-efr b/tests/ref-files/hhgttg_part1_5.s16.racal-efr
new file mode 100644
index 0000000..b96be2e
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.racal-efr
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.racal-efr.s16 b/tests/ref-files/hhgttg_part1_5.s16.racal-efr.s16
new file mode 100644
index 0000000..829ed67
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.racal-efr.s16
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.racal-fr b/tests/ref-files/hhgttg_part1_5.s16.racal-fr
new file mode 100644
index 0000000..e0a5397
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.racal-fr
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.racal-fr.s16 b/tests/ref-files/hhgttg_part1_5.s16.racal-fr.s16
new file mode 100644
index 0000000..28aa317
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.racal-fr.s16
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.racal-hr b/tests/ref-files/hhgttg_part1_5.s16.racal-hr
new file mode 100644
index 0000000..95881af
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.racal-hr
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.racal-hr.s16 b/tests/ref-files/hhgttg_part1_5.s16.racal-hr.s16
new file mode 100644
index 0000000..27dfd5f
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.racal-hr.s16
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.rtp-efr b/tests/ref-files/hhgttg_part1_5.s16.rtp-efr
new file mode 100644
index 0000000..9e4615e
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.rtp-efr
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.rtp-efr.s16 b/tests/ref-files/hhgttg_part1_5.s16.rtp-efr.s16
new file mode 100644
index 0000000..829ed67
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.rtp-efr.s16
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.rtp-hr-etsi b/tests/ref-files/hhgttg_part1_5.s16.rtp-hr-etsi
new file mode 100644
index 0000000..9a145d3
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.rtp-hr-etsi
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.rtp-hr-etsi.s16 b/tests/ref-files/hhgttg_part1_5.s16.rtp-hr-etsi.s16
new file mode 100644
index 0000000..27dfd5f
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.rtp-hr-etsi.s16
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.rtp-hr-ietf b/tests/ref-files/hhgttg_part1_5.s16.rtp-hr-ietf
new file mode 100644
index 0000000..e956e9d
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.rtp-hr-ietf
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.rtp-hr-ietf.s16 b/tests/ref-files/hhgttg_part1_5.s16.rtp-hr-ietf.s16
new file mode 100644
index 0000000..27dfd5f
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.rtp-hr-ietf.s16
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.ti-efr b/tests/ref-files/hhgttg_part1_5.s16.ti-efr
new file mode 100644
index 0000000..9dd01ae
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.ti-efr
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.ti-efr.s16 b/tests/ref-files/hhgttg_part1_5.s16.ti-efr.s16
new file mode 100644
index 0000000..e8f759f
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.ti-efr.s16
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.ti-fr b/tests/ref-files/hhgttg_part1_5.s16.ti-fr
new file mode 100644
index 0000000..5bf4b83
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.ti-fr
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.ti-fr.s16 b/tests/ref-files/hhgttg_part1_5.s16.ti-fr.s16
new file mode 100644
index 0000000..28aa317
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.ti-fr.s16
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.ti-hr b/tests/ref-files/hhgttg_part1_5.s16.ti-hr
new file mode 100644
index 0000000..29a16bf
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.ti-hr
Binary files differ
diff --git a/tests/ref-files/hhgttg_part1_5.s16.ti-hr.s16 b/tests/ref-files/hhgttg_part1_5.s16.ti-hr.s16
new file mode 100644
index 0000000..27dfd5f
--- /dev/null
+++ b/tests/ref-files/hhgttg_part1_5.s16.ti-hr.s16
Binary files differ
diff --git a/tests/test_all_formats.sh b/tests/test_all_formats.sh
new file mode 100755
index 0000000..6da27af
--- /dev/null
+++ b/tests/test_all_formats.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+
+# This script generates test data for all formats by doing the
+# following:
+# * encode the user-specified PCM file into each format
+# * re-decode that format back to PCM
+#
+# Use this to generate test files that are to be shipped together with
+# gapk. Always use the
+
+
+# directory in which the temporary output is stored
+OUTDIR=/tmp
+
+# name of the input s16le file to use for encoding and re-decoding
+INFILE=$1
+
+# source some common parameters
+. ./common.sh
+
+RETVAL=0
+
+for f in $FORMATS; do
+ BASE=`basename $INFILE`
+ OUTFILE=$OUTDIR/$BASE.$f
+ echo Format $f: Encoding $INFILE to $OUTFILE
+ $GAPK -f rawpcm-s16le -i $INFILE -g $f -o $OUTFILE
+
+ # compare with reference
+ diff $OUTFILE $REFDIR/`basename $OUTFILE`
+ if [ $? -ne 0 ]; then
+ echo "===> FAIL"
+ RETVAL=1
+ else
+ echo "===> PASS"
+ fi
+ echo
+
+ DECFILE=$OUTFILE.s16
+ echo Format $f: Decoding $OUTFILE to $DECFILE
+ $GAPK -f $f -i $OUTFILE -g rawpcm-s16le -o $DECFILE
+
+ # compare with reference
+ diff $DECFILE $REFDIR/`basename $DECFILE`
+ if [ $? -ne 0 ]; then
+ echo "===> FAIL"
+ RETVAL=1
+ else
+ echo "===> PASS"
+ fi
+ echo
+done
+
+echo -n "Overall Verdict: "
+if [ $RETVAL -ne 0 ]; then
+ echo "FAIL"
+else
+ echo "PASS"
+fi
+
+exit $RETVAL
diff --git a/tests/testsuite.at b/tests/testsuite.at
new file mode 100644
index 0000000..09a77c3
--- /dev/null
+++ b/tests/testsuite.at
@@ -0,0 +1,2 @@
+AT_INIT
+AT_BANNER([Regression tests.])
diff --git a/tests/update_ref_files.sh b/tests/update_ref_files.sh
new file mode 100755
index 0000000..1d095ef
--- /dev/null
+++ b/tests/update_ref_files.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# This script re-generates the reference data shipped together with
+# gapk. To be used by gapk maintainers only.
+
+. ./common.sh
+
+INFILE=$1
+OUTDIR=$REFDIR
+
+
+for f in $FORMATS; do
+ BASE=`basename $INFILE`
+ OUTFILE=$OUTDIR/$BASE.$f
+ echo
+ echo Format $f: Encoding $INFILE to $OUTFILE
+ $GAPK -f rawpcm-s16le -i $INFILE -g $f -o $OUTFILE
+
+ DECFILE=$OUTFILE.s16
+ echo Format $f: Decoding $OUTFILE to $DECFILE
+ $GAPK -f $f -i $OUTFILE -g rawpcm-s16le -o $DECFILE
+done