repro-all-dockers 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #!/bin/bash
  2. # Run a command on all five repro scripts
  3. # cd into the directory containing this script (from the bash faq 028)
  4. if [[ $BASH_SOURCE = */* ]]; then
  5. cd -- "${BASH_SOURCE%/*}/" || exit
  6. fi
  7. outputfile=$$.repro.log
  8. cleanup() {
  9. rm -f $outputfile
  10. exit
  11. }
  12. trap cleanup EXIT SIGINT
  13. # Stop any running dockers
  14. ./stop-all-dockers
  15. # PRAC
  16. echo
  17. echo Running PRAC repro
  18. echo
  19. ( cd ../docker && echo "Starting PRAC dockers" && echo && \
  20. ./start-docker && ./set-networking 30ms 100mbit && \
  21. ../repro/repro $* && echo "Stopping PRAC dockers" && \
  22. echo && ./stop-docker ) | tee $outputfile
  23. if [ ${PIPESTATUS[0]} != "0" ]; then
  24. exit 1
  25. fi
  26. # Duoram
  27. echo
  28. echo Running Duoram repro
  29. echo
  30. ( cd comps/duoram/Docker && echo "Starting Duoram dockers" && echo && \
  31. ./start-docker && ./set-networking 30ms 100mbit && \
  32. ./repro $* && echo "Stopping Duoram dockers" && \
  33. echo && ./stop-docker ) | tee -a $outputfile
  34. if [ ${PIPESTATUS[0]} != "0" ]; then
  35. exit 1
  36. fi
  37. # Floram
  38. echo
  39. echo Running Floram repro
  40. echo
  41. ( cd comps/floram && echo "Starting Floram dockers" && echo && \
  42. ./start-docker && ./set-networking 30ms 100mbit && \
  43. ./prac/repro $* && echo "Stopping Floram dockers" && \
  44. echo && ./stop-docker ) | tee -a $outputfile
  45. if [ ${PIPESTATUS[0]} != "0" ]; then
  46. exit 1
  47. fi
  48. # Circuit ORAM
  49. echo
  50. echo Running Circuit ORAM repro
  51. echo
  52. ( cd comps/circuit-oram/docker && echo "Starting Circuit ORAM dockers" && \
  53. echo && ./start-docker && ./set-networking 30ms 100mbit && \
  54. ../prac/repro $* && echo "Stopping Circuit ORAM dockers" && \
  55. echo && ./stop-docker ) | tee -a $outputfile
  56. if [ ${PIPESTATUS[0]} != "0" ]; then
  57. exit 1
  58. fi
  59. # Ramen
  60. echo
  61. echo Running Ramen repro
  62. echo
  63. ( cd comps/ramen/Docker && echo "Starting Ramen dockers" && \
  64. echo && ./start-docker && ./set-networking 30ms 100mbit && \
  65. ../repro/repro $* && echo "Stopping Ramen dockers" && \
  66. echo && ./stop-docker ) | tee -a $outputfile
  67. if [ ${PIPESTATUS[0]} != "0" ]; then
  68. exit 1
  69. fi
  70. # Show stanzas starting with "# $1" and ending with "# " in the input
  71. showstanza() {
  72. echo "# $1"
  73. sed -n "/# $1/,/# /{//!p;}"
  74. }
  75. echo
  76. echo "===== Collated output ====="
  77. echo
  78. if [ "$1" == "test" ]; then
  79. cat $outputfile | showstanza 'Test output'
  80. else
  81. cat $outputfile | showstanza 'Figure 6(a)'
  82. cat $outputfile | showstanza 'Figure 6(b)'
  83. cat $outputfile | showstanza 'Figure 6(c)'
  84. cat $outputfile | showstanza 'Figure 7(a)'
  85. cat $outputfile | showstanza 'Figure 7(b)'
  86. cat $outputfile | showstanza 'Figure 7(c)'
  87. cat $outputfile | showstanza 'Figure 8(a)'
  88. cat $outputfile | showstanza 'Figure 8(b)'
  89. cat $outputfile | showstanza 'Figure 8(c)'
  90. cat $outputfile | showstanza 'Table 3'
  91. cat $outputfile | showstanza 'Table 4'
  92. cat $outputfile | showstanza 'Figure 9'
  93. fi