forked from thingsboard/thingsboard-client-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·61 lines (48 loc) · 1.5 KB
/
test.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
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
#!/bin/bash
set -e
EXAMPLES_ARDUINO_UNO=(
"examples/0000-arduino_send_telemetry"
"examples/0001-arduino_send_batch"
"examples/0002-arduino_rpc"
"examples/0004-arduino-sim900_send_telemetry"
"examples/0005-arduino-sim900_send_telemetry_http"
)
EXAMPLES_ESP8266=(
"examples/0003-esp8266_send_data"
)
EXAMPLES=( "${EXAMPLES_ESP8266[@]}" "${EXAMPLES_ARDUINO_UNO[@]}")
# Test if arduino command line interface is downloaded locally
if [ -f "$(pwd)/arduino-cli-0.3.2-alpha.preview-linux64" ]
then
ARDUINO_CLI="$(pwd)/arduino-cli-0.3.2-alpha.preview-linux64"
echo "Found arduino CLI in $ARDUINO_CLI"
else
ARDUINO_CLI="arduino-cli"
fi
do_test() {
for path in "${EXAMPLES_ARDUINO_UNO[@]}"
do
"${ARDUINO_CLI}" compile --warnings all -v -b arduino:avr:uno "${path}"
done
for path in "${EXAMPLES_ESP8266[@]}"
do
"${ARDUINO_CLI}" compile -b esp8266:esp8266:generic "${path}"
done
}
# Create symlinks to library under test
do_link() {
for path in "${EXAMPLES[@]}"
do
ln -sf "$(pwd)/src/ThingsBoard.h" "${path}/ThingsBoard.h"
ln -sf "$(pwd)/src/ThingsBoard.cpp" "${path}/ThingsBoard.cpp"
done
}
do_link
# Dependencies
# `|| true`` added to ignore an error if a lib is already installed
"${ARDUINO_CLI}" lib install PubSubClient || true
"${ARDUINO_CLI}" lib install WiFiEsp || true
"${ARDUINO_CLI}" lib install ArduinoJson || true
"${ARDUINO_CLI}" lib install TinyGSM || true
"${ARDUINO_CLI}" lib install ArduinoHttpClient || true
do_test