ffmpeg: add ptest install for ffmpeg
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hello
This change got dropped from the master-next branch.
Did it break any builds? Is there anything I can do to help to get this change accepted?
Thank you
Suji
Quoted 233 lines · Suji Velupillai via lists.openembedded.org
From: Suji Velupillai <[email protected]>
[YOCTO #5605] Add ptest for ffmpeg
ffmpeg fate test requires full source code and copy of test suite data to run the full test. Test data is over 1GB thus cannot be included within Yocto. But it can be mounted on the target during the test or fate test can run limited tests without test suite data as well.
Add ptest install such that it will only copy ffmpeg source code to the target image. The run-ptest script gets necessary configuration information from the shell environment variables at run time, which must be set prior to running the test.
FATEWORKDIR - working directory to run fate testing,
full test with samples requires about 6GB
FATECONFIG - ffmpeg config options for fate
FATESAMPLES - fate test suite samples directory, optional,
but required for full test
FATEIGNORE_TESTS- list of tests to ignore during fate testing FATECLEANUP - set to 1 to cleanup fate compile and install
directories after testingSigned-off-by Suji Velupillai <[email protected]>--- .../ffmpeg/ffmpeg/run-ptest | 130 ++++++++++++++++++ .../recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb | 16 ++- 2 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptestmeta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest new file +7
-0@@ -0,0 +1,130 @@ +#!/bin/sh + +# Following can be set in the environment to overwrite +# FATEWORKDIR - working directory for the fate test, needs about 6GB +# FATECONFIG - ffmpeg config options +# FATESAMPLES - fate test suite samples directory +# FATEIGNORE_TESTS - tests to ignore during fate test run (commaseparated)
meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest new file +35
-0+# FATECLEANUP - set to 0 or 1 (default) to clean up after fate test + +# Following variables are set during Yocto build time +VERSION="" +FATECONFIG_DEFAULT="" + +CLEANUP_DEFAULT=1 +make=make +src="$(dirname $(readlink -f $0))" + +echo "---------------------------------------------" +echo "ffmpeg fate test env config info: " +echo " workdir : [${FATEWORKDIR}]" +echo " config : [${FATECONFIG}]" +echo " config_default: [${FATECONFIG_DEFAULT}]" +echo " samplesdir : [${FATESAMPLES}]" +echo " ignore tests : [${FATEIGNORE_TESTS}]" +echo " clean up : [${FATECLEANUP}]" +echo "---------------------------------------------" + +die() { + echo "$@" + echo "ffmpeg fate: FAILED" + exit 1 +} + +lock() { + lock=$1/fate.lock + (set -C; exec >$lock) 2>/dev/null || return + trap 'rm $lock' EXIT +} + +prep_test_vector() { + # If samples directory not provided, run the fate without samples. + # In this case, limited test warning printed out to report by fatetest.
meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest new file +42
-0+ test -f "${FATESAMPLES}/md5sum" || FATESAMPLES="" +} + +prep_work_space() { + test -z ${FATEWORKDIR} && die "Error: empty workdir: ${FATEWORKDIR}" + test -d ${FATEWORKDIR} || die "Error: invalid workdir: ${FATEWORKDIR}" + cd ${FATEWORKDIR} + mkdir -p fatetest + FATEWORKDIR+="/fatetest" +} + +check_version() { + # if version is not set then try to get the version from src + [ -z "${VERSION}" ] && VERSION=$(${src}/ffbuild/version.sh ${src}) +} + +configure() { + cd ${build} || return + + ${src}/configure \ + --prefix="${install}" \ + ${FATESAMPLES:+--samples="$FATESAMPLES"} \ + ${FATEIGNORE_TESTS:+--ignore-tests="$FATEIGNORE_TESTS"} \ + ${FATECONFIG_DEFAULT:+$FATECONFIG_DEFAULT} \ + ${FATECONFIG:+$FATECONFIG} +} + +compile() { + cd ${build} || return + ${make} && ${make} install +} + +fate() { + cd ${build} || return + ${make} fate +} + +report() { + date=$(date -u +%Y%m%d%H%M%S) + echo "fate:1:${date}:${VERSION}:$1:$2" >${FATEWORKDIR}/report + cat ${build}/ffbuild/config.fate >>${FATEWORKDIR}/report + cat ${build}/tests/data/fate/*.rep >>${FATEWORKDIR}/report 2>/dev/null|| \ + for i in ${build}/tests/data/fate/*.rep ; do cat "$i"Quoted 1 line
Quoted 1 line
${FATEWORKDIR}/report 2>/dev/null; done
meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest new file +33
-0+ echo "fate test logs are in [${FATEWORKDIR}]" +} + +clean() { + [ -z "${FATECLEANUP}" ] && FATECLEANUP=${CLEANUP_DEFAULT} + if [[ "${FATECLEANUP}" -eq 1 ]]; then + echo "Cleaning up fate build and install directories" + rm -rf ${build} ${install} + fi +} + +fail() { + report "$@" + clean + echo "ffmpeg fate: FAILED" + exit 1 +} + +prep_work_space +prep_test_vector + +lock ${FATEWORKDIR} || die "${FATEWORKDIR} locked" +cd ${FATEWORKDIR} || die "cd ${FATEWORKDIR} failed" +build="${FATEWORKDIR}/build" +install="${FATEWORKDIR}/install" +mkdir -p $build +mkdir -p $install +PATH="$install/bin:$PATH" +LD_LIBRARY_PATH="$install/lib" + +check_version +echo "configuring for fate test" +configure >${FATEWORKDIR}/configure.log 2>&1 || fail 3 "error in fateconfiguring stage"
meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest new file +2
-0+echo "compiling fate test" +compile >${FATEWORKDIR}/compile.log 2>&1 || fail 2 "error in fatecompiling stage"
meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest new file +2
-0+echo "fate testing in progress" +fate >${FATEWORKDIR}/test.log 2>&1 || fail 1 "error in fate testingstage"
meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest new file +8
-0+echo "generate test report" +report 0 success +clean +if [ $? == 0 ]; then + echo "ffmpeg fate: PASSED" +else + echo "ffmpeg fate: FAILED" +fimeta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb +1
-0@@ -25,6 +25,7 @@ LIC_FILES_CHKSUM = "file://COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ SRC_URI = "https://www.ffmpeg.org/releases/${BP}.tar.xz \ file://mips64_cpu_detection.patch \ + file://run-ptest \ file://0001-lavf-srt-fix-build-fail-when-used-the-libsrt-1.4.1.patch \file://0001-libavutil-include-assembly-with-full-path-from-sourc.patch \ file://CVE-2020-35964.patch \meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb +1
-1@@ -43,7 +44,7 @@ PROVIDES = "libav libpostproc" DEPENDS = "nasm-native" -inherit autotools pkgconfig +inherit autotools pkgconfig ptest PACKAGECONFIG ??= "avdevice avfilter avcodec avformat swresample swscale postproc avresample \alsa bzlib gpl lzma pic pthreads shared theora x264
zlib \meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb +10
-0@@ -141,6 +142,19 @@ do_compile_prepend_class-target() { sed -i -e "s,${WORKDIR},,g" ${B}/config.h } +RDEPENDS_${PN}-ptest += "make" + +do_install_ptest() { + cd ${S} + VERSION="`ffbuild/version.sh .`" + tar -c --exclude='.git*' --exclude='oe-*' . | ( cd ${D}${PTEST_PATH} && tar -xf - ) + cd - + + FATECONF="${PACKAGECONFIG_CONFARGS} ${EXTRA_PTESTCONF}" + sed -i"s|FATECONFIG_DEFAULT=\"\"|FATECONFIG_DEFAULT=\"${FATECONF}\"|g" ${D}${PTEST_PATH}/run-ptest
+ sed -i "s|VERSION=\"\"|VERSION=\"$VERSION\"|g"
${D}${PTEST_PATH}/run-ptestmeta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb +2
-1+} + PACKAGES =+ "libavcodec \ libavdevice \ libavfilter \ --2.17.1
Quoted 2 lines · Suji Velupillai via lists.openembedded.org
This change got dropped from the master-next branch.
Did it break any builds? Is there anything I can do to help to get this change accepted?
Sorry, there was a bit of a mixup in the triage process and this took longer to work through than expected.
Yes, I'm afraid it did fail in testing, there was a reproducibility issue:
https://autobuilder.yoctoproject.org/typhoon/#/builders/118/builds/34/steps/12/logs/stdio
which says that the ffmpeg-ptest package has paths which change depending upon the directory it was built in.
This is bad, firstly as a reproducibility problem, but secondly as those paths won't make sense on target so they show something else is wrong.
I was a little concerned that it appeared you're copying the entire source into the ptest package too, not sure we need everything?
Cheers,
Richard
Thank you Richard, please see inline.
Quoted 12 lines · Richard Purdie
Quoted 2 lines · Suji Velupillai via lists.openembedded.org
This change got dropped from the master-next branch.
Did it break any builds? Is there anything I can do to help to get thischange accepted?
Sorry, there was a bit of a mixup in the triage process and this took longer to work through than expected.
Yes, I'm afraid it did fail in testing, there was a reproducibility issue:
Quoted 8 lines
https://autobuilder.yoctoproject.org/typhoon/#/builders/118/builds/34/steps/12/logs/stdio
which says that the ffmpeg-ptest package has paths which change depending upon the directory it was built in.
This is bad, firstly as a reproducibility problem, but secondly as those paths won't make sense on target so they show something else is wrong.
Okay, I will look into this and address it on the next patch.
Quoted 2 lines
I was a little concerned that it appeared you're copying the entire
Quoted 2 lines
source into the ptest package too, not sure we need everything?
ffmpeg fate test requires to run "make" followed by "make fate" commands, which requires the source code.
It's best to have the entire source rather than going into details as to what source is tested, also this is difficult to do.
Quoted 6 lines
Cheers,
Richard