autobuild.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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-16-x86_64
  39. fi
  40. case $TARGET in
  41. fedora-15-x86_64)
  42. EXTRA_WITH=" --with systemd"
  43. ;;
  44. fedora-16-x86_64)
  45. EXTRA_WITH=" --with systemd"
  46. ;;
  47. fedora-17-x86_64)
  48. EXTRA_WITH=" --with systemd"
  49. ;;
  50. *)
  51. esac
  52. RPM_DIR=/var/lib/mock/$TARGET/result
  53. rm -f $RPM_DIR/corosync*.rpm
  54. $LOG "running mock rebuild ($SRPM)"
  55. $MOCK -v -r $TARGET --no-clean --rebuild $SRPM --with testagents --with watchdog --with monitoring $EXTRA_WITH
  56. if [ -z "$TEST_NODES" ]
  57. then
  58. $LOG no test nodes, exiting without running cts.
  59. exit 0
  60. else
  61. # start the VMs, or leave them running?
  62. true
  63. fi
  64. RPM_LIST=
  65. for r in $RPM_DIR/corosync*.rpm
  66. do
  67. case $r in
  68. *src.rpm)
  69. ;;
  70. *-devel-*)
  71. ;;
  72. *)
  73. RPM_LIST="$RPM_LIST $r"
  74. ;;
  75. esac
  76. done
  77. $LOG installing $RPM_LIST
  78. $LOG onto the test nodes $TEST_NODES
  79. # load and install rpm(s) onto the nodes
  80. for n in $TEST_NODES
  81. do
  82. $LOG "Installing onto $n"
  83. sudo ssh $n "rm -rf /tmp/corosync*.rpm"
  84. sudo ssh $n "rm -f /etc/corosync/corosync.conf.*"
  85. sudo scp $RPM_LIST $n:/tmp/
  86. sudo ssh $n "rpm --nodeps --force -Uvf /tmp/corosync*.rpm"
  87. done
  88. $LOG 'running CTS ...'
  89. CTS_LOG=$(pwd)/cts.log
  90. rm -f $CTS_LOG
  91. pushd cts
  92. # needs sudo to read /var/log/messages
  93. sudo -n ./corolab.py --nodes "$TEST_NODES" --outputfile $CTS_LOG $CTS_ARGS
  94. popd