sh: Add simple test for 'set -C' (noclobber).

To ensure fast test runs, race conditions are not tested.
This commit is contained in:
Jilles Tjoelker 2016-11-02 22:33:37 +00:00
parent 75409ce1dd
commit 3c47cee5c8
2 changed files with 13 additions and 0 deletions

View File

@ -37,6 +37,7 @@ ${PACKAGE}FILES+= redir4.0
${PACKAGE}FILES+= redir5.0
${PACKAGE}FILES+= redir6.0
${PACKAGE}FILES+= redir7.0
${PACKAGE}FILES+= set-C1.0
${PACKAGE}FILES+= set-n1.0
${PACKAGE}FILES+= set-n2.0
${PACKAGE}FILES+= set-n3.0

View File

@ -0,0 +1,12 @@
# $FreeBSD$
T=$(mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX") || exit
trap 'rm -rf "$T"' 0
set -C
echo . >"$T/a" &&
[ -s "$T/a" ] &&
{ ! true >"$T/a"; } 2>/dev/null &&
[ -s "$T/a" ] &&
ln -s /dev/null "$T/b" &&
true >"$T/b"