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