Hi,
2016/1/20 Wed 7:47:18 UTC+9 Ken Takata wrote:
> Hi Bram,
>
> 2016/1/20 Wed 3:33:18 UTC+9 Bram Moolenaar wrote:
> > Ken Takata wrote:
> >
> > > (The original thread was in vim_use:
> > > https://groups.google.com/d/topic/vim_use/RLM8Vqa_aME/discussion )
> > >
> > > I have updated the patches for supporting large files on Windows.
> > > I also converted the test to the new style. And I also added a new test
> > > for
> > > large files: test_largefile.vim. This creates a 4GB file, moving around
> > > it,
> > > and write it to disk. This uses over 8GB disk spaces, and consumes CPU
> > > powers. So I don't add this test to src/testdir/Make_all.mak. I
> > > confirmed
> > > that when running the test without my fix, gvim.exe (32-bit) stopped with
> > > "E342: Out of memory!" (takes about 10min), but it succeeded with my fix
> > > (takes about 5min).
> > > Please check the attached patches.
> > >
> > > Note: Please apply the following patch before them to avoid conflicts.
> > > https://groups.google.com/d/topic/vim_dev/JHbE4twU4dk/discussion
> >
> > Thanks. In what order do the patches need to be applied?
> > Looks like the stat_T patch comes after the others?
>
> Yes.
> use-stat_T.patch must be applied after support-largefiles-on-windows.patch.
> Other two are independent.
>
>
> > For the test, we can add a "torture" target.
> >
> > I have this old note in the todo file:
> >
> > Win32: patch to use 64 bit stat() if possible. (Ken Takata, 2014 May 12)
> > More tests May 14. Update May 29. Update Aug 10.
> >
> > I assume that is related to this?
>
> Yes, the stat_T patch is a patch for this.
> Without this patch, getfsize() returns a broken value (e.g. -294967296), if
> the size of a file is larger than 2 GiB and smaller than 4 GiB. And if the
> size is larger than 4 GiB, getfsize() and other stat functions return -1.
> MSVC's 32-bit stat() always returns error if the filesize is larger than 4
> GiB.
I wrote an additional patch to fix display of off_T value.
add-stat-test.patch is updated to fix conflicts with 7.4.1142.
Please apply in the following order:
1. support-largefiles-on-windows.patch (previous mail)
2. fix-off_T-display.patch (this mail)
3. use-stat_T.patch (previous mail)
4. add-stat-test.patch (this mail)
5. test_largefile.patch (previous mail)
Regards,
Ken Takata
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
# HG changeset patch
# Parent 8e1a5942d28470b73afa3631e6b129f9b9f1b02a
diff --git a/src/fileio.c b/src/fileio.c
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5238,6 +5238,8 @@ msg_add_lines(insert_space, lnum, nchars
sprintf((char *)p,
#ifdef LONG_LONG_OFF_T
"%ldL, %lldC", lnum, (long long)nchars
+#elif defined(WIN3264)
+ "%ldL, %I64dC", lnum, (__int64)nchars
#else
/* Explicit typecast avoids warning on Mac OS X 10.6 */
"%ldL, %ldC", lnum, (long)nchars
@@ -5256,6 +5258,8 @@ msg_add_lines(insert_space, lnum, nchars
sprintf((char *)p,
#ifdef LONG_LONG_OFF_T
_("%lld characters"), (long long)nchars
+#elif defined(WIN3264)
+ _("%I64d characters"), (__int64)nchars
#else
/* Explicit typecast avoids warning on Mac OS X 10.6 */
_("%ld characters"), (long)nchars
# HG changeset patch
# Parent 7656647da44ed09b242c32cf1d95c9d4ca0df086
# Parent 568e8d2f4b0deb1b0bebe15aa5b8fc63e6c8799f
diff --git a/src/Makefile b/src/Makefile
--- a/src/Makefile
+++ b/src/Makefile
@@ -1993,6 +1993,7 @@ test_arglist \
test_searchpos \
test_set \
test_sort \
+ test_stat \
test_undolevels \
test_unlet \
test_viminfo \
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -175,6 +175,7 @@ NEW_TESTS = test_arglist.res \
test_increment.res \
test_perl.res \
test_quickfix.res \
+ test_stat.res \
test_syntax.res \
test_viminfo.res \
test_viml.res \
diff --git a/src/testdir/test_stat.vim b/src/testdir/test_stat.vim
new file mode 100644
--- /dev/null
+++ b/src/testdir/test_stat.vim
@@ -0,0 +1,64 @@
+" Tests for stat functions and checktime
+
+func Test_existent_file()
+ let fname='Xtest.tmp'
+
+ let ts=localtime()
+ sleep 1
+ let fl=['Hello World!']
+ call writefile(fl, fname)
+ let tf=getftime(fname)
+ sleep 1
+ let te=localtime()
+
+ call assert_true(ts <= tf && tf <= te)
+ call assert_equal(strlen(fl[0] . "\n"), getfsize(fname))
+ call assert_equal('file', getftype(fname))
+ call assert_equal('rw-', getfperm(fname)[0:2])
+endfunc
+
+func Test_existent_directory()
+ let dname='.'
+
+ call assert_equal(0, getfsize(dname))
+ call assert_equal('dir', getftype(dname))
+ call assert_equal('rwx', getfperm(dname)[0:2])
+endfunc
+
+func Test_checktime()
+ let fname='Xtest.tmp'
+
+ let fl=['Hello World!']
+ call writefile(fl, fname)
+ set autoread
+ exec 'e' fname
+ sleep 2
+ let fl=readfile(fname)
+ let fl[0] .= ' - checktime'
+ call writefile(fl, fname)
+ checktime
+ call assert_equal(fl[0], getline(1))
+endfunc
+
+func Test_nonexistent_file()
+ let fname='Xtest.tmp'
+
+ call delete(fname)
+ call assert_equal(-1, getftime(fname))
+ call assert_equal(-1, getfsize(fname))
+ call assert_equal('', getftype(fname))
+ call assert_equal('', getfperm(fname))
+endfunc
+
+func Test_win32_symlink_dir()
+ " On Windows, non-admin users cannot create symlinks.
+ " So we use an existing symlink for this test.
+ if has('win32')
+ " Check if 'C:\Users\All Users' is a symlink to a directory.
+ let res=system('dir C:\Users /a')
+ if match(res, '\C<SYMLINKD> *All Users') >= 0
+ " Get the filetype of the symlink.
+ call assert_equal('dir', getftype('C:\Users\All Users'))
+ endif
+ endif
+endfunc