-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add swingset-runner bulk demo running tool
- Loading branch information
Showing
6 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--prime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--prime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--bestatic | ||
--bedynamic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
simpleExchangeOk | ||
simpleExchangeNotifier | ||
autoswapOk | ||
automaticRefundOk | ||
coveredCallOk | ||
swapForOptionOk | ||
secondPriceAuctionOk | ||
atomicSwapOk | ||
simpleExchangeOk | ||
simpleExchangeNotifier | ||
autoswapOk | ||
sellTicketsOk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash | ||
|
||
# Run each demo in the demo directory | ||
# | ||
# If a demo has a swingset config file, use that, else use the default config | ||
# loader. If it has more than one config file, run each one in turn. | ||
# | ||
# If a demo directory contains a file `sampleArgs`, do a run for each line of | ||
# the file, applying the contents of each line in turn as the buildRootObject | ||
# vatParameters.argv value, else just run the demo once. | ||
|
||
shopt -s nullglob | ||
|
||
# output timing data in a usable format | ||
export TIMEFORMAT='%Uu %Ss %R' | ||
|
||
# Process command line args | ||
# --time runs the runner with the Unix `time` command | ||
# --dump applies the runner --dump flag but ensures per-run dump files | ||
# --dryrun outputs the commands but doesn't actually execute them | ||
# all other args are passed to the runner | ||
for arg in "$@"; do | ||
case $arg in | ||
--time) | ||
dotime=1 | ||
;; | ||
--dump) | ||
dodump=1 | ||
;; | ||
--dryrun) | ||
dryrun=1 | ||
;; | ||
*) | ||
arglist="$arglist $arg" | ||
;; | ||
esac | ||
done | ||
|
||
runct=1 | ||
function runone { | ||
cmd="bin/runner" | ||
if [ $dryrun ]; then | ||
cmd="echo ${cmd}" | ||
fi | ||
cmdargs=$arglist | ||
if [ $dodump ]; then | ||
cmdargs="$cmdargs --dump --dumptag t${runct}-" | ||
fi | ||
cmdline="$cmd $cmdargs $@" | ||
echo "$cmdline" | ||
if [ $dotime ]; then | ||
time $cmdline > rlog-${runct} | ||
else | ||
$cmdline > rlog-${runct} | ||
fi | ||
((runct=runct+1)) | ||
} | ||
|
||
function rundemo { | ||
dir=$1 | ||
target=$2 | ||
|
||
if [ -f "${dir}/sampleArgs" ]; then | ||
while read line; do | ||
runone $target "-- ${line}" | ||
done < ${dir}/sampleArgs | ||
else | ||
runone $target | ||
fi | ||
} | ||
|
||
for demo in demo/*; do | ||
hadconf=0 | ||
for conf in ${demo}/*.json; do | ||
rundemo $demo "--config $conf run" | ||
hadconf=1 | ||
done | ||
if [ "$hadconf" == "0" ]; then | ||
rundemo $demo "run $demo" | ||
fi | ||
done |