1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

ci: ffmpeg tweaks in hardware tests

Running ffmpeg in a subshell and killing it in exit trap handler should
ensure video availability even when bootstrap or pytest fail.
This commit is contained in:
Martin Milata 2020-12-04 17:11:20 +01:00
parent 708a85a916
commit dedca1bb13
3 changed files with 26 additions and 21 deletions

View File

@ -9,7 +9,8 @@ INPUTDEVICE=/dev/video0
if [ "$2" == "start" ]; then
echo "[software/video] Starting record to $OUTPUTFILE"
ffmpeg -loglevel panic -f oss -f video4linux2 -i $INPUTDEVICE \
ffmpeg -loglevel warning -f oss -f video4linux2 -i $INPUTDEVICE \
-flush_packets 1 \
-vf "drawtext=font=Dejavu Sans: \
text='$1 | %{localtime} | %{pts}': x=(w-tw)/2: y=h-(2*lh): fontcolor=white: box=1: boxcolor=0x00000000@1: fontsize=15" $OUTPUTFILE &
export VPID=$!

20
ci/hardware_tests/t1_hw_test.sh Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
function finish {
./record_video.sh ${CI_COMMIT_SHORT_SHA} stop
ls -l *.mp4
}
trap finish EXIT
set -e # exit on nonzero exitcode
set -x # trace commands
./record_video.sh ${CI_COMMIT_SHORT_SHA} start
(cd ../.. && poetry install)
poetry run trezorctl -v list
export TREZOR_PATH=$(./get_trezor_path.sh 'Trezor 1')
echo $TREZOR_PATH
poetry run python bootstrap.py t1
poetry run python bootstrap.py t1 ../../trezor-*.bin
poetry run pytest ../../tests/device_tests

View File

@ -345,19 +345,11 @@ hardware legacy regular device test:
- legacy fw regular debug build
script:
- cd ci/hardware_tests
- nix-shell --run "./record_video.sh ${CI_COMMIT_SHORT_SHA} start"
- nix-shell --run "cd ../.. && poetry install"
- nix-shell --run "poetry run trezorctl list"
- export TREZOR_PATH=$(./get_trezor_path.sh 'Trezor 1')
- nix-shell --run "echo $TREZOR_PATH"
- nix-shell --run "poetry run python bootstrap.py t1"
- nix-shell --run "poetry run python bootstrap.py t1 ../../trezor-*.bin"
- nix-shell --run "poetry run pytest ../../tests/device_tests"
- nix-shell --run "./record_video.sh ${CI_COMMIT_SHORT_SHA} stop"
- nix-shell --run "./t1_hw_test.sh"
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- ci/hardware_tests/video*.mp4
- ci/hardware_tests/*.mp4
expire_in: 2 days
when: always
@ -377,19 +369,11 @@ hardware legacy btconly device test:
- legacy fw btconly debug build
script:
- cd ci/hardware_tests
- nix-shell --run "./record_video.sh ${CI_COMMIT_SHORT_SHA} start"
- nix-shell --run "cd ../.. && poetry install"
- nix-shell --run "poetry run trezorctl list"
- export TREZOR_PATH=$(./get_trezor_path.sh 'Trezor 1')
- nix-shell --run "echo $TREZOR_PATH"
- nix-shell --run "poetry run python bootstrap.py t1"
- nix-shell --run "poetry run python bootstrap.py t1 ../../trezor-*.bin"
- nix-shell --run "poetry run pytest ../../tests/device_tests"
- nix-shell --run "./record_video.sh ${CI_COMMIT_SHORT_SHA} stop"
- nix-shell --run "./t1_hw_test.sh"
artifacts:
name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"
paths:
- ci/hardware_tests/video*.mp4
- ci/hardware_tests/*.mp4
expire_in: 2 days
when: always