-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathrunexamples.sh
executable file
·36 lines (33 loc) · 956 Bytes
/
runexamples.sh
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
#!/bin/bash
#
# Run all scripts in examples/ dir with MicroPython unix port, CPython
# or a MicroPython board (via mpremote)
#
if [[ -n "$DEVICE" ]]; then
if ! which mpremote >&/dev/null; then
echo "Please install 'mpremote'."
exit 1
fi
mpremote connect "$DEVICE" mip install collections-defaultdict
./install.py "$DEVICE" || exit 1
fi
for example in examples/*.py; do
echo "Running example $example..."
if [[ -n "$DEVICE" ]]; then
mpremote \
connect "$DEVICE" \
run "$example" "$@"
ret=$?
elif [[ -n "$PYTHON" ]]; then
export PYTHONPATH="$(pwd)"
"$PYTHON" "$example" "$@"; ret=$?
else
export MICROPYPATH="$(pwd):$MICROPYPATH"
micropython "$example" "$@"; ret=$?
fi
if [[ $ret -ne 0 ]]; then
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" >/dev/stderr
echo "FAIL: $example" >/dev/stderr
fi
echo
done