Skip to content

v0.2.52..v0.2.53 changeset ConflateCmdStatsToyRoadsTest.sh

Garret Voltz edited this page Feb 12, 2020 · 1 revision
diff --git a/test-files/cmd/slow/ConflateCmdStatsToyRoadsTest.sh b/test-files/cmd/slow/ConflateCmdStatsToyRoadsTest.sh
new file mode 100755
index 0000000..a569969
--- /dev/null
+++ b/test-files/cmd/slow/ConflateCmdStatsToyRoadsTest.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+set -e
+
+IN_DIR=test-files/cmd/slow/ConflateCmdStatsTest
+OUT_DIR=test-output/cmd/slow/ConflateCmdStatsTest
+mkdir -p $OUT_DIR
+STATS_OUT=$OUT_DIR/toy-roads-out
+SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+
+HOOT_OPTS="-C Testing.conf -C UnifyingAlgorithm.conf -C ReferenceConflation.conf -D writer.include.debug.tags=true"
+
+hoot conflate $HOOT_OPTS test-files/ToyTestA.osm test-files/ToyTestB.osm $STATS_OUT.osm --stats > $STATS_OUT
+
+hoot diff $STATS_OUT.osm $IN_DIR/toy-roads-out.osm || diff $STATS_OUT.osm $IN_DIR/toy-roads-out.osm
+
+#read in a set of stat names from a file, delete them from the hoot command stats output, and write the remaining stats to the final output
+EDIT_CMD=""
+while read line
+do
+  #replace new lines with spaces and then remove the trailing whitespace
+  MODIFIED_LINE=`echo "$line"|tr '\n' ' '|sed -e 's/[ \t]*$//'`
+  EDIT_CMD=$EDIT_CMD" -e '/"$MODIFIED_LINE"/d'"
+done < $SCRIPT_DIR/ConflateCmdStatsTest.conf
+EDIT_CMD="sed "$EDIT_CMD" "$STATS_OUT" | sed -n -e '/stats =/,\$p'"
+eval $EDIT_CMD
Clone this wiki locally