All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [OE-core][PATCH] ffmpeg: add ptest install for ffmpeg
       [not found] <16663BAB94E51B8F.6890@lists.openembedded.org>
@ 2021-02-25 18:12 ` Suji Velupillai
  2021-02-26 13:19   ` Richard Purdie
  0 siblings, 1 reply; 5+ messages in thread
From: Suji Velupillai @ 2021-02-25 18:12 UTC (permalink / raw)
  To: Suji Velupillai; +Cc: openembedded-core, Jonathan Richardson, Scott Branden


[-- Attachment #1.1: Type: text/plain, Size: 8046 bytes --]

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

On Mon, Feb 22, 2021 at 5:18 PM Suji Velupillai via lists.openembedded.org
<suji.velupillai=broadcom.com@lists.openembedded.org> wrote:

> From: Suji Velupillai <suji.velupillai@broadcom.com>
>
> [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 testing
>
> Signed-off-by: Suji Velupillai <suji.velupillai@broadcom.com>
> ---
>  .../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-ptest
>
> diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest
> b/meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest
> new file mode 100644
> index 0000000000..ee866a58b2
> --- /dev/null
> +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest
> @@ -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 (comma
> separated)
> +# 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 fate
> test.
> +   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"
> >>${FATEWORKDIR}/report 2>/dev/null; done
> +   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 fate
> configuring stage"
> +echo "compiling fate test"
> +compile   >${FATEWORKDIR}/compile.log   2>&1 || fail 2 "error in fate
> compiling stage"
> +echo "fate testing in progress"
> +fate      >${FATEWORKDIR}/test.log  2>&1 || fail 1 "error in fate testing
> stage"
> +echo "generate test report"
> +report 0 success
> +clean
> +if [ $? == 0 ]; then
> +    echo "ffmpeg fate: PASSED"
> +else
> +    echo "ffmpeg fate: FAILED"
> +fi
> diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb
> b/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb
> index bd21552332..c374694956 100644
> --- a/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb
> +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb
> @@ -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 \
> @@ -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 \
> @@ -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-ptest
> +}
> +
>  PACKAGES =+ "libavcodec \
>               libavdevice \
>               libavfilter \
> --
> 2.17.1
>
>
> 
>
>

[-- Attachment #1.2: Type: text/html, Size: 10441 bytes --]

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core][PATCH] ffmpeg: add ptest install for ffmpeg
  2021-02-25 18:12 ` [OE-core][PATCH] ffmpeg: add ptest install for ffmpeg Suji Velupillai
@ 2021-02-26 13:19   ` Richard Purdie
  2021-02-26 21:57     ` Suji Velupillai
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Purdie @ 2021-02-26 13:19 UTC (permalink / raw)
  To: suji.velupillai
  Cc: openembedded-core, Jonathan Richardson, Scott Branden, Alexandre Belloni

On Thu, 2021-02-25 at 10:12 -0800, Suji Velupillai via lists.openembedded.org wrote:
> 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core][PATCH] ffmpeg: add ptest install for ffmpeg
  2021-02-26 13:19   ` Richard Purdie
@ 2021-02-26 21:57     ` Suji Velupillai
  0 siblings, 0 replies; 5+ messages in thread
From: Suji Velupillai @ 2021-02-26 21:57 UTC (permalink / raw)
  To: Richard Purdie
  Cc: openembedded-core, Jonathan Richardson, Scott Branden, Alexandre Belloni


[-- Attachment #1.1: Type: text/plain, Size: 1439 bytes --]

Thank you Richard, please see inline.

On Fri, Feb 26, 2021 at 5:19 AM Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> On Thu, 2021-02-25 at 10:12 -0800, Suji Velupillai via
> lists.openembedded.org wrote:
> > 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.

Okay, I will look into this and address it on the next patch.

>
>
I was a little concerned that it appeared you're copying the entire
> 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.

>
> Cheers,
>
> Richard
>
>

[-- Attachment #1.2: Type: text/html, Size: 2471 bytes --]

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [OE-core][PATCH] ffmpeg: add ptest install for ffmpeg
  2021-02-23  1:17 Suji Velupillai
@ 2021-02-23 22:58 ` Scott Branden
  0 siblings, 0 replies; 5+ messages in thread
From: Scott Branden @ 2021-02-23 22:58 UTC (permalink / raw)
  To: suji.velupillai, openembedded-core; +Cc: jonathan.richardson

[-- Attachment #1: Type: text/plain, Size: 7899 bytes --]

Thanks for the work on this Suji.  We can now buidl and test ffmpeg using FATE in yocto.

On 2021-02-22 5:17 p.m., suji.velupillai@broadcom.com wrote:
> From: Suji Velupillai <suji.velupillai@broadcom.com>
> 
> [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 testing
> 
> Signed-off-by: Suji Velupillai <suji.velupillai@broadcom.com>
Acked-by: Scott Branden <scott.branden@broadcom.com>
> ---
>  .../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-ptest
> 
> diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest b/meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest
> new file mode 100644
> index 0000000000..ee866a58b2
> --- /dev/null
> +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest
> @@ -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 (comma separated)
> +# 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 fate test.
> +   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" >>${FATEWORKDIR}/report 2>/dev/null; done
> +   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 fate configuring stage"
> +echo "compiling fate test"
> +compile   >${FATEWORKDIR}/compile.log   2>&1 || fail 2 "error in fate compiling stage"
> +echo "fate testing in progress"
> +fate      >${FATEWORKDIR}/test.log  2>&1 || fail 1 "error in fate testing stage"
> +echo "generate test report"
> +report 0 success
> +clean
> +if [ $? == 0 ]; then
> +    echo "ffmpeg fate: PASSED"
> +else
> +    echo "ffmpeg fate: FAILED"
> +fi
> diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb
> index bd21552332..c374694956 100644
> --- a/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb
> +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb
> @@ -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 \
> @@ -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 \
> @@ -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-ptest
> +}
> +
>  PACKAGES =+ "libavcodec \
>               libavdevice \
>               libavfilter \
> 


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [OE-core][PATCH] ffmpeg: add ptest install for ffmpeg
@ 2021-02-23  1:17 Suji Velupillai
  2021-02-23 22:58 ` Scott Branden
  0 siblings, 1 reply; 5+ messages in thread
From: Suji Velupillai @ 2021-02-23  1:17 UTC (permalink / raw)
  To: openembedded-core; +Cc: suji.velupillai, jonathan.richardson, scott.branden

From: Suji Velupillai <suji.velupillai@broadcom.com>

[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 testing

Signed-off-by: Suji Velupillai <suji.velupillai@broadcom.com>
---
 .../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-ptest

diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest b/meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest
new file mode 100644
index 0000000000..ee866a58b2
--- /dev/null
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/run-ptest
@@ -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 (comma separated)
+# 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 fate test.
+   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" >>${FATEWORKDIR}/report 2>/dev/null; done
+   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 fate configuring stage"
+echo "compiling fate test"
+compile   >${FATEWORKDIR}/compile.log   2>&1 || fail 2 "error in fate compiling stage"
+echo "fate testing in progress"
+fate      >${FATEWORKDIR}/test.log  2>&1 || fail 1 "error in fate testing stage"
+echo "generate test report"
+report 0 success
+clean
+if [ $? == 0 ]; then
+    echo "ffmpeg fate: PASSED"
+else
+    echo "ffmpeg fate: FAILED"
+fi
diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb
index bd21552332..c374694956 100644
--- a/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb
+++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_4.3.1.bb
@@ -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 \
@@ -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 \
@@ -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-ptest
+}
+
 PACKAGES =+ "libavcodec \
              libavdevice \
              libavfilter \
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-26 21:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <16663BAB94E51B8F.6890@lists.openembedded.org>
2021-02-25 18:12 ` [OE-core][PATCH] ffmpeg: add ptest install for ffmpeg Suji Velupillai
2021-02-26 13:19   ` Richard Purdie
2021-02-26 21:57     ` Suji Velupillai
2021-02-23  1:17 Suji Velupillai
2021-02-23 22:58 ` Scott Branden

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.