avcodec/dxv: add support for "high" quality mode
[ffmpeg.git] / tests / fate.sh
1 #! /bin/sh
2
3 config=$1
4
5 die(){
6     echo "$@"
7     exit 1
8 }
9
10 test -r "$config"  || die "usage: fate.sh <config>"
11
12 workdir=$(cd $(dirname $config) && pwd)
13 make=make
14 tar='tar c'
15
16 . "$config"
17
18 test -n "$slot"    || die "slot not specified"
19 test -n "$repo"    || die "repo not specified"
20 test -d "$samples" || die "samples location not specified"
21
22 : ${branch:=master}
23
24 lock(){
25     lock=$1/fate.lock
26     (set -C; exec >$lock) 2>/dev/null || return
27     trap 'rm $lock' EXIT
28 }
29
30 checkout(){
31     case "$repo" in
32         file:*|/*) src="${repo#file:}"      ;;
33         git:*)     git clone --quiet --branch "$branch" "$repo" "$src" ;;
34     esac
35 }
36
37 update()(
38     cd ${src} || return
39     case "$repo" in
40         git:*) git fetch --quiet --force && git reset --quiet --hard "origin/$branch" ;;
41     esac
42 )
43
44 configure()(
45     cd ${build} || return
46     ${shell} ${src}/configure                                           \
47         --prefix="${inst}"                                              \
48         --samples="${samples}"                                          \
49         --enable-gpl                                                    \
50         --enable-memory-poisoning                                       \
51         --enable-avresample                                             \
52         ${ignore_tests:+--ignore-tests="$ignore_tests"}                 \
53         ${arch:+--arch=$arch}                                           \
54         ${cpu:+--cpu="$cpu"}                                            \
55         ${toolchain:+--toolchain="$toolchain"}                          \
56         ${cross_prefix:+--cross-prefix="$cross_prefix"}                 \
57         ${as:+--as="$as"}                                               \
58         ${cc:+--cc="$cc"}                                               \
59         ${ld:+--ld="$ld"}                                               \
60         ${target_os:+--target-os="$target_os"}                          \
61         ${sysroot:+--sysroot="$sysroot"}                                \
62         ${target_exec:+--target-exec="$target_exec"}                    \
63         ${target_path:+--target-path="$target_path"}                    \
64         ${target_samples:+--target-samples="$target_samples"}           \
65         ${extra_cflags:+--extra-cflags="$extra_cflags"}                 \
66         ${extra_ldflags:+--extra-ldflags="$extra_ldflags"}              \
67         ${extra_libs:+--extra-libs="$extra_libs"}                       \
68         ${extra_conf}
69 )
70
71 compile()(
72     cd ${build} || return
73     ${make} ${makeopts} && ${make} install
74 )
75
76 fate()(
77     test "$build_only" = "yes" && return
78     cd ${build} || return
79     ${make} ${makeopts_fate-${makeopts}} -k fate
80 )
81
82 clean(){
83     rm -rf ${build} ${inst}
84 }
85
86 report(){
87     date=$(date -u +%Y%m%d%H%M%S)
88     echo "fate:1:${date}:${slot}:${version}:$1:$2:${branch}:${comment}" >report
89     cat ${build}/ffbuild/config.fate >>report
90     cat ${build}/tests/data/fate/*.rep >>report 2>/dev/null || for i in ${build}/tests/data/fate/*.rep ; do cat "$i" >>report 2>/dev/null; done
91     test -n "$fate_recv" && $tar report *.log | gzip | $fate_recv
92 }
93
94 fail(){
95     report "$@"
96     clean
97     exit
98 }
99
100 mkdir -p ${workdir} || die "Error creating ${workdir}"
101 lock ${workdir}     || die "${workdir} locked"
102 cd ${workdir}       || die "cd ${workdir} failed"
103
104 src=${workdir}/src
105 : ${build:=${workdir}/build}
106 : ${inst:=${workdir}/install}
107
108 test -d "$src" && update || checkout || die "Error fetching source"
109
110 cd ${workdir}
111
112 version=$(${src}/ffbuild/version.sh ${src})
113 test "$version" = "$(cat version-$slot 2>/dev/null)" && exit 0
114 echo ${version} >version-$slot
115
116 rm -rf "${build}" *.log
117 mkdir -p ${build}
118
119 configure >configure.log 2>&1 || fail 3 "error configuring"
120 compile   >compile.log   2>&1 || fail 2 "error compiling"
121 fate      >test.log      2>&1 || fail 1 "error testing"
122 report 0 success
123 clean