From 2a2dce97cb3b8221271d88b580f35046c25167ad Mon Sep 17 00:00:00 2001 From: OGINO Masanori Date: Thu, 16 Jul 2015 17:44:34 +0900 Subject: [PATCH 1/4] Add TEST_RUNNER variable to makefiles. Signed-off-by: OGINO Masanori --- Makefile | 2 ++ contrib/10.macro/nitro.mk | 2 +- contrib/20.r7rs/nitro.mk | 2 +- contrib/30.optional/nitro.mk | 2 +- contrib/30.random/nitro.mk | 2 +- contrib/30.readline/nitro.mk | 2 +- contrib/30.regexp/nitro.mk | 2 +- contrib/40.srfi/nitro.mk | 2 +- contrib/50.for/nitro.mk | 2 +- contrib/90.array/nitro.mk | 2 +- 10 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 809d867d..3910f98f 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,8 @@ CONTRIB_INITS = CONTRIB_TESTS = CONTRIB_DOCS = $(wildcard contrib/*/docs/*.rst) +TEST_RUNNER = bin/picrin + CFLAGS += -I./extlib/benz/include -Wall -Wextra LDFLAGS += -lm diff --git a/contrib/10.macro/nitro.mk b/contrib/10.macro/nitro.mk index a426ad2a..4d32cc3f 100644 --- a/contrib/10.macro/nitro.mk +++ b/contrib/10.macro/nitro.mk @@ -3,4 +3,4 @@ CONTRIB_LIBS += $(wildcard contrib/10.macro/*.scm) CONTRIB_TESTS += test-macro test-macro: bin/picrin - bin/picrin contrib/10.macro/t/ir-macro.scm + $(TEST_RUNNER) contrib/10.macro/t/ir-macro.scm diff --git a/contrib/20.r7rs/nitro.mk b/contrib/20.r7rs/nitro.mk index 9ddf756f..235a68c8 100644 --- a/contrib/20.r7rs/nitro.mk +++ b/contrib/20.r7rs/nitro.mk @@ -27,5 +27,5 @@ CONTRIB_TESTS += test-r7rs test-r7rs: bin/picrin for test in `ls contrib/20.r7rs/t/*.scm`; do \ - bin/picrin "$$test"; \ + $(TEST_RUNNER) "$$test"; \ done diff --git a/contrib/30.optional/nitro.mk b/contrib/30.optional/nitro.mk index 78b4ade3..5711699f 100644 --- a/contrib/30.optional/nitro.mk +++ b/contrib/30.optional/nitro.mk @@ -3,5 +3,5 @@ CONTRIB_TESTS += test-optional test-optional: bin/picrin for test in `ls contrib/30.optional/t/*.scm`; do \ - bin/picrin $$test; \ + $(TEST_RUNNER) $$test; \ done diff --git a/contrib/30.random/nitro.mk b/contrib/30.random/nitro.mk index a392fd17..043c23a8 100644 --- a/contrib/30.random/nitro.mk +++ b/contrib/30.random/nitro.mk @@ -4,5 +4,5 @@ CONTRIB_TESTS += test-random test-random: bin/picrin for test in `ls contrib/30.random/t/*.scm`; do \ - bin/picrin $$test; \ + $(TEST_RUNNER) $$test; \ done diff --git a/contrib/30.readline/nitro.mk b/contrib/30.readline/nitro.mk index ec69703a..fe017e7a 100644 --- a/contrib/30.readline/nitro.mk +++ b/contrib/30.readline/nitro.mk @@ -12,5 +12,5 @@ contrib/src/readline.o: contrib/src/readline.c test-readline: bin/picrin for test in `ls contrib/30.readline/t/*.scm`; do \ - bin/picrin $$test; \ + $(TEST_RUNNER) $$test; \ done diff --git a/contrib/30.regexp/nitro.mk b/contrib/30.regexp/nitro.mk index b96f5e59..3b10f016 100644 --- a/contrib/30.regexp/nitro.mk +++ b/contrib/30.regexp/nitro.mk @@ -4,5 +4,5 @@ CONTRIB_TESTS += test-regexp test-regexp: bin/picrin for test in `ls contrib/30.regexp/t/*.scm`; do \ - bin/picrin $$test; \ + $(TEST_RUNNER) $$test; \ done diff --git a/contrib/40.srfi/nitro.mk b/contrib/40.srfi/nitro.mk index c939e570..e68b7a21 100644 --- a/contrib/40.srfi/nitro.mk +++ b/contrib/40.srfi/nitro.mk @@ -19,5 +19,5 @@ CONTRIB_TESTS += test-srfi test-srfi: bin/picrin for test in `ls contrib/40.srfi/t/*.scm`; do \ - bin/picrin "$$test"; \ + $(TEST_RUNNER) "$$test"; \ done diff --git a/contrib/50.for/nitro.mk b/contrib/50.for/nitro.mk index 2ca63f23..ba5a25c5 100644 --- a/contrib/50.for/nitro.mk +++ b/contrib/50.for/nitro.mk @@ -3,5 +3,5 @@ CONTRIB_TESTS += test-for test-for: bin/picrin for test in `ls contrib/50.for/t/*.scm`; do \ - bin/picrin "$$test"; \ + $(TEST_RUNNER) "$$test"; \ done diff --git a/contrib/90.array/nitro.mk b/contrib/90.array/nitro.mk index dc914f06..3d8a4770 100644 --- a/contrib/90.array/nitro.mk +++ b/contrib/90.array/nitro.mk @@ -3,4 +3,4 @@ CONTRIB_LIBS += $(wildcard contrib/90.array/*.scm) CONTRIB_TESTS += test-array test-array: bin/picrin - bin/picrin contrib/90.array/t/array.scm + $(TEST_RUNNER) contrib/90.array/t/array.scm From 8e90f176052ac67d76faec348924944c1b92bb42 Mon Sep 17 00:00:00 2001 From: OGINO Masanori Date: Thu, 16 Jul 2015 17:45:44 +0900 Subject: [PATCH 2/4] Cosmetic change. Signed-off-by: OGINO Masanori --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3910f98f..db9cf208 100644 --- a/Makefile +++ b/Makefile @@ -25,11 +25,11 @@ prefix = /usr/local all: CFLAGS += -O2 -DNDEBUG=1 all: bin/picrin -include $(sort $(wildcard contrib/*/nitro.mk)) - debug: CFLAGS += -O0 -g debug: bin/picrin +include $(sort $(wildcard contrib/*/nitro.mk)) + bin/picrin: $(PICRIN_OBJS) $(CONTRIB_OBJS) lib/libbenz.a $(CC) $(CFLAGS) -o $@ $(PICRIN_OBJS) $(CONTRIB_OBJS) lib/libbenz.a $(LDFLAGS) From 8f4e2614e49f43105cde2239c0772ad101b5d55d Mon Sep 17 00:00:00 2001 From: OGINO Masanori Date: Thu, 16 Jul 2015 17:59:32 +0900 Subject: [PATCH 3/4] Add comment on how to test picrin with Valgrind. I hope we will really do it on Travis. :-) Reference: https://github.com/picrin-scheme/picrin/issues/294 Signed-off-by: OGINO Masanori --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 1c7119dd..91a12da9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,14 @@ addons: apt: packages: - gcc-multilib +# - valgrind env: - CFLAGS="-m32" - CFLAGS="-m64" script: - perl --version - make test +# - make test-contrib TEST_RUNNER="valgrind -q --leak-check=full --dsymutil=yes --error-exitcode=1 bin/picrin" - make clean - make debug - make test From 22e85c159e70331d7fafb73d34ef9b85064f375d Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 16 Jul 2015 18:44:23 +0900 Subject: [PATCH 4/4] cosmetic changes --- extlib/benz/gc.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/extlib/benz/gc.c b/extlib/benz/gc.c index fb2fa70f..5285f7ab 100644 --- a/extlib/benz/gc.c +++ b/extlib/benz/gc.c @@ -215,25 +215,25 @@ heap_free(pic_state *pic, void *ap) static void heap_morecore(pic_state *pic) { - union header *up, *np; + union header *bp, *np; struct heap_page *page; - size_t nu; + size_t nunits; - nu = PIC_HEAP_PAGE_SIZE / sizeof(union header); + nunits = PIC_HEAP_PAGE_SIZE / sizeof(union header); - assert(nu >= 2); + assert(nunits >= 2); - up = pic_malloc(pic, PIC_HEAP_PAGE_SIZE); - up->s.size = 0; /* up is never used for allocation */ - heap_free(pic, up + 1); + bp = pic_malloc(pic, PIC_HEAP_PAGE_SIZE); + bp->s.size = 0; /* bp is never used for allocation */ + heap_free(pic, bp + 1); - np = up + 1; - np->s.size = nu - 1; + np = bp + 1; + np->s.size = nunits - 1; heap_free(pic, np + 1); page = pic_malloc(pic, sizeof(struct heap_page)); - page->basep = up; - page->endp = up + nu; + page->basep = bp; + page->endp = bp + nunits; page->next = pic->heap->pages; pic->heap->pages = page;