You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jo...@apache.org on 2004/02/19 10:55:13 UTC

cvs commit: apr/test testdir.c

jorton      2004/02/19 01:55:13

  Modified:    include  apr_file_info.h
               test     testdir.c
  Log:
  * include/apr_file_info.h: Remove misleading @remark about dot/dot-dot
  entries returned by apr_dir_read(); reported by Philip Martin.
  
  * test/testdir.c (test_readdir_onedot, test_readdir_twodot): Remove
  tests.
  
  Revision  Changes    Path
  1.44      +1 -1      apr/include/apr_file_info.h
  
  Index: apr_file_info.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_file_info.h,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -w -d -u -r1.43 -r1.44
  --- apr_file_info.h	13 Feb 2004 09:38:28 -0000	1.43
  +++ apr_file_info.h	19 Feb 2004 09:55:12 -0000	1.44
  @@ -237,7 +237,7 @@
    * @param finfo the file info structure and filled in by apr_dir_read
    * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values 
    * @param thedir the directory descriptor returned from apr_dir_open
  - * @remark All systems return . and .. as the first two files.
  + * @remark No ordering is guaranteed for the entries read.
    */                        
   APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
                                          apr_dir_t *thedir);
  
  
  
  1.14      +10 -51    apr/test/testdir.c
  
  Index: testdir.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testdir.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -w -d -u -r1.13 -r1.14
  --- testdir.c	13 Feb 2004 09:38:34 -0000	1.13
  +++ testdir.c	19 Feb 2004 09:55:12 -0000	1.14
  @@ -144,63 +144,24 @@
       CuAssertIntEquals(tc, APR_SUCCESS, rv);
   }
   
  -static void test_readdir_onedot(CuTest *tc)
  -{
  -    apr_status_t rv;
  -    apr_dir_t *dir;
  -    apr_finfo_t finfo;
  -
  -    rv = apr_dir_open(&dir, "data", p);
  -    CuAssertIntEquals(tc, APR_SUCCESS, rv);
  -
  -    rv = apr_dir_read(&finfo, APR_FINFO_DIRENT, dir);
  -    CuAssertIntEquals(tc, APR_SUCCESS, rv);
  -    CuAssertStrEquals(tc, ".", finfo.name);
  -
  -    rv = apr_dir_close(dir);
  -    CuAssertIntEquals(tc, APR_SUCCESS, rv);
  -}
  -
  -static void test_readdir_twodot(CuTest *tc)
  -{
  -    apr_status_t rv;
  -    apr_dir_t *dir;
  -    apr_finfo_t finfo;
  -
  -    rv = apr_dir_open(&dir, "data", p);
  -    CuAssertIntEquals(tc, APR_SUCCESS, rv);
  -
  -    rv = apr_dir_read(&finfo, APR_FINFO_DIRENT, dir);
  -    rv = apr_dir_read(&finfo, APR_FINFO_DIRENT, dir);
  -    CuAssertIntEquals(tc, APR_SUCCESS, rv);
  -    CuAssertStrEquals(tc, "..", finfo.name);
  -
  -    rv = apr_dir_close(dir);
  -    CuAssertIntEquals(tc, APR_SUCCESS, rv);
  -}
  -
   static void test_rewind(CuTest *tc)
   {
  -    apr_status_t rv;
       apr_dir_t *dir;
  -    apr_finfo_t finfo;
  +    apr_finfo_t first, second;
   
  -    rv = apr_dir_open(&dir, "data", p);
  -    CuAssertIntEquals(tc, APR_SUCCESS, rv);
  +    apr_assert_success(tc, "apr_dir_open failed", apr_dir_open(&dir, "data", p));
   
  -    rv = apr_dir_read(&finfo, APR_FINFO_DIRENT, dir);
  -    CuAssertIntEquals(tc, APR_SUCCESS, rv);
  -    CuAssertStrEquals(tc, ".", finfo.name);
  +    apr_assert_success(tc, "apr_dir_read failed",
  +                       apr_dir_read(&first, APR_FINFO_DIRENT, dir));
   
  -    rv = apr_dir_rewind(dir);
  -    CuAssertIntEquals(tc, APR_SUCCESS, rv);
  +    apr_assert_success(tc, "apr_dir_rewind failed", apr_dir_rewind(dir));
   
  -    rv = apr_dir_read(&finfo, APR_FINFO_DIRENT, dir);
  -    CuAssertIntEquals(tc, APR_SUCCESS, rv);
  -    CuAssertStrEquals(tc, ".", finfo.name);
  +    apr_assert_success(tc, "second apr_dir_read failed",
  +                       apr_dir_read(&second, APR_FINFO_DIRENT, dir));
   
  -    rv = apr_dir_close(dir);
  -    CuAssertIntEquals(tc, APR_SUCCESS, rv);
  +    apr_assert_success(tc, "apr_dir_close failed", apr_dir_close(dir));
  +
  +    CuAssertStrEquals(tc, first.name, second.name);
   }
   
   /* Test for a (fixed) bug in apr_dir_read().  This bug only happened
  @@ -269,8 +230,6 @@
       SUITE_ADD_TEST(suite, test_remove_notthere);
       SUITE_ADD_TEST(suite, test_mkdir_twice);
   
  -    SUITE_ADD_TEST(suite, test_readdir_onedot);
  -    SUITE_ADD_TEST(suite, test_readdir_twodot);
       SUITE_ADD_TEST(suite, test_rewind);
   
       SUITE_ADD_TEST(suite, test_opendir);