#!/bin/bash fast=false sequential=false ncpus="" cpurange="" while [ -n "$1" ]; do if [ "$1" == "--fast" ]; then fast=true elif [ "$1" == "-n" ]; then ncpus="$2" shift elif [ "$1" == "-N" ]; then cpurange="$2" shift fi shift done abort() { echo "Step $1 failed." echo "To restart from this step, try running:" if [ "$1" == "setup" ]; then echo " rm -rf belarus-2020-2021 cmz lox-new lox-old sigma-compiler simga-proofs spongefish" elif [ "$1" == "belarus" ]; then echo " rm -rf appendix-a-results.{pdf,tex} appendix-a-results" echo " docker stop tp-belarus" echo " docker rm tp-belarus" elif [ "$1" == "lox-gen" ]; then echo " rm -rf parsing-results/{lox-{old,new},troll-patrol}" echo " docker stop {lox-{old,new},troll-patrol}-{trust_levels,invitations,blockage_migration{05,50,100}}.log troll-patrol-reporting.log" echo " docker rm {lox-{old,new},troll-patrol}-{trust_levels,invitations,blockage_migration{05,50,100}}.log troll-patrol-reporting.log" elif [ "$1" == "lox-eval" ]; then echo " rm -f appendix-c-results.{pdf,tex} table-{2,3}-results.{pdf,tex}" echo " docker stop tp-lox" echo " docker rm tp-lox" fi echo "Then run this script again." echo "Exiting..." exit 1 } # Set up dockers if [ ! -d troll-patrol ]; then # Clean up any remnants of previous attempts and try again rm -rf belarus-2020-2021 cmz lox-new lox-old sigma-compiler simga-proofs spongefish # Set up our dockers ./scripts/setup.sh || abort "setup" fi # Run Lox benchmarks if [[ ! -d parsing-results/lox-old || ! -d parsing-results/lox-new || ! -d parsing-results/troll-patrol ]]; then # Clean up any remnants of previous attempts and try again rm -rf parsing-results/{lox-{old,new},troll-patrol} # Arguments here may be empty; the generate-lox-results.sh script handles this case ./scripts/generate-lox-results.sh -N "$cpurange" -n "$ncpus" || abort "lox-gen" fi # Process Lox benchmark results if [[ ! -f appendix-c-results.pdf || ! -f table-2-results.pdf || ! -f table-3-results.pdf ]]; then # Clean up any remnants of previous attempts and try again rm -f appendix-c-results.{pdf,tex} table-{2,3}-results.{pdf,tex} ./scripts/process-lox-results.sh || abort "lox-eval" fi # Get Belarus results if [[ ! -f appendix-a-results.pdf || ! -f appendix-a-results ]]; then # Clean up any remnants of previous attempts and try again rm -f appendix-a-results.{pdf,tex} appendix-a-results if [ "$fast" == "true" ]; then ./scripts/belarus.sh --fast || abort "belarus" else ./scripts/belarus.sh || abort "belarus" fi fi echo "Done!" echo "Results from Section 6 (Tables 2 and 3) can be found in the table-2-results.pdf and table-3-results.pdf files." echo "Table 5 (in Appendix C) can be found in appendix-c-results.pdf." echo "Results from Appendix A can be found in the appendix-a-results file." echo "Table 4 (in Appendix A) can be found in appendix-a-results.pdf."