a0a1ecf651ba2ea5bbd8157c28d36eddefbe13c5
[libav.git] / tests / server-regression.sh
1 #!/bin/sh
2
3 # Make sure that the data directory exists
4 mkdir -p tests/data
5
6 #perl -e 'chomp($wd = `pwd`); print map { s!tests/data/!!; "<Stream $_>\nFile $wd/tests/data/$_\n</Stream>\n\n" } @ARGV' tests/data/a* >> tests/data/ffserver.conf
7 #perl -e 'chomp($wd = `pwd`); print map { s!tests/data/!!; "<Stream $_.asf>\nFile $wd/tests/data/$_\n</Stream>\n\n" } @ARGV' tests/data/a* >> tests/data/ffserver.conf
8
9 FILES=`sed -n 's/^[^#]*<Stream \(.*\)>.*/\1/p' $2 | grep -v html`
10
11 rm -f tests/feed1.ffm
12 ./ffserver -d -f "$2" 2> /dev/null &
13 FFSERVER_PID=$!
14 echo "Waiting for feeds to startup..."
15 sleep 2
16 (
17 cd tests/data || exit $?
18 rm -f ff-*;
19 WGET_OPTIONS="--user-agent=NSPlayer -q --proxy=off -e verbose=off -e server_response=off"
20 for file in $FILES; do
21 if [ `expr $file : "a-*"` != 0 ]; then
22 wget $WGET_OPTIONS -O - http://localhost:9999/$file > ff-$file
23 else
24 wget $WGET_OPTIONS -O - http://localhost:9999/$file?date=19700101T000000Z | dd bs=1 count=20000 > ff-$file 2>/dev/null
25 fi
26 MDFILES="$MDFILES ff-$file"
27 done
28 wait
29 # the status page is always different
30 md5sum $MDFILES > ffserver.regression
31 )
32 kill $FFSERVER_PID
33 wait > /dev/null 2>&1
34 rm -f tests/feed1.ffm
35 if diff -u tests/data/ffserver.regression "$1" ; then
36 echo
37 echo Server regression test succeeded.
38 exit 0
39 else
40 echo
41 echo Server regression test: Error.
42 exit 1
43 fi