freeze_write_freezing.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/bash
  2. # Copyright (c) International Business Machines Corp., 2008
  3. # Author: Matt Helsley <matthltc@us.ibm.com>
  4. #
  5. # This library is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU Lesser General Public
  7. # License as published by the Free Software Foundation; either
  8. # version 2.1 of the License, or (at your option) any later version.
  9. #
  10. # This library is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. # Lesser General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Lesser General Public
  16. # License along with this library; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. #
  19. #
  20. # Freeze the cgroup and then make sure that writing "FREEZING" into
  21. # freezer.state reports an error (EIO) and doesn't change the freezer's state
  22. # (which was "FROZEN").
  23. #
  24. . "${CGROUPS_TESTROOT}/libcgroup_freezer"
  25. SETS_DEFAULTS="${TCID=freeze_write_freezing.sh} ${TST_COUNT=1} ${TST_TOTAL=1}"
  26. declare -r TCID
  27. declare -r TST_COUNT
  28. declare -r TST_TOTAL
  29. export TCID TST_COUNT TST_TOTAL
  30. running_cgroup_test
  31. mount_freezer && {
  32. make_sample_cgroup && {
  33. while /bin/true ; do
  34. trap 'break' ERR
  35. assert_cgroup_freezer_state "THAWED" \
  36. "ERROR: cgroup freezer started in non-THAWED state"
  37. issue_freeze_cmd
  38. wait_until_frozen
  39. "${CG_FILE_WRITE}" "FREEZING" > freezer.state 2>&1 | \
  40. grep -E 'Input/output error$'
  41. assert_cgroup_freezer_state "FROZEN" "ERROR: writing FREEZING to freezer.state should not change freezer state from FROZEN (expected IO error)"
  42. result=$FINISHED
  43. break
  44. done
  45. trap '' ERR
  46. cleanup_cgroup_test
  47. tst_resm TINFO " Cleaning up $0"
  48. rm_sample_cgroup ; }
  49. umount_freezer ; }
  50. # Failsafe cleanup
  51. cleanup_freezer || /bin/true
  52. exit $result