summaryrefslogtreecommitdiffhomepage
path: root/pipeline/read.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pipeline/read.sh')
-rwxr-xr-xpipeline/read.sh21
1 files changed, 18 insertions, 3 deletions
diff --git a/pipeline/read.sh b/pipeline/read.sh
index b3129a5..ddbebe4 100755
--- a/pipeline/read.sh
+++ b/pipeline/read.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/usr/bin/env sh
# Every reader and both libraries, over every document, into $OUT/read/.
#
# What each produces:
@@ -7,6 +7,8 @@
# read/db-{d,g}/<doc>.txt the .ocda.db readers' summary
# read/dump-{d,g}/<doc>.ssp the library's dump, loaded from the .ssp
# read/dump-{d,g}/<doc>.db the same, loaded from the .ocda.db
+# read/read-{d,g}/<doc>.ssp ocda-read --tree, reading the .ssp
+# read/read-{d,g}/<doc>.db the same, reading the .ocda.db
#
# The dumps are the interesting ones. All four of them should be identical:
# the two serialisations say the same thing, and the two languages read it the
@@ -15,12 +17,12 @@ set -e
. "$(dirname "$0")/config.sh"
: "${ARTEFACTS:?set ARTEFACTS to a directory of .ssp and .ocda.db files}"
mkdir -p "$OUT/read"
-for d in ssp-d ssp-g db-d db-g dump-d dump-g; do mkdir -p "$OUT/read/$d"; done
+for d in ssp-d ssp-g db-d db-g dump-d dump-g read-d read-g; do mkdir -p "$OUT/read/$d"; done
list=$(find "$ARTEFACTS" -name '*.ssp' | sort)
[ -n "$LIMIT" ] && list=$(echo "$list" | head -n "$LIMIT")
-n=0; same=0
+n=0; same=0; read_same=0
for ssp in $list; do
stem=$(basename "$ssp" .ssp); lang=${stem##*.}; uid=${stem%.*}
db=$(find "$ARTEFACTS" -name "$uid.ocda.db" | head -1)
@@ -41,7 +43,20 @@ for ssp in $list; do
then same=$((same+1))
else echo "DUMPS DIFFER $stem"
fi
+ # ocda-read: the same from either form, and the same in either language,
+ # the first line, which names the file read, set aside
+ sh "$(dirname "$0")/one.sh" read-d "$ssp" "$lang" --tree | tail -n +2 > "$OUT/read/read-d/$stem.ssp"
+ sh "$(dirname "$0")/one.sh" read-g "$ssp" "$lang" --tree | tail -n +2 > "$OUT/read/read-g/$stem.ssp"
+ sh "$(dirname "$0")/one.sh" read-d "$db" "$lang" --tree | tail -n +2 > "$OUT/read/read-d/$stem.db"
+ sh "$(dirname "$0")/one.sh" read-g "$db" "$lang" --tree | tail -n +2 > "$OUT/read/read-g/$stem.db"
+ if cmp -s "$OUT/read/read-d/$stem.ssp" "$OUT/read/read-d/$stem.db" \
+ && cmp -s "$OUT/read/read-g/$stem.ssp" "$OUT/read/read-g/$stem.db" \
+ && cmp -s "$OUT/read/read-d/$stem.ssp" "$OUT/read/read-g/$stem.ssp"
+ then read_same=$((read_same+1))
+ else echo "OCDA-READ DIFFERS $stem"
+ fi
done
echo
echo "documents read: $n"
echo "all four dumps identical $same"
+echo "ocda-read, all four identical $read_same"