4
0

autobuild.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/bin/sh
  2. #
  3. # This script is called by buildbot to test
  4. # corosync. It is run continously to help catch regressions.
  5. #
  6. # ENVIRONMENT variables that affect it's behaviour:
  7. #
  8. # TEST_NODES - the hostnames of the nodes to be tested
  9. # TARGET - this is used by mock so look in /etc/mock for
  10. # possible options.
  11. #
  12. LOG="echo CTS: "
  13. # required packages
  14. which mock >/dev/null 2>&1
  15. if [ $? -ne 0 ]
  16. then
  17. $LOG 'please install mock (yum install mock).'
  18. exit 1
  19. fi
  20. MOCK=/usr/bin/mock
  21. git clean -xfd
  22. set -e
  23. $LOG 'running autogen ...'
  24. ./autogen.sh
  25. $LOG 'running configure ...'
  26. ./configure --enable-testagents --enable-watchdog --enable-monitoring
  27. $LOG 'building source rpm'
  28. rm -f *.src.rpm
  29. make srpm
  30. SRPM=$(ls *src.rpm)
  31. if [ ! -f $SRPM ]
  32. then
  33. $LOG no source rpm to build from!
  34. exit 1
  35. fi
  36. if [ -z "$TARGET" ]
  37. then
  38. TARGET=fedora-14-x86_64
  39. fi
  40. RPM_DIR=/var/lib/mock/$TARGET/result
  41. rm -f $RPM_DIR/corosync*.rpm
  42. $LOG "running mock rebuild ($SRPM)"
  43. $MOCK -v -r $TARGET --no-clean --rebuild $SRPM --with testagents --with watchdog --with monitoring
  44. if [ -z "$TEST_NODES" ]
  45. then
  46. $LOG no test nodes, exiting without running cts.
  47. exit 0
  48. else
  49. # start the VMs, or leave them running?
  50. true
  51. fi
  52. RPM_LIST=
  53. for r in $RPM_DIR/corosync*.rpm
  54. do
  55. case $r in
  56. *src.rpm)
  57. ;;
  58. *-devel-*)
  59. ;;
  60. *)
  61. RPM_LIST="$RPM_LIST $r"
  62. ;;
  63. esac
  64. done
  65. $LOG installing $RPM_LIST
  66. $LOG onto the test nodes $TEST_NODES
  67. # load and install rpm(s) onto the nodes
  68. for n in $TEST_NODES
  69. do
  70. $LOG "Installing onto $n"
  71. ssh $n "rm -rf /tmp/corosync*.rpm"
  72. ssh $n "rm -f /etc/corosync/corosync.conf.*"
  73. scp $RPM_LIST $n:/tmp/
  74. ssh $n "rpm --nodeps --force -Uvf /tmp/corosync*.rpm"
  75. done
  76. $LOG 'running CTS ...'
  77. CTS_LOG=$(pwd)/cts.log
  78. rm -f $CTS_LOG
  79. pushd cts
  80. # needs sudo to read /var/log/messages
  81. sudo -n ./corolab.py --nodes "$TEST_NODES" --outputfile $CTS_LOG $CTS_ARGS
  82. popd