summaryrefslogtreecommitdiffstats
path: root/usr.bin/truncate/tests
diff options
context:
space:
mode:
authorasomers <asomers@FreeBSD.org>2016-01-19 22:07:39 +0000
committerasomers <asomers@FreeBSD.org>2016-01-19 22:07:39 +0000
commit41650356ddcc94166b6f248b597ae61bd4403b8f (patch)
treecf41eb54d782417fc3463e9815608abea8f8fed3 /usr.bin/truncate/tests
parent897a9bc5d3677b3f9053d7e36e77e8dc0aa373e0 (diff)
downloadFreeBSD-src-41650356ddcc94166b6f248b597ae61bd4403b8f.zip
FreeBSD-src-41650356ddcc94166b6f248b597ae61bd4403b8f.tar.gz
Fix usr.bin.truncate.truncate_test.bad_truncate with ZFS /tmp.
The bad_truncate test sets the uimmutable flag to produce an error in truncate, but that flag isn't supported by ZFS. If /tmp is on a ZFS filesystem, the test will fail. Change it to use readonly permissions and an unpriveleged user instead. Reviewed by: jilles MFC after: 1 week Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D4862
Diffstat (limited to 'usr.bin/truncate/tests')
-rw-r--r--usr.bin/truncate/tests/truncate_test.sh11
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.bin/truncate/tests/truncate_test.sh b/usr.bin/truncate/tests/truncate_test.sh
index e66f48a..369deba 100644
--- a/usr.bin/truncate/tests/truncate_test.sh
+++ b/usr.bin/truncate/tests/truncate_test.sh
@@ -173,26 +173,23 @@ bad_refer_body()
[ ! -e afile ] || atf_fail "afile should not exist"
}
-atf_test_case bad_truncate cleanup
+atf_test_case bad_truncate
bad_truncate_head()
{
atf_set "descr" "Verifies that truncate reports an error during" \
"truncation"
+ atf_set "require.user" "unprivileged"
}
bad_truncate_body()
{
- create_stderr_file "truncate: exists.txt: Operation not permitted"
+ create_stderr_file "truncate: exists.txt: Permission denied"
# Trying to get the ftruncate() call to return -1.
> exists.txt
- atf_check chflags uimmutable exists.txt
+ atf_check chmod 444 exists.txt
atf_check -s not-exit:0 -e file:stderr.txt truncate -s1 exists.txt
}
-bad_truncate_cleanup()
-{
- chflags 0 exists.txt
-}
atf_test_case new_absolute_grow
new_absolute_grow_head()
OpenPOWER on IntegriCloud