add LAVF_API_OLD_METADATA define to disable the deprecated metadata API
[libav.git] / tests / fate.sh
CommitLineData
a9dc6111
MR
1#! /bin/sh
2
3config=$1
4
5die(){
6 echo "$@"
7 exit 1
8}
9
10test -r "$config" || die "usage: fate.sh <config>"
11
12workdir=$(dirname $config)
13make=make
8b0816cb 14tar='tar c'
a9dc6111
MR
15
16. "$config"
17
18test -n "$slot" || die "slot not specified"
19test -n "$repo" || die "repo not specified"
20test -d "$samples" || die "samples location not specified"
21
22lock(){
23 lock=$1/fate.lock
24 (set -C; exec >$lock) 2>/dev/null || return
25 trap 'rm $lock' EXIT
26}
27
28checkout(){
29 case "$repo" in
30 file:*|/*) src="${repo#file:}" ;;
31 git:*) git clone "$repo" "$src" ;;
32 svn:*) svn co "$repo" "$src" ;;
33 esac
34}
35
36update()(
37 cd ${src} || return
38 case "$repo" in
39 git:*) git pull ;;
40 svn:*) svn up ;;
41 esac
42)
43
44configure()(
45 cd ${build} || return
46 ${src}/configure \
47 --prefix="${inst}" \
48 --samples="${samples}" \
49 ${arch:+--arch=$arch} \
50 ${cpu:+--cpu="$cpu"} \
51 ${cross_prefix:+--cross-prefix="$cross_prefix"} \
52 ${cc:+--cc="$cc"} \
53 ${target_os:+--target-os="$target_os"} \
54 ${sysroot:+--sysroot="$sysroot"} \
55 ${target_exec:+--target-exec="$target_exec"} \
56 ${target_path:+--target-path="$target_path"} \
57 ${extra_cflags:+--extra-cflags="$extra_cflags"} \
58 ${extra_ldflags:+--extra-ldflags="$extra_ldflags"} \
59 ${extra_libs:+--extra-libs="$extra_libs"} \
60 ${extra_conf}
61)
62
63compile()(
64 cd ${build} || return
65 ${make} ${makeopts} && ${make} install
66)
67
68fate()(
69 cd ${build} || return
70 ${make} ${makeopts} -k fate
71)
72
673fe599
MR
73clean(){
74 rm -r ${build} ${inst}
75}
76
a9dc6111
MR
77report(){
78 date=$(date -u +%Y%m%d%H%M%S)
79 echo "fate:0:${date}:${slot}:${version}:$1:$2" >report
80 cat ${build}/config.fate ${build}/tests/data/fate/*.rep >>report
8b0816cb 81 test -n "$fate_recv" && $tar report *.log | gzip | $fate_recv
a9dc6111
MR
82}
83
84fail(){
85 report "$@"
51124db8 86 clean
a9dc6111
MR
87 exit
88}
89
90mkdir -p ${workdir} || die "Error creating ${workdir}"
91lock ${workdir} || die "${workdir} locked"
92cd ${workdir} || die "cd ${workdir} failed"
93
94src=${workdir}/src
95build=${workdir}/build
96inst=${workdir}/install
97report=tests/data/fate/report
98
99test -d "$src" && update || checkout || die "Error fetching source"
100
101cd ${workdir}
102
103version=$(${src}/version.sh ${src})
104test "$version" = "$(cat version 2>/dev/null)" && exit 0
105echo ${version} >version
106
107rm -rf "${build}"
108mkdir -p ${build}
109
110configure >configure.log 2>&1 || fail $? "error configuring"
111compile >compile.log 2>&1 || fail $? "error compiling"
112fate >test.log 2>&1 || fail $? "error testing"
113report 0 success
673fe599 114clean