1
0

Moved scripts/test into an internal test command in the container

Signed-off-by: James Ketrenos <james.p.ketrenos@intel.com>
This commit is contained in:
James Ketrenos 2019-09-25 10:59:54 -07:00
parent 7748348f3f
commit f3ce910fc8
3 changed files with 154 additions and 25 deletions

View File

@ -44,8 +44,25 @@ If you are in a multicard environment, see Appendix A.
## Test hardware accelerated FFMPEG media operations ## Test hardware accelerated FFMPEG media operations
First download test content into ./media, then launch
the Docker container mounting that path to the /media
volume, running the 'test' command.
NOTE: The test media stream is currently hard coded to
expect the name AUD_WM_E.264 in the container.
```bash ```bash
scripts/test mkdir $(pwd)/media
wget -O $(pwd)/media/AUD_MW_E.264 \
https://fate-suite.libav.org/h264-conformance/AUD_MW_E.264
docker run \
--rm \
--device=/dev/dri \
-e QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} \
--volume $(pwd)/media:/media \
-it \
intel-media-ffmpeg \
test
``` ```
The above will: The above will:

136
assets/commands/test Executable file
View File

@ -0,0 +1,136 @@
#!/bin/bash
PARAM=$0
# Strip path from command name
PARAM=${PARAM##*/}
short() {
echo "Execute GPU offload of decode, encode, and transcode."
}
help() {
cat << EOF
$(short)
$(info)
EOF
}
details() {
cat << EOF
$(short)
This script provides a quick test of decode, encode, and transcode using
GPU offload. It is equivelant to manually running the following test
cases:
decode AUD_MW_E.264 AUD_MW.yuv
encode AUD_MW.yuv AUD_MW_E.h264
transcode AUD_MW_E.264 AUD_MW_E.hevc
1N_transcode AUD_MW_E.264 AUD_1N
EOF
}
arguments=()
for arg in $*; do
[[ $arg =~ ^-- ]] && {
command=${arg/--}
case $command in
short) short
exit 0
;;
help) help
exit 0
;;
details) details
exit 0
;;
*) echo "Unrecognized command."
exit 1
;;
esac
} || {
arguments+=("$arg")
}
done
info() {
cat << EOF
usage: $PARAM
EOF
}
QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128}
[ ${#arguments[*]} != 0 ] && {
info
exit 1
}
[ ! -d /media/. ] && {
cat << EOF
Error: '/media/' not found.
Was the volume /media mounted when launching the container?
docker ... --volume \$(pwd)/media:/media ...
or similar?
EOF
exit 1
}
[ ! -e ${QSV_DEVICE} ] && {
cat << EOF
Error: '${QSV_DEVICE}' not found.
Did you pass /dev/dri to Docker?
docker ... --device=/dev/dri ...
or similar?
EOF
exit 2
}
[ ! -e "/media/AUD_MW_E.264" ] && {
cat << EOF
Error: Test file h264 (AVC) not found. Is /media mounted?
You can download a test stream via:
mkdir -p \$(pwd)/media
wget -O \$(pwd)/media/AUD_MW_E.264 \\
'https://fate-suite.libav.org/h264-conformance/AUD_MW_E.264'
Once downloaded, re-run this test. When you launch the Docker
container, make sure you mount the '\$(pwd)/media' path as
the /media volume via:
docker ... --volume \$(pwd)/media:/media ...
EOF
exit 3
}
tests=(
"decode AUD_MW_E.264 AUD_MW.yuv"
"encode AUD_MW.yuv AUD_MW_E.h264"
"transcode AUD_MW_E.264 AUD_MW_E.hevc"
"1N_transcode AUD_MW_E.264 AUD_1N"
)
for test in "${tests[@]}"; do
test=($test)
/assets/commands/${test[*]} || {
echo "Error: Test failed: ${test[*]}"
exit 5
}
done

View File

@ -1,24 +0,0 @@
#!/bin/bash
HOST_MEDIA=$(pwd)/media
[ ! -e "${HOST_MEDIA}/AUD_MW_E.264" ] && {
mkdir -p ${HOST_MEDIA}
wget -q -O ${HOST_MEDIA}/AUD_MW_E.264 \
https://fate-suite.libav.org/h264-conformance/AUD_MW_E.264
}
tests=(
"decode AUD_MW_E.264 AUD_MW.yuv"
"encode AUD_MW.yuv AUD_MW_E.h264"
"transcode AUD_MW_E.264 AUD_MW_E.hevc"
"1N_transcode AUD_MW_E.264 AUD_1N"
)
for test in "${tests[@]}"; do
test=($test)
docker run --rm \
--volume ${HOST_MEDIA}:/media -it \
--device=/dev/dri -e QSV_DEVICE=${QSV_DEVICE:-/dev/dri/renderD128} \
intel-media-ffmpeg ${test[*]} || {
echo "Error: Test failed: ${test[*]}"
break
}
done