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