eamad: use the bytestream2 API instead of AV_RL
[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
8226e977 12workdir=$(cd $(dirname $config) && pwd)
a9dc6111 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:}" ;;
c58f4069 31 git:*) git clone --quiet "$repo" "$src" ;;
a9dc6111
MR
32 esac
33}
34
35update()(
36 cd ${src} || return
37 case "$repo" in
9510d768 38 git:*) git fetch --force; git reset --hard origin/master ;;
a9dc6111
MR
39 esac
40)
41
42configure()(
43 cd ${build} || return
44 ${src}/configure \
45 --prefix="${inst}" \
46 --samples="${samples}" \
74c847e0 47 --enable-gpl \
a9dc6111
MR
48 ${arch:+--arch=$arch} \
49 ${cpu:+--cpu="$cpu"} \
50 ${cross_prefix:+--cross-prefix="$cross_prefix"} \
d7b9b66a 51 ${as:+--as="$as"} \
a9dc6111 52 ${cc:+--cc="$cc"} \
2b366008 53 ${ld:+--ld="$ld"} \
a9dc6111
MR
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"} \
ba13606c 58 ${target_samples:+--target-samples="$target_samples"} \
a9dc6111
MR
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
65compile()(
66 cd ${build} || return
67 ${make} ${makeopts} && ${make} install
68)
69
70fate()(
c209d0df 71 test "$build_only" = "yes" && return
a9dc6111
MR
72 cd ${build} || return
73 ${make} ${makeopts} -k fate
74)
75
673fe599 76clean(){
20e1829d 77 rm -rf ${build} ${inst}
673fe599
MR
78}
79
a9dc6111
MR
80report(){
81 date=$(date -u +%Y%m%d%H%M%S)
5ffccc00 82 echo "fate:0:${date}:${slot}:${version}:$1:$2:${comment}" >report
a9dc6111 83 cat ${build}/config.fate ${build}/tests/data/fate/*.rep >>report
8b0816cb 84 test -n "$fate_recv" && $tar report *.log | gzip | $fate_recv
a9dc6111
MR
85}
86
87fail(){
88 report "$@"
51124db8 89 clean
a9dc6111
MR
90 exit
91}
92
93mkdir -p ${workdir} || die "Error creating ${workdir}"
94lock ${workdir} || die "${workdir} locked"
95cd ${workdir} || die "cd ${workdir} failed"
96
97src=${workdir}/src
eb8da636
MR
98: ${build:=${workdir}/build}
99: ${inst:=${workdir}/install}
a9dc6111
MR
100
101test -d "$src" && update || checkout || die "Error fetching source"
102
103cd ${workdir}
104
105version=$(${src}/version.sh ${src})
32a15a24
MR
106test "$version" = "$(cat version-$slot 2>/dev/null)" && exit 0
107echo ${version} >version-$slot
a9dc6111 108
69a9c80b 109rm -rf "${build}" *.log
a9dc6111
MR
110mkdir -p ${build}
111
112configure >configure.log 2>&1 || fail $? "error configuring"
113compile >compile.log 2>&1 || fail $? "error compiling"
114fate >test.log 2>&1 || fail $? "error testing"
115report 0 success
673fe599 116clean