patch 9.1.0791: tests: errors in gen_opt_test.vim are not shown

Problem:  tests: errors in gen_opt_test.vim are not shown
Solution: update gen_opt_test.vim and write test.log,
          let the makefile output test.log (Milly)

closes: #15887

Signed-off-by: Milly <milly.ca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak
index f26950e..16632b3 100644
--- a/src/testdir/Make_ming.mak
+++ b/src/testdir/Make_ming.mak
@@ -157,8 +157,12 @@
 	$(VIMPROG) -u gui_preinit.vim -U gui_init.vim $(NO_PLUGINS) -S runtest.vim $<
 	@$(DEL) vimcmd
 
-opt_test.vim: ../optiondefs.h gen_opt_test.vim
-	$(VIMPROG) -e -s -u NONE $(COMMON_ARGS) --nofork -S gen_opt_test.vim ../optiondefs.h
+opt_test.vim: gen_opt_test.vim ../optiondefs.h
+	$(VIMPROG) -e -s -u NONE $(COMMON_ARGS) --nofork -S $^
+	@if test -f test.log; then \
+		cat test.log; \
+		exit 1; \
+	fi
 
 test_bench_regexp.res: test_bench_regexp.vim
 	-$(DEL) benchmark.out