Commit 0e7d5a2e authored by Daniel Bovensiepen's avatar Daniel Bovensiepen

Move Gem Tests into the main Test target

parent 80b7f45f
...@@ -52,7 +52,6 @@ all : ...@@ -52,7 +52,6 @@ all :
.PHONY : test .PHONY : test
test : all test : all
@$(MAKE) -C test $(MAKE_FLAGS) @$(MAKE) -C test $(MAKE_FLAGS)
@$(MAKE) test -C mrbgems $(MAKE_FLAGS)
# clean up # clean up
.PHONY : clean .PHONY : clean
......
...@@ -5,7 +5,7 @@ LIBR := ../lib/libmruby.a ...@@ -5,7 +5,7 @@ LIBR := ../lib/libmruby.a
INIT := init_gems INIT := init_gems
RM_F := rm -f RM_F := rm -f
CC_FLAGS := -Wall -Werror-implicit-function-declaration -g -O3 -MMD -I. -I./../include CC_FLAGS := -Wall -Werror-implicit-function-declaration -g -O3 -MMD -I. -I./../include
MMAKER := ./gem_helper MMAKER := ./generator
MMAKER_BIN := $(MMAKER) MMAKER_BIN := $(MMAKER)
export CC = gcc export CC = gcc
export LL = gcc export LL = gcc
...@@ -43,8 +43,9 @@ $(MMAKER_BIN) : $(MMAKER).o ...@@ -43,8 +43,9 @@ $(MMAKER_BIN) : $(MMAKER).o
$(MMAKER).o : $(MMAKER).c $(MMAKER).o : $(MMAKER).c
$(CC) $(CC_FLAGS) -MMD -c $< -o $@ $(CC) $(CC_FLAGS) -MMD -c $< -o $@
test : .PHONY : prepare-test
@$(MAKE) test -C g prepare-test :
@$(MAKE) prepare-test -C g
# clean driver and all gems # clean driver and all gems
.PHONY : clean .PHONY : clean
......
...@@ -138,32 +138,16 @@ make_gem_makefile() ...@@ -138,32 +138,16 @@ make_gem_makefile()
for_each_gem(" ", "/mrblib/*.rb", "\tcat", "> mrblib_gem.rbtmp", "mrblib"); for_each_gem(" ", "/mrblib/*.rb", "\tcat", "> mrblib_gem.rbtmp", "mrblib");
puts(""); puts("");
puts(".PHONY : test"); puts(".PHONY : prepare-test");
puts("test : mrbtest"); puts("prepare-test : mrbgemtest.ctmp");
puts("\t@./mrbtest");
puts(""); puts("");
puts("mrbtest : driver.o mrbtest.o"); puts("mrbgemtest.ctmp : mrbgemtest.rbtmp");
puts("\t$(CC) $(CFLAGS) -o ./mrbtest ./mrbtest.o ../../lib/libmruby.a ./driver.o"); puts("\t../../bin/mrbc -Bmrbgemtest_irep -omrbgemtest.ctmp mrbgemtest.rbtmp");
puts(""); puts("");
puts("driver.o : ../../test/driver.c"); puts("mrbgemtest.rbtmp :");
puts("\t$(CC) $(CFLAGS) -o $@ -c $<"); for_each_gem(" ", "/test/*.rb ", "\tcat", " > mrbgemtest.rbtmp", "");
puts("");
puts("mrbtest.o : mrbtest.c");
puts("");
puts("mrbtest.c : mrbtest.ctmp");
puts("\tcat ../../test/init_mrbtest.c mrbtest.ctmp > mrbtest.c");
puts("");
puts("mrbtest.ctmp : mrbtest.rbtmp");
puts("\t../../bin/mrbc -Bmrbtest_irep -omrbtest.ctmp mrbtest.rbtmp");
puts("");
puts("mrbtest.rbtmp :");
for_each_gem("", "/test/*.rb ", "\tcat ../../test/assert.rb ", "> mrbtest.rbtmp", "");
puts(""); puts("");
puts(".PHONY : clean"); puts(".PHONY : clean");
......
...@@ -68,13 +68,16 @@ $(OBJS) : %.o : %.c ...@@ -68,13 +68,16 @@ $(OBJS) : %.o : %.c
$(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@ $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@
# Compile C source from merged mruby source # Compile C source from merged mruby source
$(CLIB) : $(RLIB) $(MRBC) $(INIT) $(CLIB) : ../mrbgems/g/mrbgemtest.ctmp $(RLIB) $(MRBC) $(INIT)
$(MRBC) -Bmrbtest_irep -o$(DLIB) $(RLIB); $(CAT) $(INIT) $(DLIB) > $@ $(MRBC) -Bmrbtest_irep -o$(DLIB) $(RLIB); $(CAT) $(INIT) $(DLIB) ../mrbgems/g/mrbgemtest.ctmp > $@
# merge mruby sources # merge mruby sources
$(RLIB) : $(ASSLIB) $(MRBS) $(RLIB) : $(ASSLIB) $(MRBS)
$(CAT) $(ASSLIB) $(MRBS) > $@ $(CAT) $(ASSLIB) $(MRBS) > $@
../mrbgems/g/mrbgemtest.ctmp :
@$(MAKE) prepare-test -C ../mrbgems
# clean up # clean up
.PHONY : clean .PHONY : clean
clean : clean :
......
...@@ -5,13 +5,16 @@ ...@@ -5,13 +5,16 @@
#include "mruby/proc.h" #include "mruby/proc.h"
extern const char mrbtest_irep[]; extern const char mrbtest_irep[];
extern const char mrbgemtest_irep[];
void void
mrb_init_mrbtest(mrb_state *mrb) mrb_init_mrbtest(mrb_state *mrb)
{ {
int n = mrb_read_irep(mrb, mrbtest_irep); int n = mrb_read_irep(mrb, mrbtest_irep);
int m = mrb_read_irep(mrb, mrbgemtest_irep);
mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb)); mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb));
mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[m]), mrb_top_self(mrb));
if (mrb->exc) { if (mrb->exc) {
mrb_p(mrb, mrb_obj_value(mrb->exc)); mrb_p(mrb, mrb_obj_value(mrb->exc));
exit(0); exit(0);
......
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