changeset 32373:07e7a87dbeea

build: Add target "check-vm" to run test suite with enabled VM. * configure.ac: Define automake conditional AMCOND_ENABLE_VM_EVALUATOR when configured to build with VM evaluator. * Makefile.am (target check-vm): Conditionally, add new target that forwards to the Makefile in the "test" folder. * test/fntests.m: Use second command line argument for commands to be run before the actual test suite. * test/Makefile.am (function run-octave-tests): Add support for optional preparation commands. (target check-vm): Conditionally, add new target to run the test suite with enabled VM.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 05 Oct 2023 18:43:07 +0200
parents 2c0dc2ac3d3b
children 0f5033fb818d
files Makefile.am configure.ac test/Makefile.am test/fntests.m
diffstat 4 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Thu Oct 05 17:14:53 2023 -0400
+++ b/Makefile.am	Thu Oct 05 18:43:07 2023 +0200
@@ -349,6 +349,11 @@
 	$(AM_V_GEN)$(call simple-filter-rule,build-aux/subst-script-vals.sh) && \
 	chmod a+rx $@
 
+if AMCOND_ENABLE_VM_EVALUATOR
+check-vm:
+	$(MAKE) -C test check-vm
+endif
+
 octave-config.h: config.h build-aux/mk-octave-config-h.sh
 	$(AM_V_GEN)$(SHELL) $(srcdir)/build-aux/mk-octave-config-h.sh $< > $@-t && \
 	$(simple_move_if_change_rule)
--- a/configure.ac	Thu Oct 05 17:14:53 2023 -0400
+++ b/configure.ac	Thu Oct 05 18:43:07 2023 +0200
@@ -1419,6 +1419,7 @@
   AC_DEFINE(OCTAVE_ENABLE_VM_EVALUATOR, 1,
     [Define to 1 to build experimental Virtual Machine evaluator.])
 fi
+AM_CONDITIONAL([AMCOND_ENABLE_VM_EVALUATOR], [test $ENABLE_VM_EVALUATOR = yes])
 
 ### Check for PCRE2 or PCRE regex library, requiring one to exist.
 
--- a/test/Makefile.am	Thu Oct 05 17:14:53 2023 -0400
+++ b/test/Makefile.am	Thu Oct 05 18:43:07 2023 +0200
@@ -127,8 +127,12 @@
 include publish/module.mk
 include pkg/module.mk
 
+# run-octave (optional-prepare-commands)
+
 define run-octave-tests
-  ( $(SHELL) ../run-octave $(RUN_OCTAVE_OPTIONS) $(1) --no-init-file --silent --no-history -p $(abs_top_builddir)/test/mex $(abs_top_srcdir)/test/fntests.m $(abs_top_srcdir)/test ) && \
+  ( $(SHELL) ../run-octave $(RUN_OCTAVE_OPTIONS) --no-init-file --silent \
+      --no-history -p $(abs_top_builddir)/test/mex \
+      $(abs_top_srcdir)/test/fntests.m $(abs_top_srcdir)/test "$(1)" ) && \
   if $(AM_V_P); then \
     echo ""; \
     if [ -f fntests.log ]; then \
@@ -144,6 +148,11 @@
 check-local: $(GENERATED_TEST_FILES) $(MEX_TEST_FUNCTIONS) | $(OCTAVE_INTERPRETER_TARGETS) $(octave_dirstamp)
 	$(AM_V_at)$(call run-octave-tests)
 
+if AMCOND_ENABLE_VM_EVALUATOR
+check-vm: $(BUILT_SOURCES) $(GENERATED_TEST_FILES) $(MEX_TEST_FUNCTIONS) | $(OCTAVE_INTERPRETER_TARGETS) $(octave_dirstamp)
+	$(AM_V_at)$(call run-octave-tests,__vm_enable__ (1))
+endif
+
 COVERAGE_DIR = coverage
 COVERAGE_INFO = $(COVERAGE_DIR)/$(PACKAGE).info
 
--- a/test/fntests.m	Thu Oct 05 17:14:53 2023 -0400
+++ b/test/fntests.m	Thu Oct 05 18:43:07 2023 +0200
@@ -29,12 +29,16 @@
 
 debug_on_error (true);
 
-if (nargin == 1)
+if (nargin > 0)
   xdir = argv (){1};
 else
   xdir = ".";
 endif
 
+if (nargin > 1)
+  eval (argv (){2});
+endif
+
 srcdir = canonicalize_file_name (xdir);
 topsrcdir = canonicalize_file_name (fullfile (xdir, ".."));
 topbuilddir = canonicalize_file_name (fullfile (currdir, ".."));