|
@@ -1,7 +1,7 @@
|
|
#!/bin/bash
|
|
#!/bin/bash
|
|
|
|
|
|
rm -rf shadow.data/
|
|
rm -rf shadow.data/
|
|
-shadow --template-directory shadow.data.template shadow.yaml > shadow.log
|
|
|
|
|
|
+shadow --pcap-enabled true --template-directory shadow.data.template shadow.yaml > shadow.log
|
|
ret=$?
|
|
ret=$?
|
|
|
|
|
|
declare -A groups
|
|
declare -A groups
|
|
@@ -9,7 +9,7 @@ groups[group1]="Alice Bob Carol"
|
|
groups[group2]="Alice Bob Dave"
|
|
groups[group2]="Alice Bob Dave"
|
|
|
|
|
|
check_one_log() {
|
|
check_one_log() {
|
|
- counts="$(grep -Ec "$1" shadow.data/hosts/*/*.stdout | cut -d: -f2 | sort -n)"
|
|
|
|
|
|
+ counts="$(grep -Ec "$1" shadow.data/hosts/peer*/*.stdout | cut -d: -f2 | sort -n)"
|
|
if [[ $(echo "$counts" | tail -1) -lt $2 ]] ; then
|
|
if [[ $(echo "$counts" | tail -1) -lt $2 ]] ; then
|
|
echo "Not enough matches of pattern: $1"
|
|
echo "Not enough matches of pattern: $1"
|
|
ret=1
|
|
ret=1
|
|
@@ -21,13 +21,20 @@ check_one_log() {
|
|
}
|
|
}
|
|
|
|
|
|
check_all_logs() {
|
|
check_all_logs() {
|
|
- counts="$(grep -Ec "$1" shadow.data/hosts/*/*.stdout | cut -d: -f2 | sort -n)"
|
|
|
|
|
|
+ counts="$(grep -Ec "$1" shadow.data/hosts/peer*/*.stdout | cut -d: -f2 | sort -n)"
|
|
if [[ $(echo "$counts" | tail -1) -lt $2 ]] ; then
|
|
if [[ $(echo "$counts" | tail -1) -lt $2 ]] ; then
|
|
echo "Not enough matches of pattern: $1"
|
|
echo "Not enough matches of pattern: $1"
|
|
ret=1
|
|
ret=1
|
|
fi
|
|
fi
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+invert_check_all_logs() {
|
|
|
|
+ if grep -Eq "$1" shadow.data/hosts/peer*/*.stdout ; then
|
|
|
|
+ echo "Found errors via pattern: $1"
|
|
|
|
+ ret=1
|
|
|
|
+ fi
|
|
|
|
+}
|
|
|
|
+
|
|
for group in ${!groups[@]} ; do
|
|
for group in ${!groups[@]} ; do
|
|
for name in ${groups[$group]} ; do
|
|
for name in ${groups[$group]} ; do
|
|
echo "$group,$name"
|
|
echo "$group,$name"
|
|
@@ -41,6 +48,8 @@ for group in ${!groups[@]} ; do
|
|
check_one_log "$name,$group,receive,.*,[0-9]+" 10
|
|
check_one_log "$name,$group,receive,.*,[0-9]+" 10
|
|
# users got at least 10 normal messages from this user in this group
|
|
# users got at least 10 normal messages from this user in this group
|
|
check_all_logs "$group,receive,.*,$name,[0-9]+" 10
|
|
check_all_logs "$group,receive,.*,$name,[0-9]+" 10
|
|
|
|
+ # users didn't get any errors
|
|
|
|
+ invert_check_all_logs "[Ee]rr"
|
|
done
|
|
done
|
|
done
|
|
done
|
|
|
|
|