-
Notifications
You must be signed in to change notification settings - Fork 0
/
timeTestScript.sh
101 lines (79 loc) · 1.58 KB
/
timeTestScript.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
#!/bin/bash
# 3 Ciphers "null", "aes128", "aes256"
# Upload and download for each one
# Run with 3 sizes: 1KB, 1 MB, 1 GB
# Seed
SEED=6
function run_test {
echo "size: $size cipher: $cipher command: $command" >> time_tests.txt
for i in {1..10}
do
python3 server.py 8000 myKey &
sleep 1
if [ "$command" == "write" ]; then
result="$((time ./bgen.py $size $SEED | python3 client.py $command $filename localhost:8000 $cipher myKey < $filename) 2>&1)"
elif [ "$command" == "read" ]; then
result="$((time python3 client.py $command $filename localhost:8000 $cipher myKey | shasum -a 256) 2>&1)"
else
echo "Invalid command"
exit
fi
echo "$result" | tail -3 >> time_tests.txt
echo >> time_tests.txt
sleep 1
done
}
# First run of using 1KB
size=1024
cipher="null"
command="write"
filename="1KB.bin"
run_test
command="read"
run_test
cipher="aes128"
command="write"
run_test
command="read"
run_test
cipher="aes256"
command="write"
run_test
command="read"
run_test
# Second run of using 1MB
let size=1024**2
cipher="null"
command="write"
filename="1MB.bin"
run_test
command="read"
run_test
cipher="aes128"
command="write"
run_test
command="read"
run_test
cipher="aes256"
command="write"
run_test
command="read"
run_test
# Second run of using 1GB
let size=1024**3
cipher="null"
command="write"
filename="1GB.bin"
run_test
command="read"
run_test
cipher="aes128"
command="write"
run_test
command="read"
run_test
cipher="aes256"
command="write"
run_test
command="read"
run_test