Add FATE tests
[ffmpeg.git] / tests / fate-update.sh
1 #! /bin/sh
2
3 set -e
4
5 base=$(dirname $0)
6 ref="${base}/ref/fate"
7
8 FATE_DB_URL="http://fate.multimedia.cx/fate-tests.sqlite.bz2"
9 FATE_DB=$(mktemp fate-db.XXXXXX)
10 SQL_TESTS='SELECT id,short_name,command FROM test_spec WHERE active=1 ORDER BY short_name'
11
12 do_sql(){
13     sqlite3 -noheader -separator ' ' "$FATE_DB" "$@"
14 }
15
16 wget -q -O - "$FATE_DB_URL" | bunzip2 > "$FATE_DB"
17 rm -rf "$ref"
18 mkdir -p "$ref"
19 exec 3>"$base/fate.mak"
20
21 do_sql "$SQL_TESTS" | while read id name command; do
22     case "$name" in
23         00-full-regression|ffmpeg-help|binsize-*) continue ;;
24     esac
25     case "$command" in
26         {MD5}*) command="${command#\{MD5\}} | do_md5sum | cut -c-32" ;;
27         {*}*)   continue ;;
28     esac
29     command=$(echo "$command" | sed 's/\$/$$/g')
30     do_sql "SELECT expected_stdout FROM test_spec WHERE id=$id" | awk '/./{print}' > "$ref/$name"
31     printf "FATE_TESTS += fate-${name}\n" >&3
32     printf "fate-${name}: CMD = %s\n" "$command" >&3
33 done
34
35 exec 3<&-
36 rm -f "$FATE_DB"