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