forked from jbuehl/solaredge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·30 lines (26 loc) · 937 Bytes
/
test.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
#!/bin/bash -e
export TZ='US/Pacific'
for pcap in `ls test/pcap`
do
TMP=$(mktemp -d)
if [ -z "${TMP}" ]; then
echo "Failed to create temporary directory '${TMP}'"
break
fi
TMPSE2CSV="${TMP}/se2csv"
SAMPLE="${pcap%.*}"
KEY_OPTION=""
if [ -f "test/keys/${SAMPLE}.key" ]
then
KEY_OPTION="-k test/keys/${SAMPLE}.key"
fi
echo "Running test sample: ${SAMPLE}"
echo "Key option: ${KEY_OPTION}"
tshark -r "test/pcap/${SAMPLE}.pcap" -T fields -e data | ./utilities/unhexlify.py | ./semonitor.py -r "${TMP}/${SAMPLE}.rec" -o "${TMP}/${SAMPLE}.json" - $KEY_OPTION
diff "${TMP}/${SAMPLE}.json" "test/json/${SAMPLE}.json"
cmp -l "${TMP}/${SAMPLE}.rec" "test/rec/${SAMPLE}.rec"
mkdir "${TMPSE2CSV}"
cat "test/json/${SAMPLE}.json" | conversion/se2csv.py -p "${TMPSE2CSV}/${SAMPLE}" -t
diff "${TMP}/se2csv" "test/csv/${SAMPLE}/" -w
rm -rf "${TMP}"
done