#!/bin/sh -ex

cd ${AUTOPKGTEST_TMP:-/tmp}

arduino-cli --log --log-file=log core list

# Check that builtin tools are loading from the correct directory.
grep "Loading tools from dir: /usr/libexec/arduino/builtin/tools" log

# Check that each builtin tool has been correctly loaded.
while read tool
do
	grep "msg=\"Loaded tool\" tool=\"builtin:${tool}@" log
done <<EOF
ctags
dfu-discovery
mdns-discovery
serial-discovery
serial-monitor
EOF
