| 1 |
#!/bin/bash -e |
| 2 |
|
| 3 |
# NOTE: |
| 4 |
# This script compares the data imported into the database by run-importer-test |
| 5 |
# with the data in good/ (successfully imported and moved files). |
| 6 |
# Limitation: only the headers #T, #P are compared, not the Traceroute hops!! |
| 7 |
|
| 8 |
if [ $# -ne 1 ] ; then |
| 9 |
echo >&2 "Usage: $0 configuration_file" |
| 10 |
exit 1 |
| 11 |
fi |
| 12 |
if [ ! -e $1 ] ; then |
| 13 |
echo >&2 "ERROR: Use configuration $1 does not exist!" |
| 14 |
fi |
| 15 |
CONFIGURATION_FILE="$1" |
| 16 |
|
| 17 |
|
| 18 |
for type in Ping Traceroute ; do |
| 19 |
|
| 20 |
echo "Obtaining ${type} data from good/ directory ..." |
| 21 |
find good/ -name "${type}-*.bz2" | sort | xargs -r bzcat | tee imported-raw-${type,,}.txt | grep "^#" | sort -k4 >imported-${type,,}.txt |
| 22 |
# ls -l imported-raw-${type,,}.txt imported-${type,,}.txt |
| 23 |
|
| 24 |
|
| 25 |
echo "Querying ${type} data from database ..." |
| 26 |
./hpct-query "${CONFIGURATION_FILE}" ${type,,} | tee queried-raw-${type,,}.txt | grep "^#" | sort -k4 >queried-${type,,}.txt |
| 27 |
# ls -l queried-raw-${type,,}.txt queried-${type,,}.txt |
| 28 |
|
| 29 |
echo "Differences for ${type}:" |
| 30 |
if [ "${type}" == "Traceroute" ] ; then |
| 31 |
ls -l imported-raw-${type,,}.txt |
| 32 |
ls -l queried-raw-${type,,}.txt |
| 33 |
fi |
| 34 |
colordiff imported-${type,,}.txt queried-${type,,}.txt |
| 35 |
|
| 36 |
done |