repro-all-dockers 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/bash
  2. # Run a command on all three 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. # Duoram
  16. echo
  17. echo Running Duoram repro
  18. echo
  19. ( cd ../Docker && echo "Starting Duoram dockers" && echo && \
  20. ./start-docker && ./repro $* && echo "Stopping Duoram dockers" && \
  21. echo && ./stop-docker ) | tee $outputfile
  22. if [ ${PIPESTATUS[0]} != "0" ]; then
  23. exit 1
  24. fi
  25. # Floram
  26. echo
  27. echo Running Floram repro
  28. echo
  29. ( cd floram-docker && echo "Starting Floram dockers" && echo && \
  30. ./start-docker && ./repro $* && echo "Stopping Floram dockers" && \
  31. echo && ./stop-docker ) | tee -a $outputfile
  32. if [ ${PIPESTATUS[0]} != "0" ]; then
  33. exit 1
  34. fi
  35. # Circuit ORAM
  36. echo
  37. echo Running Circuit ORAM repro
  38. echo
  39. ( cd circuit-oram-docker/docker && echo "Starting Circuit ORAM dockers" && \
  40. echo && ./start-docker && ./repro $* && \
  41. echo "Stopping Circuit ORAM dockers" && \
  42. echo && ./stop-docker ) | tee -a $outputfile
  43. if [ ${PIPESTATUS[0]} != "0" ]; then
  44. exit 1
  45. fi
  46. # Show stanzas starting with "# $1" and ending with "# " in the input
  47. showstanza() {
  48. echo "# $1"
  49. sed -n "/# $1/,/# /{//!p;}"
  50. }
  51. echo
  52. echo "===== Collated output ====="
  53. echo
  54. if [ "$1" == "test" ]; then
  55. cat $outputfile | showstanza 'Test output'
  56. else
  57. cat $outputfile | showstanza 'Figure 7(a)'
  58. cat $outputfile | showstanza 'Figure 7(b)'
  59. cat $outputfile | showstanza 'Figure 7(c)'
  60. cat $outputfile | showstanza 'Figure 8(a)'
  61. cat $outputfile | showstanza 'Figure 8(b)'
  62. cat $outputfile | showstanza 'Figure 8(c)'
  63. cat $outputfile | showstanza 'Figure 9(a)'
  64. cat $outputfile | showstanza 'Figure 9(b)'
  65. cat $outputfile | showstanza 'Figure 9(c)'
  66. if [ "$DUORAM_EXTENDED_PLOTS" = "1" ]; then
  67. # Also show the plots for the extended version (Figures 11, 12)
  68. cat $outputfile | showstanza 'Figure 11(a)'
  69. cat $outputfile | showstanza 'Figure 11(b)'
  70. cat $outputfile | showstanza 'Figure 11(c)'
  71. cat $outputfile | showstanza 'Figure 12(a)'
  72. cat $outputfile | showstanza 'Figure 12(b)'
  73. cat $outputfile | showstanza 'Figure 12(c)'
  74. fi
  75. fi