run-continuously.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. #
  3. # Sets up and runs the benchmarking suite in an infinite loop. The intent is
  4. # this script would be run by a service such as upstart, restarting if the
  5. # scripts fail.
  6. #
  7. # The following environment variables must
  8. # be set:
  9. # $TFB_REPOPARENT parent folder of the repository
  10. # $TFB_REPONAME name of the repository folder
  11. # $TFB_REPOURI URI for the git repository
  12. # $TFB_MAILINGLIST email address for the mailing list
  13. # $TFB_LOGSFOLDER location to transfer logged output
  14. #
  15. # @author A. Shawn Bandy
  16. #
  17. while true
  18. do
  19. # Tear down the environment
  20. # Note: we tear down first so that we can know the state of the environment
  21. # regardless of the outcome of prior runs.
  22. if [ -d "$TFB_REPOPARENT/$TFB_REPONAME" ]; then
  23. cp $TFB_REPOPARENT/$TFB_REPONAME/benchmark.cfg $TFB_REPOPARENT/
  24. cp $TFB_REPOPARENT/$TFB_REPONAME/toolset/lifecycle/rebuild-environment.sh $TFB_REPOPARENT/
  25. echo Tearing down previous environment
  26. $TFB_REPOPARENT/$TFB_REPONAME/toolset/lifecycle/tear-down-environment.sh
  27. fi
  28. # Rebuild environment (i.e. clone the repository)
  29. echo Rebuilding environment
  30. $TFB_REPOPARENT/rebuild-environment.sh
  31. echo Returning benchmark configuration file
  32. cp $TFB_REPOPARENT/benchmark.cfg $TFB_REPOPARENT/$TFB_REPONAME/
  33. # Handle any preprocessing (e.g. send metadata)
  34. echo Running pre-test tasks
  35. for SCRIPT in $TFB_REPOPARENT/$TFB_REPONAME/toolset/lifecycle/pre-run-tests/*
  36. do
  37. if [ -f $SCRIPT -a -x $SCRIPT ]
  38. then
  39. $SCRIPT
  40. fi
  41. done
  42. sleep 5
  43. # Run the benchmarks
  44. echo Change to benchmark root
  45. cd $TFB_REPOPARENT/$TFB_REPONAME
  46. echo Run tests
  47. toolset/run-tests.py
  48. # Handle any postprocessing
  49. echo Running post-test tasks
  50. for SCRIPT in $TFB_REPOPARENT/$TFB_REPONAME/toolset/lifecycle/post-run-tests/*
  51. do
  52. if [ -f $SCRIPT -a -x $SCRIPT ]
  53. then
  54. $SCRIPT
  55. fi
  56. done
  57. sleep 5
  58. done