forked from Loures/objstore_sol
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestscript.sh
More file actions
executable file
·60 lines (45 loc) · 1.3 KB
/
Copy pathtestscript.sh
File metadata and controls
executable file
·60 lines (45 loc) · 1.3 KB
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
#!/usr/bin/env bash
WRITE=$1
READ=$(($1 * 3/5));
DELETE=$(($1 * 2/5))
WORDS=$(shuf -n$WRITE /usr/share/dict/italian)
#WORDS=$(seq $START $(($START + $WRITE - 1)))
rm testout.log 2> /dev/null
function printstats {
TEST1=$(grep -c "Test 1 passato" testout.log)
TEST2=$(grep -c "Test 2 passato" testout.log)
TEST3=$(grep -c "Test 3 passato" testout.log)
echo "Test tipo 1 passati: $TEST1"
grep "Test tipo 1 non passato" testout.log
echo "Test tipo 1 non passati: $(($WRITE - $TEST1))"
echo "Test tipo 2 passati: $TEST2"
grep "Test tipo 2 non passato" testout.log
echo "Test tipo 2 non passati: $(($READ - $TEST2))"
echo "Test tipo 3 passati: $TEST3"
grep "Test tipo 3 non passato" testout.log
echo "Test tipo 3 non passati: $(($DELETE - $TEST3))"
}
function testclient {
./client $1 $2 > /dev/null
if [ $? -eq 1 ]; then
echo "Client '$1': Test $2 non passato" >> testout.log
return 1
else
echo "Client '$1': Test $2 passato" >> testout.log
fi
}
for line in $WORDS; do
testclient $line 1 &
done
wait
for line in $(head -$READ <<< "$WORDS"); do
testclient $line 2 &
done
for line in $(tail -$DELETE <<< "$WORDS"); do
testclient $line 3 &
done
wait
printstats
kill -USR1 $(ps -C os_server -o pid=)
wait
kill -TERM $(ps -C os_server -o pid=)