-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_copy.sh
executable file
·122 lines (115 loc) · 3.18 KB
/
test_copy.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/sh
#Script for testing the copy program
echo "Testing the copy script"
echo "---------------------------"
echo "Very small file: (56B)"
t_start=`date +%N`
./copy 'test/file_vsmall' 'test/file_copy_rw'
t_end=`date +%N`
runtime_rw=`expr $t_end '-' $t_start`
t_start=`date +%N`
./copy '-m' 'test/file_vsmall' 'test/file_copy_mm'
t_end=`date +%N`
runtime_mm=`expr $t_end '-' $t_start`
echo "Runtime:"
echo "RW:" $runtime_rw "ns"
echo "MM:" $runtime_mm "ns"
echo "Hash sums:"
sha1sum 'test/file_vsmall'
sha1sum 'test/file_copy_rw'
sha1sum 'test/file_copy_mm'
rm 'test/file_copy_rw' 'test/file_copy_mm'
echo "---------------------------"
echo "Small file: (1.4kB)"
t_start=`date +%N`
./copy 'test/file_small' 'test/file_copy_rw'
t_end=`date +%N`
runtime_rw=`expr $t_end '-' $t_start`
t_start=`date +%N`
./copy '-m' 'test/file_small' 'test/file_copy_mm'
t_end=`date +%N`
runtime_mm=`expr $t_end '-' $t_start`
echo "Runtime:"
echo "RW:" $runtime_rw "ns"
echo "MM:" $runtime_mm "ns"
echo "Hash sums:"
sha1sum 'test/file_small'
sha1sum 'test/file_copy_rw'
sha1sum 'test/file_copy_mm'
rm 'test/file_copy_rw' 'test/file_copy_mm'
echo "---------------------------"
echo "Medium file: (11.2kB)"
t_start=`date +%N`
./copy 'test/file_medium' 'test/file_copy_rw'
t_end=`date +%N`
runtime_rw=`expr $t_end '-' $t_start`
t_start=`date +%N`
./copy '-m' 'test/file_medium' 'test/file_copy_mm'
t_end=`date +%N`
runtime_mm=`expr $t_end '-' $t_start`
echo "Runtime:"
echo "RW:" $runtime_rw "ns"
echo "MM:" $runtime_mm "ns"
echo "Hash sums:"
sha1sum 'test/file_medium'
sha1sum 'test/file_copy_rw'
sha1sum 'test/file_copy_mm'
rm 'test/file_copy_rw' 'test/file_copy_mm'
echo "---------------------------"
echo "Big file: (112kB)"
t_start=`date +%N`
./copy 'test/file_big' 'test/file_copy_rw'
t_end=`date +%N`
runtime_rw=`expr $t_end '-' $t_start`
t_start=`date +%N`
./copy '-m' 'test/file_big' 'test/file_copy_mm'
t_end=`date +%N`
runtime_mm=`expr $t_end '-' $t_start`
echo "Runtime:"
echo "RW:" $runtime_rw "ns"
echo "MM:" $runtime_mm "ns"
echo "Hash sums:"
sha1sum 'test/file_big'
sha1sum 'test/file_copy_rw'
sha1sum 'test/file_copy_mm'
rm 'test/file_copy_rw' 'test/file_copy_mm'
echo "---------------------------"
echo "Very big file: (2.9MB)"
t_start=`date +%N`
./copy 'test/file_vbig' 'test/file_copy_rw'
t_end=`date +%N`
runtime_rw=`expr $t_end '-' $t_start`
t_start=`date +%N`
./copy '-m' 'test/file_vbig' 'test/file_copy_mm'
t_end=`date +%N`
runtime_mm=`expr $t_end '-' $t_start`
echo "Runtime:"
echo "RW:" $runtime_rw "ns"
echo "MM:" $runtime_mm "ns"
echo "Hash sums:"
sha1sum 'test/file_vbig'
sha1sum 'test/file_copy_rw'
sha1sum 'test/file_copy_mm'
rm 'test/file_copy_rw' 'test/file_copy_mm'
echo "---------------------------"
echo "Giant file"
t_start=`date +%s.%N`
echo $t_start
./copy 'test/in.dat' 'test/file_copy_rw'
t_end=`date +%s.%N`
echo $t_end
runtime_rw=`echo "$t_end - $t_start" | bc`
t_start=`date +%s.%N`
./copy '-m' 'test/in.dat' 'test/file_copy_mm'
echo $t_start
t_end=`date +%s.%N`
echo $t_end
runtime_mm=`echo "$t_end - $t_start" | bc`
echo "Runtime:"
echo "RW:" $runtime_rw "s"
echo "MM:" $runtime_mm "s"
echo "Hash sums:"
sha1sum 'test/in.dat'
sha1sum 'test/file_copy_rw'
sha1sum 'test/file_copy_mm'
rm 'test/file_copy_rw' 'test/file_copy_mm'