patch 8.2.5084: when the GUI shows a dialog tests get stuck
Problem: When the GUI shows a dialog tests get stuck.
Solution: Add the --gui-dialog-file argument.
diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak
index 8956384..9d1dc4e 100644
--- a/src/testdir/Make_dos.mak
+++ b/src/testdir/Make_dos.mak
@@ -19,6 +19,9 @@
.SUFFIXES: .in .out .res .vim
+# Add --gui-dialog-file to avoid getting stuck in a dialog.
+COMMON_ARGS = $(NO_INITS) --gui-dialog-file guidialog
+
nongui: nolog tinytests newtests report
gui: nolog tinytests newtests report
@@ -31,7 +34,7 @@
@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 ) \
else ( echo No failures reported > test_result.log )
- $(VIMPROG) -u NONE $(NO_INITS) -S summarize.vim messages
+ $(VIMPROG) -u NONE $(COMMON_ARGS) -S summarize.vim messages
@echo.
@echo Test results:
@cmd /c type test_result.log
@@ -70,6 +73,8 @@
-if exist messages del messages
-if exist benchmark.out del benchmark.out
-if exist opt_test.vim del opt_test.vim
+ -if exist guidialog del guidialog
+ -if exist guidialogfile del guidialogfile
nolog:
-if exist test.log del test.log
@@ -84,7 +89,7 @@
$(DOSTMP_INFILES): $(*B).in
if not exist $(DOSTMP)\NUL md $(DOSTMP)
if exist $@ del $@
- $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=dos|f $@|wq" $(*B).in
+ $(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=dos|f $@|wq" $(*B).in
# For each input file dostmp/test99.in run the tests.
# This moves test99.in to test99.in.bak temporarily.
@@ -94,7 +99,7 @@
move $(*B).in $(*B).in.bak > nul
copy $(DOSTMP)\$(*B).in $(*B).in > nul
copy $(*B).ok test.ok > nul
- $(VIMPROG) -u dos.vim $(NO_INITS) -s dotest.in $(*B).in
+ $(VIMPROG) -u dos.vim $(COMMON_ARGS) -s dotest.in $(*B).in
-@if exist test.out MOVE /y test.out $(DOSTMP)\$(*B).out > nul
-@if exist $(*B).in.bak move /y $(*B).in.bak $(*B).in > nul
-@if exist test.ok del test.ok
@@ -103,7 +108,7 @@
-@if exist XfakeHOME rd /s /q XfakeHOME
-@del X*
-@if exist viminfo del viminfo
- $(VIMPROG) -u dos.vim $(NO_INITS) "+set ff=unix|f test.out|wq" \
+ $(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=unix|f test.out|wq" \
$(DOSTMP)\$(*B).out
@diff test.out $*.ok & if errorlevel 1 \
( move /y test.out $*.failed > nul \
@@ -123,12 +128,12 @@
.vim.res:
@echo $(VIMPROG) > vimcmd
- $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
+ $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim
@del vimcmd
test_gui.res: test_gui.vim
@echo $(VIMPROG) > vimcmd
- $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
+ $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim
@del vimcmd
test_gui_init.res: test_gui_init.vim
@@ -142,6 +147,6 @@
test_bench_regexp.res: test_bench_regexp.vim
-if exist benchmark.out del benchmark.out
@echo $(VIMPROG) > vimcmd
- $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
+ $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim
@del vimcmd
@IF EXIST benchmark.out ( type benchmark.out )
diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak
index 5e17963..0638ade 100644
--- a/src/testdir/Make_ming.mak
+++ b/src/testdir/Make_ming.mak
@@ -31,6 +31,9 @@
.SUFFIXES: .in .out .res .vim
+# Add --gui-dialog-file to avoid getting stuck in a dialog.
+COMMON_ARGS = $(NO_INITS) --gui-dialog-file guidialog
+
nongui: nolog tinytests newtests report
gui: nolog tinytests newtests report
@@ -43,7 +46,7 @@
@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 ) \
else ( echo No failures reported > test_result.log )
- $(VIMPROG) -u NONE $(NO_INITS) -S summarize.vim messages
+ $(VIMPROG) -u NONE $(COMMON_ARGS) -S summarize.vim messages
@echo.
@echo Test results:
@cmd /c type test_result.log
@@ -82,6 +85,8 @@
-@if exist messages $(DEL) messages
-@if exist benchmark.out del benchmark.out
-@if exist opt_test.vim $(DEL) opt_test.vim
+ -@if exist guidialog $(DEL) guidialog
+ -@if exist guidialogfile $(DEL) guidialogfile
nolog:
-@if exist test.log $(DEL) test.log
@@ -96,7 +101,7 @@
$(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" $<
+ $(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=dos|f $@|wq" $<
# For each input file dostmp/test99.in run the tests.
# This moves test99.in to test99.in.bak temporarily.
@@ -106,7 +111,7 @@
$(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 $<)
+ $(VIMPROG) -u dos.vim $(COMMON_ARGS) -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
@@ -115,7 +120,7 @@
-@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" \
+ $(VIMPROG) -u dos.vim $(COMMON_ARGS) "+set ff=unix|f test.out|wq" \
$(DOSTMP)\$@
@diff test.out $(basename $@).ok & if errorlevel 1 \
( $(MV) test.out $(basename $@).failed > NUL \
@@ -135,12 +140,12 @@
.vim.res:
@echo $(VIMPROG) > vimcmd
- $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
+ $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim
@$(DEL) vimcmd
test_gui.res: test_gui.vim
@echo $(VIMPROG) > vimcmd
- $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $<
+ $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $<
@$(DEL) vimcmd
test_gui_init.res: test_gui_init.vim
@@ -154,6 +159,6 @@
test_bench_regexp.res: test_bench_regexp.vim
-$(DEL) benchmark.out
@echo $(VIMPROG) > vimcmd
- $(VIMPROG) -u NONE $(NO_INITS) -S runtest.vim $*.vim
+ $(VIMPROG) -u NONE $(COMMON_ARGS) -S runtest.vim $*.vim
@$(DEL) vimcmd
$(CAT) benchmark.out
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index c782da9..adec1f1 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -89,6 +89,7 @@
-rm -rf $(RM_ON_RUN) $(RM_ON_START)
-rm -f valgrind.*
-rm -f asan.*
+ -rm -f guidialog guidialogfile
# Delete the files produced by benchmarking, so they can run again.
benchmarkclean:
@@ -127,7 +128,8 @@
# New style of tests uses Vim script with assert calls. These are easier
# to write and a lot easier to read and debug.
# Limitation: Only works with the +eval feature.
-RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE) $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim
+# Add --gui-dialog-file to avoid getting stuck in a dialog.
+RUN_VIMTEST = VIMRUNTIME=$(SCRIPTSOURCE) $(VALGRIND) $(VIMPROG) -f $(GUI_FLAG) -u unix.vim --gui-dialog-file guidialog
newtests: newtestssilent
@/bin/sh -c "if test -f messages; then cat messages; fi"
diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim
index 766f983..a4c238e 100644
--- a/src/testdir/runtest.vim
+++ b/src/testdir/runtest.vim
@@ -245,6 +245,12 @@
call popup_clear(1)
endif
+ if filereadable('guidialogfile')
+ call add(v:errors, "Unexpected dialog:")
+ call add(v:errors, readfile('guidialogfile').join('\n'))
+ call delete('guidialogfile')
+ endif
+
" Close any extra tab pages and windows and make the current one not modified.
while tabpagenr('$') > 1
let winid = win_getid()
diff --git a/src/testdir/shared.vim b/src/testdir/shared.vim
index e442a59..60636fd 100644
--- a/src/testdir/shared.vim
+++ b/src/testdir/shared.vim
@@ -276,6 +276,7 @@
let cmd = cmd . ' -u ' . name
endif
let cmd .= ' --not-a-term'
+ let cmd .= ' --gui-dialog-file guidialogfile'
let cmd = substitute(cmd, 'VIMRUNTIME=\S\+', '', '')
" If using valgrind, make sure every run uses a different log file.