summaryrefslogtreecommitdiffstats
path: root/tests/fate-update.sh
blob: c2a30a90c970083be1af3760f39975cfe8fb3f4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/sh

set -e

base=$(dirname $0)
ref="${base}/ref/fate"

FATE_DB_URL="http://fate.multimedia.cx/fate-tests.sqlite.bz2"
FATE_DB=$(mktemp fate-db.XXXXXX)
SQL_TESTS='SELECT id,short_name,command FROM test_spec WHERE active=1 ORDER BY short_name'

do_sql(){
    sqlite3 -noheader -separator ' ' "$FATE_DB" "$@"
}

wget -q -O - "$FATE_DB_URL" | bunzip2 > "$FATE_DB"
mkdir -p "$ref"
exec 3>"$base/fate.mak"

do_sql "$SQL_TESTS" | while read id name command; do
    case "$name" in
        00-full-regression|ffmpeg-help|binsize-*) continue ;;
    esac
    case "$command" in
        {MD5}*) command="${command#\{MD5\}} | do_md5sum | cut -c-32" ;;
        {*}*)   continue ;;
    esac
    command=$(echo "$command" | sed 's/\$BUILD_PATH/$(TARGET_PATH)/g')
    command=$(echo "$command" | sed 's/\$SAMPLES_PATH/$(SAMPLES)/g')
    do_sql "SELECT expected_stdout FROM test_spec WHERE id=$id" | awk '/./{print}' > "$ref/$name"
    printf "FATE_TESTS += fate-${name}\n" >&3
    printf "fate-${name}: CMD = %s\n" "$command" >&3
done

exec 3<&-
rm -f "$FATE_DB"
OpenPOWER on IntegriCloud