about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-10-20 05:54:59 +0000
committerEric Wong <normalperson@yhbt.net>2013-10-20 05:56:49 +0000
commit744bdd9b0531792f469fd8285bce32efadd6fed4 (patch)
tree0bc4536eb8900760e28b55ab720b2522059f5638
parentbcb10abe53cfb1d6a8ef7daef59eb10ced397c8a (diff)
downloadyahns-744bdd9b0531792f469fd8285bce32efadd6fed4.tar.gz
This should make it easier to figure out which installation of
Ruby the tester is using.
-rw-r--r--GNUmakefile14
-rw-r--r--test/helper.rb4
2 files changed, 15 insertions, 3 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 97f68d5..c515d83 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -2,21 +2,29 @@
 # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
 all::
 pkg = yahns
-RUBY = ruby
+rubybin := $(shell which ruby)
+RUBY = $(rubybin)
 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
         @./GIT-VERSION-GEN
 -include GIT-VERSION-FILE
 lib := lib
 
+ifeq ($(RUBY_TEST_OPTS),)
+  ifeq ($(V),1)
+    RUBY_TEST_OPTS := -v
+  endif
+endif
+
 all:: test
 test_units := $(wildcard test/test_*.rb)
 test: $(test_units)
 $(test_units):
-        $(RUBY) -I $(lib) $@ -v
+        $(RUBY) -I $(lib) $@ $(RUBY_TEST_OPTS)
 
 test-mt: export N = $(shell nproc 2>/dev/null || echo 4)
+test-mt: t := $(addprefix -r./,$(test_units))
 test-mt:
-        $(RUBY) -I $(lib) $(addprefix -r./,$(test_units)) -eTime.now --
+        $(RUBY) -I $(lib) $(t) -erubyv -- $(RUBY_TEST_OPTS)
 
 check-warnings:
         @(for i in $$(git ls-files '*.rb'| grep -v '^setup\.rb$$'); \
diff --git a/test/helper.rb b/test/helper.rb
index 71b1ef2..92fd1bc 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -4,6 +4,10 @@ $stdout.sync = $stderr.sync = Thread.abort_on_exception = true
 $-w = true if RUBY_VERSION.to_f >= 2.0
 require 'thread'
 
+def rubyv
+  puts RUBY_DESCRIPTION
+end
+
 # Global Test Lock, to protect:
 #   Process.wait*, Dir.chdir, ENV, trap, require, etc...
 GTL = Mutex.new