test_smbclient_s3: Test four-digit year in smbclient utimes
authorChristof Schmitt <cs@samba.org>
Wed, 15 Apr 2020 21:53:08 +0000 (14:53 -0700)
committerChristof Schmitt <cs@samba.org>
Thu, 16 Apr 2020 17:27:41 +0000 (17:27 +0000)
Modify the test to also set the create_time, and specify the year with
using four digits to test the new codepath.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/script/tests/test_smbclient_s3.sh

index 5df8a7cb550a6c663e04f5e9ce032ecdbb835235..3ea55f54107cfaa873b2834d68772db69d1411ea 100755 (executable)
@@ -1469,7 +1469,7 @@ test_utimes()
 del utimes_test
 put ${SMBCLIENT} utimes_test
 allinfo utimes_test
-utimes utimes_test -1 17:01:01-05:10:20 -1 -1
+utimes utimes_test 2016:02:04-06:19:20 17:01:01-05:10:20 -1 -1
 allinfo utimes_test
 del utimes_test
 quit
@@ -1497,15 +1497,16 @@ EOF
        return
     fi
 
-    # Now, we should have 2 identical create_time, write_time, change_time
-    # values, but one access_time of Jan  1 05:10:20 AM.
+    # Now, we should have 2 identical write_time and change_time
+    # values, but one access_time of Jan  1 05:10:20 AM,
+    # and one create_time of Feb 04 06:19:20 AM 2016
     out_sorted=`echo "$out" | sort | uniq`
     num_create=`echo "$out_sorted" | grep -c 'create_time:'`
     num_access=`echo "$out_sorted" | grep -c 'access_time:'`
     num_write=`echo "$out_sorted" | grep -c 'write_time:'`
     num_change=`echo "$out_sorted" | grep -c 'change_time:'`
-    if [ "$num_create" != "1" ]; then
-        echo "failed - should only get one create_time $out"
+    if [ "$num_create" != "2" ]; then
+        echo "failed - should get two create_time $out"
         false
         return
     fi
@@ -1536,6 +1537,18 @@ EOF
        false
        return
     fi
+
+    # This could be: Thu Feb  4 06:19:20 AM 2016
+    # or           : Thu Feb  4 06:19:20 2016 CET
+    echo "$out" | grep 'create_time:.*Thu Feb.*4 06:19:20 .*2016.*'
+    ret=$?
+    if [ $ret -ne 0 ] ; then
+       echo "$out"
+       echo
+       echo "failed - should get access_time:    Thu Feb  4 06:19:20 [AM] 2016"
+       false
+       return
+    fi
 }
 
 # Test smbclient renames with pathnames containing '..'