forked from andreafabrizi/Dropbox-Uploader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testUnit.sh
executable file
·106 lines (86 loc) · 2.53 KB
/
testUnit.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
DU=./dropbox_uploader.sh
function check_exit
{
if [ $? -ne 0 ]; then
echo " Error!!!"
exit 1
else
echo " Passed"
fi
}
#Creating garbage data
echo -ne " - Creating garbage data...\n"
rm -fr "testData"
mkdir -p "testData"
dd if=/dev/urandom of="testData/file 1.txt" bs=1M count=3
dd if=/dev/urandom of="testData/file 2 ù.txt" bs=1M count=5
mkdir -p "testData/recurse"
dd if=/dev/urandom of="testData/recurse/file 3.txt" bs=1M count=1
dd if=/dev/urandom of="testData/recurse/test_Ü.txt" bs=1M count=1
dd if=/dev/urandom of="testData/recurse/test%20test.txt" bs=1M count=1
mkdir -p "testData/recurse/dir 1/"
dd if=/dev/urandom of="testData/recurse/dir 1/file 4.txt" bs=1M count=1
mkdir -p "testData/recurse/dir 1/dir 3/"
dd if=/dev/urandom of="testData/recurse/dir 1/dir 3/file 5.txt" bs=1M count=1
mkdir -p "testData/recurse/dir 2/"
dd if=/dev/urandom of="testData/file%20file.txt" bs=1M count=1
rm -fr recurse
#Rmdir
echo -ne " - Remove remote directory..."
$DU -q remove du_tests
echo ""
#Mkdir
echo -ne " - Make remote directory..."
$DU -q mkdir du_tests
check_exit
#Simple upload
echo -ne " - Simple file upload..."
$DU -q upload "testData/file 1.txt" du_tests
check_exit
#Checking with list
echo -ne " - Checking file..."
$DU -q list du_tests | grep "file 1.txt" > /dev/null
check_exit
#Simple upload 2
echo -ne " - Simple file upload with unicode chars..."
$DU -q upload testData/file\ 2* du_tests
check_exit
#Checking with list
echo -ne " - Checking file..."
$DU -q list du_tests | grep "file 2 ù.txt" > /dev/null
check_exit
#Simple upload 3
echo -ne " - Simple file upload with printf formats..."
$DU -q upload "testData/file%20file.txt" du_tests
check_exit
#Checking with list
echo -ne " - Checking file..."
$DU -q list du_tests | grep "file%20file.txt" > /dev/null
check_exit
#Recursive directory upload
echo -ne " - Recursive directory upload..."
$DU -q upload testData/recurse du_tests
check_exit
#Recursive directory download
echo -ne " - Recursive directory download..."
$DU -q download du_tests/recurse
check_exit
#Checking the downloaded dir
echo -ne " - Checking the downloaded dir..."
diff -r recurse testData/recurse/
check_exit
#Again, recursive directory download
echo -ne " - Again recursive directory download..."
$DU -q download du_tests/recurse
check_exit
#Again, checking the downloaded dir
echo -ne " - Checking the downloaded dir..."
diff -r recurse testData/recurse/
check_exit
rm -fr "recurse"
rm -fr "testData"
#Rmdir
echo -ne " - Remove remote directory..."
$DU -q remove du_tests
check_exit