xref: /freebsd/contrib/pjdfstest/tests/truncate/11.t (revision 8ef24a0d4b28fe230e20637f56869cc4148cd2ca)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/11.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="truncate returns ETXTBSY the file is a pure procedure (shared text) file that is being executed"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9[ "${os}" = "FreeBSD" ] || quick_exit
10
11requires_exec
12
13echo "1..2"
14
15n0=`namegen`
16
17cp -pf `which sleep` ${n0}
18./${n0} 3 &
19while ! pkill -0 -f ./${n0}; do
20	sleep 0.1
21done
22expect ETXTBSY truncate ${n0} 123
23pkill -9 -f ./${n0}
24expect 0 unlink ${n0}
25