• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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# Try to write "FREEZING" into the freezer.state while freezer.state ==
23# "THAWED". This should result in an error (EIO) and should not change
24# the freezer state.
25#
26
27. "${CGROUPS_TESTROOT}/libcgroup_freezer"
28SETS_DEFAULTS="${TCID=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	"${CG_FILE_WRITE}" "FREEZING" > freezer.state 2>&1 | \
43		grep -E 'Input/output error$'
44	assert_cgroup_freezer_state "THAWED" "ERROR: writing FREEZING to freezer.state should not change freezer state (expected IO error)"
45	result=$FINISHED
46	break
47done
48trap '' ERR
49cleanup_cgroup_test
50tst_resm TINFO " Cleaning up $0"
51
52rm_sample_cgroup ; }
53umount_freezer ; }
54
55# Failsafe cleanup
56cleanup_freezer || /bin/true
57
58exit $result
59