Skip to content

Commit

Permalink
Test: Fail codegen_verification if dump_genesis.sh is bad (#4277)
Browse files Browse the repository at this point in the history
Fail codegen_verification if dump_genesis.sh is bad
  • Loading branch information
jannotti authored Jul 21, 2022
1 parent 1484b56 commit 2a933eb
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions scripts/dump_genesis.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env bash

# Fail if anything goes wrong
set -e
set -o pipefail

if [ "$1" = "" ]; then
echo "Usage: $0 genesis.json"
exit 1
Expand All @@ -11,9 +15,9 @@ trap "rm -r $D" 0
GENJSON="$1"
UNAME=$(uname)
if [[ "${UNAME}" == *"MINGW"* ]]; then
GOPATH1=$HOME/go
GOPATH1=$HOME/go
else
GOPATH1=$(go env GOPATH | cut -d: -f1)
GOPATH1=$(go env GOPATH | cut -d: -f1)
fi
$GOPATH1/bin/algod -d $D -g "$GENJSON" -x >/dev/null
LEDGERS=$D/*/ledger.*sqlite
Expand All @@ -40,7 +44,7 @@ for LEDGER in $LEDGERS; do
SORT=id
;;
onlineroundparamstail)
SORT=round
SORT=rnd
;;
participationperiods)
SORT=period
Expand All @@ -64,7 +68,7 @@ for LEDGER in $LEDGERS; do
SORT=address
;;
txtail)
SORT=round
SORT=rnd
;;
catchpointfirststageinfo)
SORT=round
Expand All @@ -78,9 +82,9 @@ for LEDGER in $LEDGERS; do
;;
esac

echo ".schema $T" | sqlite3 $LEDGER
echo ".schema $T" | sqlite3 "$LEDGER"
( echo .headers on;
echo .mode insert $T;
echo "SELECT * FROM $T ORDER BY $SORT;" ) | sqlite3 $LEDGER
echo .mode insert "$T";
echo "SELECT * FROM $T ORDER BY $SORT;" ) | sqlite3 "$LEDGER"
done
done

0 comments on commit 2a933eb

Please sign in to comment.