You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2015/01/21 22:53:03 UTC

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

Author: philip
Date: Wed Jan 21 21:53:03 2015
New Revision: 1653669

URL: http://svn.apache.org/r1653669
Log:
* subversion/tests/libsvn_subr/io-test.c
  (ignore_enoent): Extend and note some odd behaviour.  I wonder if
   this behaves the same on Windows?

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=1653669&r1=1653668&r2=1653669&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/io-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/io-test.c Wed Jan 21 21:53:03 2015
@@ -685,6 +685,7 @@ ignore_enoent(apr_pool_t *pool)
 {
   const char *tmp_dir, *path;
   const svn_io_dirent2_t *dirent_p;
+  apr_file_t *file;
 
   /* Create an empty directory. */
   SVN_ERR(svn_dirent_get_absolute(&tmp_dir, "ignore_enoent", pool));
@@ -714,6 +715,33 @@ ignore_enoent(apr_pool_t *pool)
   SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, TRUE, TRUE, pool, pool));
   SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, FALSE, TRUE, pool, pool));
 
+  /* File does exist. */
+  path = svn_dirent_join(tmp_dir, "present", pool);
+  SVN_ERR(svn_io_file_open(&file, path,
+                           APR_WRITE | APR_CREATE | APR_TRUNCATE,
+                           APR_OS_DEFAULT,
+                           pool));
+  SVN_ERR(svn_io_file_close(file, pool));
+
+#define ASSERT_ENOTDIR(exp) {                                           \
+    svn_error_t *svn__err = (exp);                                      \
+    SVN_TEST_ASSERT(svn__err                                            \
+                    && SVN__APR_STATUS_IS_ENOTDIR(svn__err->apr_err));  \
+    svn_error_clear(svn__err);                                          \
+}
+
+  /* Path does not exist as child of file. */
+  /* ### Some return SUCCESS others ENOTDIR, is that what we want? */
+  path = svn_dirent_join(path, "not-present", pool);
+  ASSERT_ENOTDIR(svn_io_remove_dir2(path, TRUE, NULL, NULL, pool));
+  SVN_ERR(svn_io_remove_file2(path, TRUE, pool));
+  ASSERT_ENOTDIR(svn_io_set_file_read_only(path, TRUE, pool));
+  ASSERT_ENOTDIR(svn_io_set_file_read_write(path, TRUE, pool));
+  ASSERT_ENOTDIR(svn_io_set_file_executable(path, TRUE, TRUE, pool));
+  ASSERT_ENOTDIR(svn_io_set_file_executable(path, FALSE, TRUE, pool));
+  SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, TRUE, TRUE, pool, pool));
+  SVN_ERR(svn_io_stat_dirent2(&dirent_p, path, FALSE, TRUE, pool, pool));
+
   return SVN_NO_ERROR;
 }