aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-04-06 14:44:45 -0700
committerRob Landley <rob@landley.net>2017-04-11 12:25:13 -0500
commit36b6eb775f8913dbb6ded4fe05a8bfd5e0130a38 (patch)
tree79ed4f9df1327db4a88bb7f5706a47d47b4a14bc /tests
parent0956d16785fd8df1a57d8bf063cddd5b5c1ec221 (diff)
downloadtoybox-36b6eb775f8913dbb6ded4fe05a8bfd5e0130a38.tar.gz
Fix touch -a/-m (and add the missing tests).
utimensat takes atime in [0] and mtime in [1], but since we're overwriting with UTIME_OMIT, we actually want to flip the comparison so -a blats 1 and -m blats 0.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/touch.test12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/touch.test b/tests/touch.test
index 263e9a0f..da6fe99a 100755
--- a/tests/touch.test
+++ b/tests/touch.test
@@ -64,9 +64,15 @@ testing "-t CCMMDDhhmm" \
"touch -t 2101231234 input && date +%Y-%m-%d:%H-%M-%S -r input" \
"$(date +%C)21-01-23:12-34-00\n" "" ""
+testing "-a" "touch -t 197101020304 walrus &&
+ touch -t 197203040506 -a walrus && stat -c '%X %Y' walrus" \
+ "68562360 31662240\n" "" ""
+testing "-m" "touch -t 197101020304 walrus &&
+ touch -t 197203040506 -m walrus && stat -c '%X %Y' walrus" \
+ "31662240 68562360\n" "" ""
+testing "-am" "touch -t 197101020304 walrus &&
+ touch -t 197203040506 -am walrus && stat -c '%X %Y' walrus" \
+ "68562360 68562360\n" "" ""
-#testing "-a"
-#testing "-m"
-#testing "-am"
#testing "-t"
rm walrus walrus2