summaryrefslogtreecommitdiffstatshomepage
path: root/tools/mpremote/tests/test_recursive_cp.sh
blob: 397b5fd576717f849c559c43daa8ced7650036e4 (plain) (blame)
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
#!/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