Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (1.58 KB)

1 e2b2851e Philip Gladstone
#!/bin/bash
2 8c0ff5d5 Roman Shaposhnik
# 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 d746f928 Philip Gladstone
# Make sure that the data directory exists
11
mkdir -p data
12
13 8ff7d1ad Fabrice Bellard
cp "$2" data/test.conf
14 2853e85c Fabrice Bellard
#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 d746f928 Philip Gladstone
17 96cbe82c Philip Gladstone
FILES=`perl -n -e 'print \$1, "\n" if /<stream\\s+(\\S+)>/i' data/test.conf | sort`
18 e2b2851e Philip Gladstone
19
rm -f /tmp/feed.ffm
20 d746f928 Philip Gladstone
../ffserver -d -f data/test.conf 2> /dev/null &
21 e2b2851e Philip Gladstone
FFSERVER_PID=$!
22 d746f928 Philip Gladstone
echo "Waiting for feeds to startup..."
23
sleep 2
24 e2b2851e Philip Gladstone
(
25 d746f928 Philip Gladstone
    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 e2b2851e Philip Gladstone
    for file in $FILES; do
29 d746f928 Philip Gladstone
        if [ `expr match $file "a-*"` -ne 0 ]; then
30
            wget $WGET_OPTIONS --output-document=- http://localhost:9999/$file > ff-$file &
31
        else
32 8c0ff5d5 Roman Shaposhnik
            wget $WGET_OPTIONS --output-document=- http://localhost:9999/$file?date=19700101T000000Z | dd bs=1 count=100000 > ff-$file 2>/dev/null &
33 d746f928 Philip Gladstone
        fi
34
        MDFILES="$MDFILES ff-$file"
35 e2b2851e Philip Gladstone
    done    
36
    wait
37
    # the status page is always different
38 d746f928 Philip Gladstone
    md5sum $MDFILES | grep -v html > ffserver.regression
39 e2b2851e Philip Gladstone
)
40
kill $FFSERVER_PID
41
wait > /dev/null 2>&1
42 8c0ff5d5 Roman Shaposhnik
if $diff_cmd data/ffserver.regression $1 ; then
43 e2b2851e Philip Gladstone
    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