Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 182e13b

Browse files
Fraser J. Gordonlivecodeian
authored andcommitted
Add support for running tests under an interpreter
This is needed when running the test-suite for a cross-compiled engine: the interpreter can be set to an emulator in order to execute the test suite using the target executables.
1 parent 52d2c6b commit 182e13b

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

tests/Makefile

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ LCM_DIR ?= $(TEST_DIR)/_build
1010
TESTS_DIR ?= $(top_srcdir)/tests
1111
# When running on headless Linux, run tests in -ui mode.
1212

13+
# Used for emulation in cross-compiles. Usually empty.
14+
INTERPRETER ?=
15+
1316
LCS_ENGINE ?= $(guess_engine)
1417
LCS_ENGINE_FLAGS ?= $(guess_engine_flags)
1518

@@ -18,9 +21,9 @@ LCS_TESTRUNNER ?= $(TESTS_DIR)/_testrunner.livecodescript
1821
LCS_TESTS_DIR ?= $(TESTS_DIR)/lcs
1922

2023
ifeq ($(LCS_TESTENGINE),development)
21-
LCS_CMD = $(LCS_ENGINE) $(LCS_ENGINE_FLAGS) $(LCS_TESTRUNNER) run $(guess_dev_engine) $(LCS_ENGINE_FLAGS)
24+
LCS_CMD = $(INTERPRETER) $(LCS_ENGINE) $(LCS_ENGINE_FLAGS) $(LCS_TESTRUNNER) run $(guess_dev_engine) $(LCS_ENGINE_FLAGS)
2225
else
23-
LCS_CMD = $(LCS_ENGINE) $(LCS_ENGINE_FLAGS) $(LCS_TESTRUNNER) run $(LCS_TESTS_DIR)
26+
LCS_CMD = $(INTERPRETER) $(LCS_ENGINE) $(LCS_ENGINE_FLAGS) $(LCS_TESTRUNNER) run $(LCS_TESTS_DIR)
2427
endif
2528

2629
LCS_SERVER_ENGINE ?= $(bin_dir)/server-community
@@ -45,22 +48,22 @@ LCB_TESTLIB = $(LCM_DIR)/_testlib.lcm
4548

4649
LCC_COMPILERTESTRUNNER ?= $(TESTS_DIR)/_compilertestrunner.livecodescript
4750

48-
LCC_CMD = $(LCS_ENGINE) -ui $(LCC_COMPILERTESTRUNNER) run
51+
LCC_CMD = $(INTERPRETER) $(LCS_ENGINE) -ui $(LCC_COMPILERTESTRUNNER) run
4952

5053
LCC_LOG = _compiler_test_suite.log
5154

5255
########## LiveCode Script Parser test parameters
5356

5457
LCP_COMPILERTESTRUNNER ?= $(TESTS_DIR)/_parsertestrunner.livecodescript
5558

56-
LCP_CMD = $(LCS_ENGINE) -ui $(LCP_COMPILERTESTRUNNER) run
59+
LCP_CMD = $(INTERPRETER) $(LCS_ENGINE) -ui $(LCP_COMPILERTESTRUNNER) run
5760

5861
LCP_LOG = _parser_test_suite.log
5962

6063
########## lc-run test params
6164

6265
LC_RUN_TESTS ?= $(TESTS_DIR)/_lcruntests.livecodescript
63-
LC_RUN_TEST_CMD = $(LCS_ENGINE) -ui $(LC_RUN_TESTS)
66+
LC_RUN_TEST_CMD = $(INTERPRETER) $(LCS_ENGINE) -ui $(LC_RUN_TESTS)
6467

6568
LC_RUN_LOG = _lc_run_test_suite.log
6669

@@ -70,7 +73,7 @@ LC_COMPILE_FFI_JAVA ?= $(bin_dir)/lc-compile-ffi-java
7073

7174
LC_COMPILE_FFI_JAVA_TESTRUNNER ?= $(TESTS_DIR)/_lc_compile_ffi_java_testrunner.livecodescript
7275

73-
LC_COMPILE_FFI_JAVA_CMD = $(LCS_ENGINE) -ui $(LC_COMPILE_FFI_JAVA_TESTRUNNER) run
76+
LC_COMPILE_FFI_JAVA_CMD = $(INTERPRETER) $(LCS_ENGINE) -ui $(LC_COMPILE_FFI_JAVA_TESTRUNNER) run
7477

7578
LC_COMPILE_FFI_JAVA_LOG = _lc-compile-ffi-java_test_suite.log
7679

@@ -116,10 +119,10 @@ $(LCM_DIR)/deps.mk: $(LCB_SOURCES) Makefile $(LC_COMPILE) | $(LCM_DIR)
116119
@set -e; rm -f $@; \
117120
for lcb in $(LCB_SOURCES); do \
118121
lcm=`echo $$lcb | sed 's/lcb$$/lcm/'` ; \
119-
$(LC_COMPILE) $(LC_COMPILE_FLAGS) --deps make \
122+
$(INTERPRETER) $(LC_COMPILE) $(LC_COMPILE_FLAGS) --deps make \
120123
--output $(LCM_DIR)/$$lcm -- $$lcb >> $@; \
121124
done; \
122-
$(LC_COMPILE) $(LC_COMPILE_FLAGS) --deps make -- $(LCB_SOURCES) >> $@ ; \
125+
$(INTERPRETER) $(LC_COMPILE) $(LC_COMPILE_FLAGS) --deps make -- $(LCB_SOURCES) >> $@ ; \
123126
sed -i -e 's,\(.* \([^ ]*\)\.lcb\)$$,$(LCM_DIR)/\2.lcm \1,g' $@
124127

125128
########## Build rules
@@ -138,7 +141,7 @@ $(LCM_DIR)/%.lcm: %.lcb | $(LCM_DIR)
138141
echo "$$cmd" $(_PRINT_RULE); \
139142
$$cmd
140143
@set -e; \
141-
cmd="$(LC_COMPILE) $(LC_COMPILE_FLAGS) --output $@ -- $<" ; \
144+
cmd="$(INTERPRETER) $(LC_COMPILE) $(LC_COMPILE_FLAGS) --output $@ -- $<" ; \
142145
echo "$$cmd" $(_PRINT_RULE); \
143146
$$cmd
144147

@@ -226,12 +229,12 @@ lcb-check: lcm_compile
226229
loadfile="$(LCM_DIR)/`echo $$lcbfile | sed -e 's:tests/.*\.lcb$$::'`$$parent.lcm"; \
227230
mkdir -p `dirname $$logfile`; \
228231
if [ -e $$loadfile ] ; then \
229-
$(LC_RUN) $(LC_RUN_FLAGS) --handler RunModuleTests -- $(LCB_TESTRUNNER) --lc-run "$(LC_RUN) --load $$loadfile $(LC_RUN_FLAGS)" $$lcmfile > $$logfile; \
232+
$(INTERPRETER) $(LC_RUN) $(LC_RUN_FLAGS) --handler RunModuleTests -- $(LCB_TESTRUNNER) --lc-run "$(LC_RUN) --load $$loadfile $(LC_RUN_FLAGS)" $$lcmfile > $$logfile; \
230233
else \
231-
$(LC_RUN) $(LC_RUN_FLAGS) --handler RunModuleTests -- $(LCB_TESTRUNNER) --lc-run "$(LC_RUN) $(LC_RUN_FLAGS)" $$lcmfile > $$logfile; \
234+
$(INTERPRETER) $(LC_RUN) $(LC_RUN_FLAGS) --handler RunModuleTests -- $(LCB_TESTRUNNER) --lc-run "$(LC_RUN) $(LC_RUN_FLAGS)" $$lcmfile > $$logfile; \
232235
fi; \
233236
done; \
234-
$(LC_RUN) $(LC_RUN_FLAGS) --handler SummarizeTests -- $(LCB_TESTRUNNER) --summary-log $(LCB_LOG) $(LCB_TEST_LOGS)
237+
$(INTERPRETER) $(LC_RUN) $(LC_RUN_FLAGS) --handler SummarizeTests -- $(LCB_TESTRUNNER) --summary-log $(LCB_LOG) $(LCB_TEST_LOGS)
235238

236239
################################################################
237240
# lc-compile-ffi-java tests

util/run-tests.pl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
$test_dir = dirname($test_exec);
88
$test_log = $ARGV[2];
99

10+
# Use an interpreter, if specified.
11+
if ($test_wrapper eq "" && $ENV{"INTERPRETER"} ne "") {
12+
$test_wrapper = $ENV{"INTERPRETER"};
13+
}
14+
1015
$test_command_line = "$test_wrapper $test_exec --tap=$test_log";
1116

1217
chdir $test_dir or die "Failed to change directory!";

0 commit comments

Comments
 (0)