fate: use our variable names in test rules imported from Mike's db
[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 mkdir -p "$ref"
18 exec 3>"$base/fate.mak"
19
20 do_sql "$SQL_TESTS" | while read id name command; do
21     case "$name" in
22         00-full-regression|ffmpeg-help|binsize-*) continue ;;
23     esac
24     case "$command" in
25         {MD5}*) command="${command#\{MD5\}} | do_md5sum | cut -c-32" ;;
26         {*}*)   continue ;;
27     esac
28     command=$(echo "$command" | sed 's/\$BUILD_PATH/$(TARGET_PATH)/g')
29     command=$(echo "$command" | sed 's/\$SAMPLES_PATH/$(SAMPLES)/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"