Statistics
| Branch: | Revision:

ffmpeg / tests / server-regression.sh @ 8a01fc47

History | View | Annotate | Download (1.58 KB)

1
#!/bin/bash
2
# Even in the 21st century some diffs are not supporting -u.
3
diff -u $0 $0 > /dev/null 2>&1
4
if [ $? -eq 0 ]; then
5
  diff_cmd="diff -u"
6
else
7
  diff_cmd="diff"
8
fi
9
    
10
# Make sure that the data directory exists
11
mkdir -p data
12

    
13
cp "$2" data/test.conf
14
#perl -e 'chomp($wd = `pwd`); print map { s!data/!!; "<Stream $_>\nFile $wd/data/$_\n</Stream>\n\n" } @ARGV' data/a* >> data/test.conf
15
#perl -e 'chomp($wd = `pwd`); print map { s!data/!!; "<Stream $_.asf>\nFile $wd/data/$_\n</Stream>\n\n" } @ARGV' data/a* >> data/test.conf
16

    
17
FILES=`perl -n -e 'print \$1, "\n" if /<stream\\s+(\\S+)>/i' data/test.conf | sort`
18

    
19
rm -f /tmp/feed.ffm
20
../ffserver -d -f data/test.conf 2> /dev/null &
21
FFSERVER_PID=$!
22
echo "Waiting for feeds to startup..."
23
sleep 2
24
(
25
    cd data || exit $?
26
    rm -f ff-*;
27
    WGET_OPTIONS="--user-agent=NSPlayer -q --proxy=off -e verbose=off -e debug=off -e server_response=off"
28
    for file in $FILES; do
29
        if [ `expr match $file "a-*"` -ne 0 ]; then
30
            wget $WGET_OPTIONS --output-document=- http://localhost:9999/$file > ff-$file &
31
        else
32
            wget $WGET_OPTIONS --output-document=- http://localhost:9999/$file?date=19700101T000000Z | dd bs=1 count=100000 > ff-$file 2>/dev/null &
33
        fi
34
        MDFILES="$MDFILES ff-$file"
35
    done    
36
    wait
37
    # the status page is always different
38
    md5sum $MDFILES | grep -v html > ffserver.regression
39
)
40
kill $FFSERVER_PID
41
wait > /dev/null 2>&1
42
if $diff_cmd data/ffserver.regression $1 ; then
43
    echo 
44
    echo Server regression test succeeded.
45
    exit 0
46
else
47
    echo 
48
    echo Server regression test: Error.
49
    exit 1
50
fi