summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAkira Yumiyama <[email protected]>2012-11-05 13:28:20 +0900
committerAkira Yumiyama <[email protected]>2012-11-05 13:28:20 +0900
commitcd2c7c7532b91818b57e7f54ce5ed4553ae3964c (patch)
tree4ad9c1c51e2f6adf7ff7958af077d5e1417e2c38
parent3ceadfa5b256c9fca0a8e7f4af3cdb1b31e6e354 (diff)
downloadmruby-cd2c7c7532b91818b57e7f54ce5ed4553ae3964c.tar.gz
mruby-cd2c7c7532b91818b57e7f54ce5ed4553ae3964c.zip
add mruby/mrbc tests.
-rw-r--r--.gitignore1
-rw-r--r--test/Makefile25
-rw-r--r--test/report.rb4
3 files changed, 30 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 797f98917..8a76394ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,5 +22,6 @@ cscope.out
/test/mrbtest
/test/mrbtest.c
/test/*.*tmp
+/test/mrubytest.*
CMakeFiles
CMakeCache.txt
diff --git a/test/Makefile b/test/Makefile
index 18bc79b5a..7457a6266 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -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)
diff --git a/test/report.rb b/test/report.rb
new file mode 100644
index 000000000..5e85715b7
--- /dev/null
+++ b/test/report.rb
@@ -0,0 +1,4 @@
+report
+if $ko_test > 0 or $kill_test > 0
+ raise "mrbtest failed (KO=#{$ko_test}, Crash:#{kill_test})"
+end