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