Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tests): option to use custom emulator version in local e2e tests #4107

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions docker/copy-custom-emulators-into-tenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

echo "Sleeping for 5 seconds for the container to fully initialize before transferring the emulator files"
sleep 5

T_ONE_EMU=""
T_T_EMU=""

# Arguments for T1 and TT emulator locations
while getopts :o:t: option
do
case $option in
o) T_ONE_EMU=$OPTARG;;
t) T_T_EMU=$OPTARG;;
esac
done


CONTAINER_ID=$(docker ps | grep 'trezor-user-env-unix' | awk {'print $1'})

if [[ ${T_ONE_EMU} != "" ]]
then
docker cp ${T_ONE_EMU} ${CONTAINER_ID}:/trezor-user-env/src/binaries/firmware/bin/trezor-emu-legacy-v1-master
echo "Copying ${T_ONE_EMU} into the container."
fi

if [[ ${T_T_EMU} != "" ]]
then
docker cp ${T_T_EMU} ${CONTAINER_ID}:/trezor-user-env/src/binaries/firmware/bin/trezor-emu-core-v2-master
echo "Copying ${T_T_EMU} into the container."
fi
14 changes: 14 additions & 0 deletions docker/docker-suite-test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/env bash
# Usage for custom emulators: docker/docker-suite-test.sh -o /tmp/1-custom -t /tmp/2-custom
# -o being for T-One location and -t for T-T location, both arguments being optional

DIR=$(dirname "$0")

set -e

# todo: resolve selective xhost permissions
Expand All @@ -7,4 +12,13 @@ set -e
xhost +
export LOCAL_USER_ID=`id -u $USER`

# When supplied with custom emulator(s), copying them into tenv container
# Forwarding all script arguments (-o and -t) into the script and running it on
# the background to be able to wait until the container is running
if [[ $# -ne 0 ]]
then
echo "Copying custom emulators into the tenv container"
${DIR}/copy-custom-emulators-into-tenv.sh $@ &
fi

docker-compose -f ./docker/docker-compose.suite-test.yml up --build --abort-on-container-exit