autobuild.sh 1.8 KB

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