Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

make test restructuring

  • Loading branch information...
commit 8085817cb5737ca0c2a4afb5e3d013a395e12eb4 1 parent 0c6ff97
@matz matz authored
View
8 Makefile
@@ -27,11 +27,10 @@ all :
@$(MAKE) -C tools/mruby $(MAKE_FLAGS)
@$(MAKE) -C tools/mirb $(MAKE_FLAGS)
-# mruby iso test
-.PHONY : mrit
-mrit :
+# mruby test
+.PHONY : test
+test :
@$(MAKE) -C test $(MAKE_FLAGS)
- @$(MAKE) -C tools/mrit $(MAKE_FLAGS)
# clean up
.PHONY : clean
@@ -39,5 +38,4 @@ clean :
@$(MAKE) clean -C src $(MAKE_FLAGS)
@$(MAKE) clean -C tools/mruby $(MAKE_FLAGS)
@$(MAKE) clean -C tools/mirb $(MAKE_FLAGS)
- @$(MAKE) clean -C tools/mrit $(MAKE_FLAGS)
@$(MAKE) clean -C test $(MAKE_FLAGS)
View
65 test/Makefile
@@ -4,15 +4,16 @@
# project-specific macros
# extension of the executable-file is modifiable(.exe .out ...)
BASEDIR = .
-TARGET := mritlib
+TARGET := mrbtest
+LIBR := ../lib/libmruby.a
MLIB := $(TARGET).o
CLIB := $(TARGET).c
+INIT := init_$(TARGET).c
DLIB := $(TARGET).ctmp
RLIB := $(TARGET).rbtmp
-DEPLIB := $(TARGET).d
-MRB1 := $(BASEDIR)/*.rb
-MRBS := $(MRB1)
-LIBR := ../lib/libmrit.a
+DEPLIB := $(TARGET).d driver.d
+MRBS := $(BASEDIR)/t/*.rb
+OBJS := driver.o $(MLIB)
# C compiler (gcc)
CC = gcc
@@ -32,28 +33,63 @@ else
MAKE_FLAGS = CC='$(CC)' LL='$(LL)' ALL_CFLAGS='$(ALL_CFLAGS)'
endif
-# mruby compiler
+# mruby compiler and test driver
ifeq ($(OS),Windows_NT)
MRBC = ../bin/mrbc.exe
+EXE := $(TARGET).exe
else
MRBC = ../bin/mrbc
+EXE := $(TARGET)
+endif
+
+# libraries, includes
+LIBS = -lm
+
+# compiler, linker (gcc)
+CC = gcc
+LL = gcc
+YACC = bison
+DEBUG_MODE = 1
+ifeq ($(DEBUG_MODE),1)
+CFLAGS = -g -O3
+else
+CFLAGS = -O3
+endif
+ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS)
+ifeq ($(OS),Windows_NT)
+ MAKE_FLAGS = CC=$(CC) LL=$(LL) ALL_CFLAGS="$(ALL_CFLAGS)"
+else
+ MAKE_FLAGS = CC='$(CC)' LL='$(LL)' ALL_CFLAGS='$(ALL_CFLAGS)'
endif
##############################
# generic build targets, rules
.PHONY : all
-all : $(MRBC) $(MLIB)
- $(AR) r $(LIBR) $(MLIB)
+all : $(LIBR) $(EXE)
@echo "make: built targets of `pwd`"
-# Compile mrblib source
-$(MLIB) : $(CLIB)
- $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $(CLIB) -o $(MLIB)
+.PHONY : test
+all : $(LIBR) $(EXE)
+ ./$(EXE)
+
+# executable constructed using linker from object files
+$(EXE) : $(LIBR) $(OBJS)
+ $(LL) -o $@ $(CFLAGS) $(OBJS) $(LIBR) $(LIBS)
+
+-include $(OBJS:.o=.d)
+
+# objects compiled from source
+$(OBJS) : %.o : %.c
+ $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@
+
+# C library compile
+$(LIBR) :
+ @$(MAKE) -C $(BASEDIR) $(MAKE_FLAGS)
# Compile C source from merged mruby source
-$(CLIB) : $(RLIB) $(MRBC)
- $(MRBC) -Bmritlib_irep -o$(DLIB) $(RLIB); cat init_$(TARGET).c $(DLIB) > $@
+$(CLIB) : $(RLIB) $(MRBC) $(INIT)
+ $(MRBC) -Bmrbtest_irep -o$(DLIB) $(RLIB); cat $(INIT) $(DLIB) > $@
$(MRBC) : ../src/opcode.h ../src/codegen.c ../src/parse.y
$(MAKE) -C ../tools/mrbc $(MAKE_FLAGS)
@@ -66,5 +102,4 @@ $(RLIB) : $(MRBS)
.PHONY : clean
clean :
@echo "make: removing targets, objects and depend files of `pwd`"
- -rm -f $(MRBC) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(LIBR)
-
+ -rm -f $(MRBC) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(OBJS) $(EXE)
View
14 tools/mrit/mrit.c → test/driver.c
@@ -1,10 +1,10 @@
/*
-** mrit - Embeddable Ruby ISO Test
+** mrbtest - Test for Embeddable Ruby
**
-** This program verifies ISO/IEC 30170:2012
+** This program runs Ruby test programs in test/t directory
** against the current mruby implementation.
*/
-
+
#include <string.h>
#include <mruby.h>
@@ -13,12 +13,12 @@
#include <compile.h>
void
-mrb_init_mritlib(mrb_state *);
+mrb_init_mrbtest(mrb_state *);
/* Print a short remark for the user */
void print_hint(void)
{
- printf("mrit - Embeddable Ruby ISO Test\n");
+ printf("mrbtest - Embeddable Ruby Test\n");
printf("\nThis is a very early version, please test and report errors.\n");
printf("Thanks :)\n\n");
}
@@ -35,7 +35,7 @@ main(void)
/* new interpreter instance */
mrb_interpreter = mrb_open();
- mrb_init_mritlib(mrb_interpreter);
+ mrb_init_mrbtest(mrb_interpreter);
parser = mrb_parse_nstring_ext(mrb_interpreter, "report()", strlen("report()"));
/* generate bytecode */
@@ -48,7 +48,7 @@ main(void)
mrb_top_self(mrb_interpreter));
/* did an exception occur? */
if (mrb_interpreter->exc) {
- mrb_p(mrb_interpreter, mrb_obj_value(mrb_interpreter->exc));
+ mrb_p(mrb_interpreter, mrb_return_value);
mrb_interpreter->exc = 0;
}
else {
View
7 test/init_mritlib.c → test/init_mrbtest.c
@@ -4,14 +4,13 @@
#include "mruby/string.h"
#include "mruby/proc.h"
-extern const char mritlib_irep[];
+extern const char mrbtest_irep[];
void
-mrb_init_mritlib(mrb_state *mrb)
+mrb_init_mrbtest(mrb_state *mrb)
{
- int n = mrb_read_irep(mrb, mritlib_irep);
+ int n = mrb_read_irep(mrb, mrbtest_irep);
- extern mrb_value mrb_top_self(mrb_state *mrb);
mrb_run(mrb, mrb_proc_new(mrb, mrb->irep[n]), mrb_top_self(mrb));
}
View
0  test/_assert.rb → test/t/_assert.rb
File renamed without changes
View
0  test/array.rb → test/t/array.rb
File renamed without changes
View
0  test/time.rb → test/t/time.rb
File renamed without changes
View
82 tools/mrit/Makefile
@@ -1,82 +0,0 @@
-# makefile discription.
-# basic build file for mrit executable
-
-# project-specific macros
-# extension of the executable-file is modifiable(.exe .out ...)
-BASEDIR = ../../src
-TARGET := ../../bin/mrit
-LIBR := ../../lib/libmruby.a
-LIBRIT := ../../lib/libmrit.a
-ifeq ($(OS),Windows_NT)
-EXE := $(TARGET).exe
-else
-EXE := $(TARGET)
-endif
-OBJ0 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/../tools/mrit/*.c))
-#OBJ1 := $(patsubst %.c,%.o,$(filter-out $(EXCEPT1),$(wildcard $(BASEDIR)/*.c)))
-#OBJ2 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/ext/regex/*.c))
-#OBJ3 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/ext/enc/*.c))
-OBJS := $(OBJ0)
-
-# ext libraries
-#EXT1 := $(patsubst %.c,%.o,$(wildcard $(BASEDIR)/../ext/socket/*.c))
-EXTS := $(EXT1)
-
-# libraries, includes
-LIBS = -lm
-INCLUDES = -I$(BASEDIR) -I$(BASEDIR)/../include
-
-# compiler, linker (gcc)
-CC = gcc
-LL = gcc
-YACC = bison
-DEBUG_MODE = 1
-ifeq ($(DEBUG_MODE),1)
-CFLAGS = -g -O3
-else
-CFLAGS = -O3
-endif
-ALL_CFLAGS = -Wall -Werror-implicit-function-declaration $(CFLAGS)
-ifeq ($(OS),Windows_NT)
- MAKE_FLAGS = CC=$(CC) LL=$(LL) ALL_CFLAGS="$(ALL_CFLAGS)"
-else
- MAKE_FLAGS = CC='$(CC)' LL='$(LL)' ALL_CFLAGS='$(ALL_CFLAGS)'
-endif
-
-##############################
-# generic build targets, rules
-
-.PHONY : all
-all : $(LIBRIT) $(LIBR) $(EXE)
- @echo "make: built targets of `pwd`"
-
-# executable constructed using linker from object files
-$(EXE) : $(LIBRIT) $(LIBR) $(OBJS) $(EXTS)
- $(LL) -o $@ $(CFLAGS) $(OBJS) $(LIBRIT) $(LIBR) $(EXTS) $(LIBS)
-
--include $(OBJS:.o=.d)
-
-# objects compiled from source
-$(OBJS) : %.o : %.c
- $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@
-
-# C library compile
-$(LIBR) :
- @$(MAKE) -C $(BASEDIR) $(MAKE_FLAGS)
-$(LIBRIT) :
- @$(MAKE) -C $(BASEDIR) $(MAKE_FLAGS)
-
-# mrit library compile
-# extend libraries complile
-$(EXTS) : %.o : %.c
- $(CC) $(ALL_CFLAGS) -MMD $(INCLUDES) -c $< -o $@
-
-# clean up
-.PHONY : clean #cleandep
-clean :
- $(MAKE) clean -C ../../test $(MAKE_FLAGS)
- $(MAKE) clean -C ../../mrblib $(MAKE_FLAGS)
- $(MAKE) clean -C ../mrbc $(MAKE_FLAGS)
- @echo "make: removing targets, objects and depend files of `pwd`"
- -rm -f $(EXE) $(OBJS)
- -rm -f $(OBJS:.o=.d)
Please sign in to comment.
Something went wrong with that request. Please try again.