aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_all_formats.sh
blob: 6da27afbbda63ebf1c704c280811df487c137126 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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