-
Notifications
You must be signed in to change notification settings - Fork 133
Expand file tree
/
Copy pathci_flash.sh
More file actions
executable file
·69 lines (58 loc) · 2.06 KB
/
Copy pathci_flash.sh
File metadata and controls
executable file
·69 lines (58 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
set -eo pipefail
if [[ -z ${JADESERIALPORT} ]]; then
echo "JADESERIALPORT not set, defaulting..."
if [ "$(uname)" == "Darwin" ]; then
JADESERIALPORT=/dev/cu.SLAB_USBtoUART
elif [ -c /dev/ttyUSB0 ]; then
JADESERIALPORT=/dev/ttyUSB0
else
JADESERIALPORT=/dev/ttyACM0
fi
fi
echo "Using JADESERIALPORT ${JADESERIALPORT}"
TARGET_CHIP=${1}
SKIP_ARGS=${2}
if [ -z "$IDF_PATH" ]; then
get_idf
fi
./tools/initial_flash_${TARGET_CHIP}.sh ${JADESERIALPORT}
sleep 1
if [ -f /.dockerenv ]; then
# Running under docker/the CI: main requirements are
# already installed into the idf environment.
# Just install the pinserver requirements
pip install -r pinserver/requirements.txt
else
# Running locally: set up a virtualenv
virtualenv -p python3 venv3
source venv3/bin/activate
pip install --require-hashes -r requirements.txt
pip install -r pinserver/requirements.txt
fi
pip install pytest
if [ ! -x /usr/bin/bt-agent ]; then
echo "bt-agent not available, skipping bluetooth OTA"
SKIP_ARGS="--skipble"
fi
# NOTE: tools/fwprep.py should have run in the build step and produced the compressed firmware file
FW_FULL=$(ls build/*_fw.bin)
python jade_ota.py --push-mnemonic --log=INFO --serialport=${JADESERIALPORT} --fwfile=${FW_FULL} ${SKIP_ARGS}
sleep 5
python -c "from jadepy import JadeAPI; jade = JadeAPI.create_serial(device=\"${JADESERIALPORT}\", timeout=5) ; jade.connect(); jade.drain(); jade.disconnect()"
function reset_permissions {
if [ -f /.dockerenv ]; then
# Ensure test reports/pin files are owned by the user outside
# the container when we are run under docker compose.
chown -f $(stat -c "%u:%g" jade_ota.py) *.xml *.pin || true
fi
}
trap reset_permissions EXIT
python test_jade.py --log=INFO --serialport=${JADESERIALPORT} ${SKIP_ARGS}
pytest -v --no-legacy-flow --device ${JADESERIALPORT} tests/
if [ -x /usr/bin/bt-agent ]; then
pytest -v --no-legacy-flow --device ${JADESERIALPORT} --ble tests/
fi
if [ ! -f /.dockerenv ]; then
deactivate
fi