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