Files
micropython/tools/mpremote/tests/test_recursive_cp.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

61 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
set -e
echo -----
mkdir -p $TMP/a $TMP/a/b
touch $TMP/a/x.py $TMP/a/b/y.py
ls $TMP/a | sort
ls $TMP/a/b | sort
# TODO
echo -----
touch $TMP/y.py
ls $TMP | sort
# Recursive copy to a directory that doesn't exist. The source directory will
# be copied to the destination (i.e. bX will the same as a).
echo -----
cp -r $TMP/a $TMP/b1
cp -r $TMP/a/ $TMP/b2
cp -r $TMP/a $TMP/b3/
cp -r $TMP/a/ $TMP/b4/
# Recursive copy to a directory that does exist. The source directory will be
# copied into the destination (i.e. bX will contain a copy of a).
echo -----
mkdir $TMP/c{1,2,3,4}
cp -r $TMP/a $TMP/c1
cp -r $TMP/a/ $TMP/c2
cp -r $TMP/a $TMP/c3/
cp -r $TMP/a/ $TMP/c4/
echo -----
find $TMP | sort
echo -----
rm -rf $TMP/b{1,2,3,4} $TMP/c{1,2,3,4}
# Now replicate the same thing using `mpremote cp`.
# Recursive copy to a directory that doesn't exist. The source directory will
# be copied to the destination (i.e. bX will the same as a).
echo -----
$MPREMOTE cp --no-verbose -r $TMP/a $TMP/b1
$MPREMOTE cp --no-verbose -r $TMP/a/ $TMP/b2
$MPREMOTE cp --no-verbose -r $TMP/a $TMP/b3/
$MPREMOTE cp --no-verbose -r $TMP/a/ $TMP/b4/
# Recursive copy to a directory that does exist. The source directory will be
# copied into the destination (i.e. bX will contain a copy of a).
echo -----
mkdir $TMP/c{1,2,3,4}
$MPREMOTE cp --no-verbose -r $TMP/a $TMP/c1
$MPREMOTE cp --no-verbose -r $TMP/a/ $TMP/c2
$MPREMOTE cp --no-verbose -r $TMP/a $TMP/c3/
$MPREMOTE cp --no-verbose -r $TMP/a/ $TMP/c4/
echo -----
find $TMP | sort