aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-07-08 04:30:00 -0500
committerRob Landley <rob@landley.net>2021-07-08 04:30:00 -0500
commit127cff38809ea6c3a37ed3ce7f428cafdc38e2e1 (patch)
tree7de5bc21a2e7cee3e9d76c23ec1cf5ba409cb0b3 /tests
parent3fbacb1f5c5eab1727d0bed0bd50d659af854ec7 (diff)
downloadtoybox-127cff38809ea6c3a37ed3ce7f428cafdc38e2e1.tar.gz
Work around a posix violation in the croups filesystem that LTP requires.
Posix says you removing a non-empty directory "shall fail" in both: https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/unlinkat.html https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/rmdir.html So toybox mv went ahead and unlinked the directory even if the contents hadn't all been deleted because posix guarantees it to be harmless. But cgroups (https://lwn.net/Articles/679786/) deletes the non-empty directory, thus the Linux Test Project's cgroups_fj_function test6 was failing with toybox mv because they depend on not triggering the posix violating behavior. Work around it by having mv DIRTREE_SAVE failing nodes and then check for a non-empty ->child in the COMEAGAIN as a signal not to unlink the dir. While I'm there do some code cleanup, add a cp -i test...
Diffstat (limited to 'tests')
-rwxr-xr-xtests/cp.test8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/cp.test b/tests/cp.test
index b0d5d3a4..3e25f6c6 100755
--- a/tests/cp.test
+++ b/tests/cp.test
@@ -140,6 +140,14 @@ testing '-u1' 'echo one>one; sleep .1; echo two>two; cp -u one two; cat two' \
'two\n' '' ''
testing '-u2' 'echo two>two; sleep .1; echo one>one; cp -u one two; cat two' \
'one\n' '' ''
+mkdir a b
+
+echo potato > a/one
+echo potato > a/two
+touch b/one b/two
+testing '-i' 'cp -ri a/. b/. 2>/dev/null; cmp -s a/one b/one || cmp -s a/one b/two && echo yes' \
+ 'yes\n' '' 'n\ny\n'
+rm -rf one two a b
# cp -r ../source destdir
# cp -r one/two/three missing