12.t revision 271294
1271294Sngie#!/bin/sh 2271294Sngie# $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/12.t 211352 2010-08-15 21:24:17Z pjd $ 3271294Sngie 4271294Sngiedesc="chflags returns EROFS if the named file resides on a read-only file system" 5271294Sngie 6271294Sngiedir=`dirname $0` 7271294Sngie. ${dir}/../misc.sh 8271294Sngie 9271294Sngierequire chflags 10271294Sngie 11271294Sngiecase "${os}:${fs}" in 12271294SngieFreeBSD:UFS) 13271294Sngie echo "1..14" 14271294Sngie 15271294Sngie n0=`namegen` 16271294Sngie n1=`namegen` 17271294Sngie 18271294Sngie expect 0 mkdir ${n0} 0755 19271294Sngie n=`mdconfig -a -n -t malloc -s 1m` 20271294Sngie newfs /dev/md${n} >/dev/null 21271294Sngie mount /dev/md${n} ${n0} 22271294Sngie expect 0 create ${n0}/${n1} 0644 23271294Sngie expect 0 chflags ${n0}/${n1} UF_IMMUTABLE 24271294Sngie expect UF_IMMUTABLE stat ${n0}/${n1} flags 25271294Sngie expect 0 chflags ${n0}/${n1} none 26271294Sngie expect none stat ${n0}/${n1} flags 27271294Sngie mount -ur /dev/md${n} 28271294Sngie expect EROFS chflags ${n0}/${n1} UF_IMMUTABLE 29271294Sngie expect none stat ${n0}/${n1} flags 30271294Sngie mount -uw /dev/md${n} 31271294Sngie expect 0 chflags ${n0}/${n1} UF_IMMUTABLE 32271294Sngie expect UF_IMMUTABLE stat ${n0}/${n1} flags 33271294Sngie expect 0 chflags ${n0}/${n1} none 34271294Sngie expect none stat ${n0}/${n1} flags 35271294Sngie expect 0 unlink ${n0}/${n1} 36271294Sngie umount /dev/md${n} 37271294Sngie mdconfig -d -u ${n} 38271294Sngie expect 0 rmdir ${n0} 39271294Sngie ;; 40271294SngieFreeBSD:ZFS) 41271294Sngie echo "1..12" 42271294Sngie 43271294Sngie n0=`namegen` 44271294Sngie n1=`namegen` 45271294Sngie 46271294Sngie n=`mdconfig -a -n -t malloc -s 128m` 47271294Sngie zpool create ${n0} /dev/md${n} 48271294Sngie expect 0 create /${n0}/${n1} 0644 49271294Sngie expect 0 chflags /${n0}/${n1} UF_NODUMP 50271294Sngie expect UF_NODUMP stat /${n0}/${n1} flags 51271294Sngie expect 0 chflags /${n0}/${n1} none 52271294Sngie expect none stat /${n0}/${n1} flags 53271294Sngie zfs set readonly=on ${n0} 54271294Sngie expect EROFS chflags /${n0}/${n1} UF_NODUMP 55271294Sngie expect none stat /${n0}/${n1} flags 56271294Sngie zfs set readonly=off ${n0} 57271294Sngie expect 0 chflags /${n0}/${n1} UF_NODUMP 58271294Sngie expect UF_NODUMP stat /${n0}/${n1} flags 59271294Sngie expect 0 chflags /${n0}/${n1} none 60271294Sngie expect none stat /${n0}/${n1} flags 61271294Sngie expect 0 unlink /${n0}/${n1} 62271294Sngie zpool destroy ${n0} 63271294Sngie mdconfig -d -u ${n} 64271294Sngie ;; 65271294Sngie*) 66271294Sngie quick_exit 67271294Sngie ;; 68271294Sngieesac 69