Skip to content

Instantly share code, notes, and snippets.

@trini
Created April 29, 2022 15:19
Show Gist options
  • Save trini/99e871ba7ec57793abdc63206c1c671d to your computer and use it in GitHub Desktop.
Save trini/99e871ba7ec57793abdc63206c1c671d to your computer and use it in GitHub Desktop.
Wrapper arouund U-Boot pytest with some further sanity checking
#!/bin/bash
if [ $# -lt 1 -o $# -gt 3 ]; then
echo "Usage: $0 buildman-spec [test.py-id] [tests]"
exit 1
fi
if [ $# -gt 1 ]; then
ARGS="$1 --id $2"
else
ARGS="$1"
fi
if [ $# -eq 3 ]; then
TEST="$3"
else
TEST="not sleep and not event_dump and not bootmgr"
fi
# Prepare virtualenv if needed
if [ -f test/py/requirements.txt ]; then
if [ ! -d /tmp/venv ]; then
virtualenv -p /usr/bin/python3 /tmp/venv
. /tmp/venv/bin/activate
pip install -r test/py/requirements.txt
pip install requests
else
. /tmp/venv/bin/activate
fi
fi
# Build the board
#set +e
./tools/buildman/buildman -o /tmp -P --board ${1}
#set -e
# Run the tests
export PATH=/opt/qemu-6.1.0/bin:${PATH}:/home/trini/work/u-boot/uboot-test-hooks/bin
export PYTHONPATH=/home/trini/work/u-boot/uboot-test-hooks/py/bill-the-cat:${PYTHONPATH}
export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/$1
./test/py/test.py --bd $ARGS --build-dir "$UBOOT_TRAVIS_BUILD_DIR" -k "$TEST" -ra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment