]> git.sesse.net Git - ffmpeg/blob - tests/fate.sh
h264: do not use 422 functions for monochrome
[ffmpeg] / 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 lock(){
23     lock=$1/fate.lock
24     (set -C; exec >$lock) 2>/dev/null || return
25     trap 'rm $lock' EXIT
26 }
27
28 checkout(){
29     case "$repo" in
30         file:*|/*) src="${repo#file:}"      ;;
31         git:*)     git clone --quiet "$repo" "$src" ;;
32     esac
33 }
34
35 update()(
36     cd ${src} || return
37     case "$repo" in
38         git:*) git fetch --force; git reset --hard origin/master ;;
39     esac
40 )
41
42 configure()(
43     cd ${build} || return
44     ${src}/configure                                                    \
45         --prefix="${inst}"                                              \
46         --samples="${samples}"                                          \
47         --enable-gpl                                                    \
48         ${arch:+--arch=$arch}                                           \
49         ${cpu:+--cpu="$cpu"}                                            \
50         ${cross_prefix:+--cross-prefix="$cross_prefix"}                 \
51         ${as:+--as="$as"}                                               \
52         ${cc:+--cc="$cc"}                                               \
53         ${ld:+--ld="$ld"}                                               \
54         ${target_os:+--target-os="$target_os"}                          \
55         ${sysroot:+--sysroot="$sysroot"}                                \
56         ${target_exec:+--target-exec="$target_exec"}                    \
57         ${target_path:+--target-path="$target_path"}                    \
58         ${target_samples:+--target-samples="$target_samples"}           \
59         ${extra_cflags:+--extra-cflags="$extra_cflags"}                 \
60         ${extra_ldflags:+--extra-ldflags="$extra_ldflags"}              \
61         ${extra_libs:+--extra-libs="$extra_libs"}                       \
62         ${extra_conf}
63 )
64
65 compile()(
66     cd ${build} || return
67     ${make} ${makeopts} && ${make} install
68 )
69
70 fate()(
71     test "$build_only" = "yes" && return
72     cd ${build} || return
73     ${make} ${makeopts} -k fate
74 )
75
76 clean(){
77     rm -rf ${build} ${inst}
78 }
79
80 report(){
81     date=$(date -u +%Y%m%d%H%M%S)
82     echo "fate:0:${date}:${slot}:${version}:$1:$2:${comment}" >report
83     cat ${build}/config.fate ${build}/tests/data/fate/*.rep >>report
84     test -n "$fate_recv" && $tar report *.log | gzip | $fate_recv
85 }
86
87 fail(){
88     report "$@"
89     clean
90     exit
91 }
92
93 mkdir -p ${workdir} || die "Error creating ${workdir}"
94 lock ${workdir}     || die "${workdir} locked"
95 cd ${workdir}       || die "cd ${workdir} failed"
96
97 src=${workdir}/src
98 : ${build:=${workdir}/build}
99 : ${inst:=${workdir}/install}
100
101 test -d "$src" && update || checkout || die "Error fetching source"
102
103 cd ${workdir}
104
105 version=$(${src}/version.sh ${src})
106 test "$version" = "$(cat version-$slot 2>/dev/null)" && exit 0
107 echo ${version} >version-$slot
108
109 rm -rf "${build}" *.log
110 mkdir -p ${build}
111
112 configure >configure.log 2>&1 || fail $? "error configuring"
113 compile   >compile.log   2>&1 || fail $? "error compiling"
114 fate      >test.log      2>&1 || fail $? "error testing"
115 report 0 success
116 clean