micropython/tools/mpremote/tests/run-mpremote-tests.sh
Jim Mussared 6461ffd9d1 tools/mpremote: Add initial regression tests for mpremote.
These tests are specifically for the command-line interface and cover:
 - resume/soft-reset/connect/disconnect
 - mount
 - fs cp,touch,mkdir,cat,sha256sum,rm,rmdir
 - eval/exec/run

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Damien George <damien@micropython.org>
2024-10-09 16:39:00 +11:00

31 lines
710 B
Bash
Executable File

#!/bin/bash
set -e
TEST_DIR=$(dirname $0)
MPREMOTE=${TEST_DIR}/../mpremote.py
if [ -z "$1" ]; then
# Find tests matching test_*.sh
TESTS=${TEST_DIR}/test_*.sh
else
# Specific test path from the command line.
TESTS="$1"
fi
for t in $TESTS; do
TMP=$(mktemp -d)
echo -n "${t}: "
# Strip CR and replace the random temp dir with a token.
if env MPREMOTE=${MPREMOTE} TMP="${TMP}" "${t}" | tr -d '\r' | sed "s,${TMP},"'${TMP},g' > "${t}.out"; then
if diff "${t}.out" "${t}.exp" > /dev/null; then
echo "OK"
else
echo "FAIL"
diff "${t}.out" "${t}.exp" || true
fi
else
echo "CRASH"
fi
rm -r "${TMP}"
done