On Wednesday, September 16, 2020 at 9:42:14 AM UTC-4, Bram Moolenaar wrote:
>
>
> Michael Soyka wrote:
>
> > Using Make_ming.mak, the "tinytests" collection of build tests will fail
> if
> > the associated .ok file has Windows line endings. This happens because
> the
> > test.out file is explicitly set to have unix/linux line endings but the
> .ok
> > file has not been converted and so "diff" concludes they're different.
> I
> > have attached a patch which converts the .ok file and cleans-up.
> >
> > This was introduced by patch v8.2.1439 which removed the "fixff" target.
> I
> > noticed it because I use git-for-windows and its default is to use
> Windows
> > line endings in the workspace.
> >
> > I suspect the same problem occurs in Make_dos.mak but I have no way of
> > verifying that.
>
> I had been wondering if "fixff" would still be needed. The very old
> reason was that after unpacking the source tar archive some versions of
> tar would change the line endings. So git-for-windows does the same
> thing? Or should we somehow set the git metadata so that it doesn't
> change the line endings?
>
> --
> Communication is one of the most compli..., eh, well, it's hard.
> You know what I mean. Not?
>
> /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net
> \\\
> /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/
> \\\
> \\\ an exciting new programming language -- http://www.Zimbu.org
> ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org
> ///
>
Bram,
I've done some additional investigations and have concluded that the
"dostmp" scratch directory can be eliminated from testdir/Make_ming.mak. I
have attached two patches that do just that. The second patch is a merge
of the 7 steps/commits I used to arrive at this. If anyone is interested
in the individual commits I can provide them.
Unfortunately, I don't see how one can reliably eliminate the fileformat
conversion of the test.out file. In my git workspace, the tinytests line
endings are as follows:
i/-text w/-text attr/ dotest.in
i/lf w/crlf attr/ test20.in
i/lf w/crlf attr/ test20.ok
i/mixed w/mixed attr/ test21.in
i/mixed w/mixed attr/ test21.ok
i/lf w/crlf attr/ test22.in
i/lf w/crlf attr/ test22.ok
i/-text w/-text attr/ test23.in
i/lf w/crlf attr/ test23.ok
i/-text w/-text attr/ test24.in
i/lf w/crlf attr/ test24.ok
i/-text w/-text attr/ test25.in
i/-text w/-text attr/ test25.ok
i/lf w/crlf attr/ test26.in
i/lf w/crlf attr/ test26.ok
i/-text w/-text attr/ test27.in
i/-text w/-text attr/ test27.ok
Files that have unix line endings in the index (leftmost column) have been
converted to dos line endings in the workspace (2'nd column). The
remaining files git views as binary or as having several line endings and
does not change them but Vim treats them as fileformat unix. I think,
correct me if I'm mistaken, the fileformat of the test.out files is
determined by that of the .in file (set to dos by dotest.in) but that may
differ from the line endings used in the .ok file. If they are different,
diff will report differences.
Sorry but I think this is the best I can do but stand ready to be
corrected.
-mike
--
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/9f2c991a-1884-4769-8e08-3dae6c6a76a4o%40googlegroups.com.
>From bedfed70c4961fa44d277e36d6b3922beb202eef Mon Sep 17 00:00:00 2001
From: msoyka-of-wharton <[email protected]>
Date: Sat, 19 Sep 2020 11:09:12 -0400
Subject: [PATCH 1/2] Fix test22 to complete as designed if file becomes
modified
If, as a result of the test, test22.in becomes modified, the test will
fail because the ":edit +1..." statement will fail. The file can become
modified if its fileformat is not "dos" because dotest.in sets its
fileformat to the platform default which is "dos" on Windows.
---
src/testdir/test22.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/testdir/test22.in b/src/testdir/test22.in
index 0e0e60553..e055491c7 100644
--- a/src/testdir/test22.in
+++ b/src/testdir/test22.in
@@ -3,7 +3,7 @@ Tests for complicated + argument to :edit command
STARTTEST
:$-1w! Xfile1
:$w! Xfile2
-:edit +1|s/|/PIPE/|w Xfile1| e Xfile2|1 | s/\//SLASH/|w
+:edit! +1|s/|/PIPE/|w Xfile1| e Xfile2|1 | s/\//SLASH/|w
:w! test.out
:e Xfile1
:w >> test.out
--
2.26.2.windows.1
>From 022530ec532adb160637e53ee23f4065dd3722c1 Mon Sep 17 00:00:00 2001
From: msoyka-of-wharton <[email protected]>
Date: Sat, 19 Sep 2020 11:22:27 -0400
Subject: [PATCH 2/2] Eliminate need for "dostmp" in tinytests
[1] force .out and .ok to have same fileformats
If the fileformat of a .ok file does not match the fileformat of the
.out file created by the test, then "diff" will report they differ and
the test will fail.
This patch forces them to be the same. The choice of unix is arbitrary.
[2] remove "dos" conversion in "tinytests"
The conversion of the "tinytests" .in files to "dos" fileformat is
unnecessary.
[3] eliminate copy of "tinytests" .in files
There is no reason to create backup copies of the "tinytests" .in files
because they are not modified.
[4] remove "dostmp" scratch directory
The "dostmp" subdirectory is no longer needed because .in files are no
longer modified and the .ok files, when modified, are given a new name.
[5] remove unnecessary file copy
[6] move statement closer to where it is used
[7] make full use of existing make variables
---
src/testdir/Make_ming.mak | 61 ++++++++++++++-------------------------
1 file changed, 21 insertions(+), 40 deletions(-)
diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak
index 5e17963c5..faec6ff72 100644
--- a/src/testdir/Make_ming.mak
+++ b/src/testdir/Make_ming.mak
@@ -24,11 +24,6 @@ include Make_all.mak
# Explicit dependencies.
test_options.res test_alot.res: opt_test.vim
-TEST_OUTFILES = $(SCRIPTS_TINY_OUT)
-DOSTMP = dostmp
-# Keep $(DOSTMP)/*.in
-.PRECIOUS: $(patsubst %.out, $(DOSTMP)/%.in, $(TEST_OUTFILES))
-
.SUFFIXES: .in .out .res .vim
nongui: nolog tinytests newtests report
@@ -41,12 +36,12 @@ benchmark: $(SCRIPTS_BENCH)
report:
@rem without the +eval feature test_result.log is a copy of test.log
- @if exist test.log ( copy /y test.log test_result.log > nul ) \
+ @if exist test.log ( $(CP) test.log test_result.log > nul ) \
else ( echo No failures reported > test_result.log )
$(VIMPROG) -u NONE $(NO_INITS) -S summarize.vim messages
@echo.
@echo Test results:
- @cmd /c type test_result.log
+ @cmd /c $(CAT) test_result.log
@if exist test.log ( echo TEST FAILURE & exit /b 1 ) \
else ( echo ALL DONE )
@@ -54,11 +49,11 @@ report:
# Execute an individual new style test, e.g.:
# mingw32-make -f Make_ming.mak test_largefile
$(NEW_TESTS):
- -if exist [email protected] del [email protected]
- -if exist test.log del test.log
- -if exist messages del messages
+ -if exist [email protected] $(DEL) [email protected]
+ -if exist test.log $(DEL) test.log
+ -if exist messages $(DEL) messages
@$(MAKE) -f Make_ming.mak [email protected] VIMPROG=$(VIMPROG) --no-print-directory
- @type messages
+ @$(CAT) messages
@if exist test.log exit 1
@@ -68,58 +63,44 @@ clean:
-@if exist *.out $(DEL) *.out
-@if exist *.failed $(DEL) *.failed
-@if exist *.res $(DEL) *.res
- -@if exist $(DOSTMP) rd /s /q $(DOSTMP)
-@if exist test.in $(DEL) test.in
-@if exist test.ok $(DEL) test.ok
-@if exist Xdir1 $(DELDIR) Xdir1
-@if exist Xfind $(DELDIR) Xfind
-@if exist XfakeHOME $(DELDIR) XfakeHOME
-@if exist X* $(DEL) X*
- -@for /d %%i in (X*) do @rd /s/q %%i
+ -@for /d %%i in (X*) do @$(DELDIR) %%i
-@if exist viminfo $(DEL) viminfo
-@if exist test.log $(DEL) test.log
- -@if exist test_result.log del test_result.log
+ -@if exist test_result.log $(DEL) test_result.log
-@if exist messages $(DEL) messages
- -@if exist benchmark.out del benchmark.out
+ -@if exist benchmark.out $(DEL) benchmark.out
-@if exist opt_test.vim $(DEL) opt_test.vim
nolog:
-@if exist test.log $(DEL) test.log
- -@if exist test_result.log del test_result.log
+ -@if exist test_result.log $(DEL) test_result.log
-@if exist messages $(DEL) messages
# Tiny tests. Works even without the +eval feature.
tinytests: $(SCRIPTS_TINY_OUT)
-# Copy the input files to dostmp, changing the fileformat to dos.
-$(DOSTMP)/%.in : %.in
- if not exist $(DOSTMP)\nul mkdir $(DOSTMP)
- if exist $(DOSTMP)\$< $(DEL) $(DOSTMP)\$<
- $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=dos|f $@|wq" $<
-
-# For each input file dostmp/test99.in run the tests.
-# This moves test99.in to test99.in.bak temporarily.
-%.out : $(DOSTMP)/%.in
+# For each input file run the tests.
+%.out : %.in
-@if exist test.out $(DEL) test.out
- -@if exist $(DOSTMP)\$@ $(DEL) $(DOSTMP)\$@
- $(MV) $(notdir $<) $(notdir $<).bak > NUL
- $(CP) $(DOSTMP)\$(notdir $<) $(notdir $<) > NUL
- $(CP) $(basename $@).ok test.ok > NUL
$(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $(notdir $<)
- -@if exist test.out $(MV) test.out $(DOSTMP)\$@ > NUL
- -@if exist $(notdir $<).bak $(MV) $(notdir $<).bak $(notdir $<) > NUL
- -@if exist test.ok $(DEL) test.ok
- -@if exist Xdir1 $(DELDIR) /s /q Xdir1
+ -@if exist Xdir1 $(DELDIR) Xdir1
-@if exist Xfind $(DELDIR) Xfind
-@if exist XfakeHOME $(DELDIR) XfakeHOME
- -@del X*
- -@if exist viminfo del viminfo
- $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.out|wq" \
- $(DOSTMP)\$@
- @diff test.out $(basename $@).ok & if errorlevel 1 \
+ -@$(DEL) X*
+ -@if exist viminfo $(DEL) viminfo
+ -@if exist test.ok $(DEL) test.ok
+ $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|update|q" test.out
+ $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.ok|wq" \
+ $(basename $@).ok
+ @diff test.out test.ok & if errorlevel 1 \
( $(MV) test.out $(basename $@).failed > NUL \
- & del $(DOSTMP)\$@ \
& echo $(basename $@) FAILED >> test.log ) \
else ( $(MV) test.out $(basename $@).out > NUL )
@@ -129,7 +110,7 @@ $(DOSTMP)/%.in : %.in
# Limitation: Only works with the +eval feature.
newtests: newtestssilent
- @if exist messages type messages
+ @if exist messages $(CAT) messages
newtestssilent: $(NEW_TESTS_RES)
--
2.26.2.windows.1