aboutsummaryrefslogtreecommitdiff
path: root/bin/cp/tests
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2025-05-31 18:07:57 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2025-05-31 18:08:12 +0000
commit81df032813595a7c79e55bcba0c4e5d660451b58 (patch)
tree92ea27f024e806f153f45c6a55f1dc09dbb9e076 /bin/cp/tests
parent6d3d1fc3a30453be19831f79399bcba0ae822ad1 (diff)
Diffstat (limited to 'bin/cp/tests')
-rwxr-xr-xbin/cp/tests/cp_test.sh17
1 files changed, 9 insertions, 8 deletions
diff --git a/bin/cp/tests/cp_test.sh b/bin/cp/tests/cp_test.sh
index 8511904a0e33..5e9a1899ff75 100755
--- a/bin/cp/tests/cp_test.sh
+++ b/bin/cp/tests/cp_test.sh
@@ -573,22 +573,23 @@ dstmode_body()
atf_test_case to_root cleanup
to_root_head()
{
- atf_set "require.user" "root"
+ atf_set "require.user" "unprivileged"
}
to_root_body()
{
- dst="$(atf_get ident).$$"
+ dst="test.$(atf_get ident).$$"
echo "$dst" >dst
echo "foo" >"$dst"
- atf_check cp "$dst" /
- atf_check cmp -s "$dst" "/$dst"
- atf_check rm "/$dst"
- atf_check cp "$dst" //
- atf_check cmp -s "$dst" "/$dst"
+ atf_check -s not-exit:0 \
+ -e match:"^cp: /$dst: (Permission|Read-only)" \
+ cp "$dst" /
+ atf_check -s not-exit:0 \
+ -e match:"^cp: /$dst: (Permission|Read-only)" \
+ cp "$dst" //
}
to_root_cleanup()
{
- (dst=$(cat dst) && [ -n "/$dst" ] && [ -f "/$dst" ] && rm "/$dst") || true
+ (dst=$(cat dst) && rm "/$dst") 2>/dev/null || true
}
atf_init_test_cases()