Remove check for the availability of the -u diff flag, we require it in
[ffmpeg.git] / tests / server-regression.sh
1 #!/bin/bash
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/test.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/test.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 tests/test.conf 2> /dev/null &
13 FFSERVER_PID=$!
14 sleep 2
15 echo "Waiting for feeds to startup..."
16 ./ffmpeg -loop_input -flags +bitexact -dct fastint -idct simple -y -f pgmyuv -i tests/vsynth1/%02d.pgm http://localhost:9999/feed1.ffm 2> /dev/null &
17 FFMPEG_PID=$!
18 sleep 5
19 (
20     cd tests/data || exit $?
21     rm -f ff-*;
22     WGET_OPTIONS="--user-agent=NSPlayer -q --proxy=off -e verbose=off -e server_response=off"
23     for file in $FILES; do
24         if [ `expr $file : "a-*"` != 0 ]; then
25             wget $WGET_OPTIONS --output-document=- http://localhost:9999/$file > ff-$file
26         else
27             wget $WGET_OPTIONS --output-document=- http://localhost:9999/$file?date=19700101T000000Z | dd bs=1 count=20000 > ff-$file 2>/dev/null
28         fi
29         MDFILES="$MDFILES ff-$file"
30     done
31     wait
32     # the status page is always different
33     md5sum $MDFILES > ffserver.regression
34 )
35 kill $FFMPEG_PID
36 kill $FFSERVER_PID
37 wait > /dev/null 2>&1
38 rm -f tests/feed1.ffm
39 if diff -u tests/data/ffserver.regression "$1" ; then
40     echo
41     echo Server regression test succeeded.
42     exit 0
43 else
44     echo
45     echo Server regression test: Error.
46     exit 1
47 fi