You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ko...@apache.org on 2021/02/21 17:02:38 UTC

svn commit: r1886757 - /subversion/trunk/subversion/tests/libsvn_subr/io-test.c

Author: kotkov
Date: Sun Feb 21 17:02:38 2021
New Revision: 1886757

URL: http://svn.apache.org/viewvc?rev=1886757&view=rev
Log:
In the test_install_stream_set_affected_time(), use an actual timestamp,
instead of testing an artificial value of 123456789 microseconds.

That artificial value represents the timestamp of about two minutes after
1970-01-01 00:00.  Setting such timestamp might not be supported by the
filesystem the tests are running on, such as FAT.  And in the scope of
this test, we only want to ensure that the (supported) timestamps are
properly preserved after the stream is installed, so choose a more recent
timestamp value.

* subversion/tests/libsvn_subr/io-test.c
  (): Include svn_time.h.
  (test_install_stream_set_affected_time): Use a predefined timestamp
   of 2002-05-13T19:00:50.966679Z.

Modified:
    subversion/trunk/subversion/tests/libsvn_subr/io-test.c

Modified: subversion/trunk/subversion/tests/libsvn_subr/io-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/io-test.c?rev=1886757&r1=1886756&r2=1886757&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/io-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/io-test.c Sun Feb 21 17:02:38 2021
@@ -31,6 +31,7 @@
 #include "svn_pools.h"
 #include "svn_string.h"
 #include "svn_io.h"
+#include "svn_time.h"
 #include "private/svn_skel.h"
 #include "private/svn_dep_compat.h"
 #include "private/svn_io_private.h"
@@ -1087,6 +1088,7 @@ test_install_stream_set_affected_time(ap
   const char *tmp_dir;
   const char *final_abspath;
   svn_stream_t *stream;
+  apr_time_t expected_timestamp;
   svn_stringbuf_t *actual_content;
   apr_finfo_t finfo;
 
@@ -1100,7 +1102,12 @@ test_install_stream_set_affected_time(ap
   SVN_ERR(svn_stream__create_for_install(&stream, tmp_dir, pool, pool));
   SVN_ERR(svn_stream_puts(stream, "stream1 content"));
   SVN_ERR(svn_stream_close(stream));
-  svn_stream__install_set_affected_time(stream, 123456789);
+
+  SVN_ERR(svn_time_from_cstring(&expected_timestamp,
+                                "2002-05-13T19:00:50.966679Z",
+                                pool));
+  svn_stream__install_set_affected_time(stream, expected_timestamp);
+
   SVN_ERR(svn_stream__install_stream(stream,
                                      final_abspath,
                                      TRUE,
@@ -1113,7 +1120,7 @@ test_install_stream_set_affected_time(ap
   SVN_TEST_STRING_ASSERT(actual_content->data, "stream1 content");
 
   SVN_ERR(svn_io_stat(&finfo, final_abspath, APR_FINFO_MTIME, pool));
-  SVN_TEST_INT_ASSERT(finfo.mtime, 123456789);
+  SVN_TEST_INT_ASSERT(finfo.mtime, expected_timestamp);
 
   return SVN_NO_ERROR;
 }