add mruby/mrbc tests.

This commit is contained in:
Akira Yumiyama
2012-11-05 13:28:20 +09:00
parent 3ceadfa5b2
commit cd2c7c7532
3 changed files with 30 additions and 0 deletions
+1
View File
@@ -22,5 +22,6 @@ cscope.out
/test/mrbtest
/test/mrbtest.c
/test/*.*tmp
/test/mrubytest.*
CMakeFiles
CMakeCache.txt
+25
View File
@@ -16,6 +16,13 @@ ASSLIB := $(BASEDIR)/assert.rb
MRBS := $(BASEDIR)/t/*.rb
OBJS := driver.o $(MLIB)
# for mruby/mrbc test
REPLIB := $(BASEDIR)/report.rb
TESTRB := mrubytest.rb
TESTMRB := mrubytest.mrb
TESTRB_REP := mrubytest.rb.report
TESTMRB_REP := mrubytest.mrb.report
# libraries, includes
LIBS = -lm
INCLUDES = -I$(BASEDIR)/../src -I$(BASEDIR)/../include
@@ -43,9 +50,11 @@ endif
# mruby compiler and test driver
ifeq ($(OS),Windows_NT)
MRBC = ../bin/mrbc.exe
MRUBY= ../bin/mruby.exe
EXE := $(TARGET).exe
else
MRBC = ../bin/mrbc
MRUBY= ../bin/mruby
EXE := $(TARGET)
endif
@@ -55,7 +64,15 @@ endif
.PHONY : test
all : $(EXE)
@echo "# exec mrbtest"
./$(EXE)
@echo
@echo "# exec mruby test with ruby script"
@($(MRUBY) $(TESTRB) > $(TESTRB_REP) && echo "mrubytest.rb success.") || $(CAT) $(TESTRB_REP)
@echo
@echo "# exec mruby test with mrb file"
@($(MRUBY) -b $(TESTMRB) > $(TESTMRB_REP) && echo "mrubytest.mrb success.") || $(CAT) $(TESTMRB_REP)
@echo
# executable constructed using linker from object files
$(EXE) : $(OBJS) $(LIBR)
@@ -75,8 +92,16 @@ $(CLIB) : $(RLIB) $(MRBC) $(INIT)
$(RLIB) : $(ASSLIB) $(MRBS)
$(CAT) $(ASSLIB) $(MRBS) > $@
# Compile mrb file from mruby source
$(TESTMRB) : $(MRBC) $(TESTRB)
$(MRBC) $(TESTRB)
$(TESTRB) : $(ASSLIB) $(MRBS) $(REPLIB)
$(CAT) $(ASSLIB) $(MRBS) $(REPLIB) > $@
# clean up
.PHONY : clean
clean :
@echo "make: removing targets, objects and depend files of `pwd`"
-$(RM_F) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(OBJS) $(EXE)
-$(RM_F) $(TESTRB) $(TESTMRB) $(TESTRB_REP) $(TESTMRB_REP)
+4
View File
@@ -0,0 +1,4 @@
report
if $ko_test > 0 or $kill_test > 0
raise "mrbtest failed (KO=#{$ko_test}, Crash:#{kill_test})"
end