autobuild.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/bin/sh
  2. #
  3. # This script is called by auto-build 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. # required packages
  13. which mock >/dev/null 2>&1
  14. if [ $? -ne 0 ]
  15. then
  16. echo 'please install mock (yum install mock).'
  17. exit 1
  18. fi
  19. MOCK=/usr/bin/mock
  20. git clean -xfd
  21. set -e
  22. echo 'running autogen ...'
  23. ./autogen.sh
  24. echo 'running configure ...'
  25. ./configure --enable-testagents --enable-watchdog --enable-monitoring
  26. echo 'building source rpm'
  27. rm -f *.src.rpm
  28. make srpm
  29. SRPM=$(ls *src.rpm)
  30. if [ ! -f $SRPM ]
  31. then
  32. echo $0 no source rpm to build from!
  33. exit 1
  34. fi
  35. if [ -z "$TARGET" ]
  36. then
  37. TARGET=fedora-12-x86_64
  38. fi
  39. RPM_DIR=/var/lib/mock/$TARGET/result
  40. rm -f $RPM_DIR/corosync*.rpm
  41. echo "running mock rebuild ($SRPM)"
  42. $MOCK -v -r $TARGET --no-clean --rebuild $SRPM --with testagents --with watchdog --with monitoring
  43. if [ -z "$TEST_NODES" ]
  44. then
  45. echo no test nodes, exiting without running cts.
  46. exit 0
  47. else
  48. # start the VMs, or leave them running?
  49. true
  50. fi
  51. RPM_LIST=
  52. for r in $RPM_DIR/corosync*.rpm
  53. do
  54. case $r in
  55. *src.rpm)
  56. ;;
  57. *-devel-*)
  58. ;;
  59. # *debuginfo*)
  60. # ;;
  61. *)
  62. RPM_LIST="$RPM_LIST $r"
  63. ;;
  64. esac
  65. done
  66. echo installing $RPM_LIST
  67. echo onto the test nodes $TEST_NODES
  68. # load and install rpm(s) onto the nodes
  69. for n in $TEST_NODES
  70. do
  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 --force -Uvf /tmp/corosync*.rpm"
  75. done
  76. echo 'running test ...'
  77. rm -f cts.log
  78. pushd cts
  79. # needs sudo to read /var/log/messages
  80. sudo -n ./corolab.py --nodes "$TEST_NODES" --outputfile ../cts.log
  81. popd