autobuild.sh 1.7 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. set -e
  21. echo 'running autogen ...'
  22. ./autogen.sh
  23. echo 'running configure ...'
  24. ./configure
  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 init ($TARGET)"
  41. $MOCK -r $TARGET --init
  42. echo "running mock rebuild ($SRPM)"
  43. $MOCK -v -r $TARGET --rebuild $SRPM --with testagents
  44. if [ -z "$TEST_NODES" ]
  45. then
  46. echo 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. # *debuginfo*)
  61. # ;;
  62. *)
  63. RPM_LIST="$RPM_LIST $r"
  64. ;;
  65. esac
  66. done
  67. echo installing $RPM_LIST
  68. echo onto the test nodes $TEST_NODES
  69. # load and install rpm(s) onto the nodes
  70. for n in $TEST_NODES
  71. do
  72. ssh $n "rm -rf /tmp/corosync*.rpm"
  73. ssh $n "rm -f /etc/corosync/corosync.conf.*"
  74. scp $RPM_LIST $n:/tmp/
  75. ssh $n "rpm --force -Uvf /tmp/corosync*.rpm"
  76. done
  77. echo 'running test ...'
  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
  82. popd