Commit d5ddbfe4 authored by Jamie A. Jennings's avatar Jamie A. Jennings

Added an option to "make test" allowing the executable to be set on the make...

Added an option to "make test" allowing the executable to be set on the make command line, so we can test installed rosie, not just from build directory
parent 0d3f8707
......@@ -86,6 +86,7 @@ BUILD = $(BUILD_ROOT)/build
ROSIEBIN = $(BUILD)/bin/rosie
ROSIEBINSCRIPTNAME = rosie
ROSIEBINSCRIPT = $(BUILD_ROOT)/$(ROSIEBINSCRIPTNAME)
ROSIE ?= $(ROSIEBINSCRIPT)
RPEG_DIR = $(BUILD_ROOT)/src/rpeg
LIBROSIE_DIR = $(BUILD_ROOT)/src/librosie
......@@ -428,15 +429,19 @@ check:
# Rosie can be munged by the terminal, making some tests fail when
# they should not.
# The test target can be used to test the rosie executable after
# installation, no matter where that is in the system:
# make test ROSIE=/usr/local/bin/rosie
.PHONY: test
test:
@$(BUILD_ROOT)/test/rosie-has-debug.sh $(ROSIEBINSCRIPT) 2>/dev/null; \
@echo "Path to rosie executable is $(ROSIE)"; \
$(BUILD_ROOT)/test/rosie-has-debug.sh $(ROSIE) 2>/dev/null; \
if [ "$$?" -ne "0" ]; then \
echo "Rosie was not built with LUADEBUG support. Try 'make clean; make LUADEBUG=1'."; \
exit -1; \
fi;
@echo Running tests in test/all.lua
@(TERM="dumb"; echo "dofile \"$(BUILD_ROOT)/test/all.lua\"" | $(ROSIEBINSCRIPT) -D)
@echo Running tests in test/all.lua; \
(TERM="dumb"; echo "ROSIE=\"$(ROSIE)\"; dofile \"$(BUILD_ROOT)/test/all.lua\"" | "$(ROSIE)" -D)
.PHONY: clean
clean: libclean
......
......@@ -10,24 +10,11 @@
-- See Makefile for how these tests are run using the undocumented "-D" option to rosie, which
-- enters development mode after startup.
if not ROSIE then
print("*****************************************************************")
print("** Path to rosie executable not set. Some tests will not run. **")
print("*****************************************************************")
end
rosie_cmd = ROSIE
assert(rosie)
TEST_HOME = "./test"
import = rosie.import
ROSIE_HOME = rosie.env.ROSIE_HOME
TEST_HOME = "./test"
json = import "cjson"
package.path = "./submodules/lua-modules/?.lua"
termcolor = assert(require("termcolor"))
test = assert(require("test"))
dofile(TEST_HOME .. "/prepare.lua")
test.dofile(TEST_HOME .. "/lib-test.lua")
test.dofile(TEST_HOME .. "/rpl-core-test.lua")
......
-- -*- Mode: Lua; -*-
--
-- prepare.lua
--
-- © Copyright Jamie A. Jennings 2020.
-- LICENSE: MIT License (https://opensource.org/licenses/mit-license.html)
-- AUTHOR: Jamie A. Jennings
#!/bin/bash
this=`basename $0`
rosie=build/bin/rosie
if [ "$rosie" == "" ]; then
echo "Cannot find bin/rosie"
exit -1
rosie="./rosie"
echo "Using default path to rosie executable: $rosie"
fi
file=$1
......@@ -20,9 +19,10 @@ fi
echo "Running test file $file ... "
$rosie -D <<EOF
assert(rosie)
_ = assert(rosie)
ROSIE = "$rosie"
TEST_HOME = "./test"
dofile(TEST_HOME .. "/prepare.lua")
_ = dofile(TEST_HOME .. "/prepare.lua")
dofile("$file")
EOF
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment