about summary refs log tree commit homepage
path: root/t/GNUmakefile
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-10-24 20:41:15 -0700
committerEric Wong <normalperson@yhbt.net>2009-10-24 20:42:57 -0700
commit15fe80b3bff7b0d249ee32bcbbe1dfa116d3c629 (patch)
tree8edf5313e3ef41395b406706dd807b97e6321eb9 /t/GNUmakefile
parente77369a6bde35a4e8925d450aac85f328f87d208 (diff)
downloadrainbows-15fe80b3bff7b0d249ee32bcbbe1dfa116d3c629.tar.gz
This will make it easier to enable and manage tests for new
concurrency models.
Diffstat (limited to 't/GNUmakefile')
-rw-r--r--t/GNUmakefile33
1 files changed, 25 insertions, 8 deletions
diff --git a/t/GNUmakefile b/t/GNUmakefile
index 24ce750..0966563 100644
--- a/t/GNUmakefile
+++ b/t/GNUmakefile
@@ -16,8 +16,25 @@ else
 endif
 export RUBYLIB RUBY_VERSION
 
+models := ThreadPool ThreadSpawn Revactor Rev
+all_models := $(models) Base
+
 T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
 
+MODEL_T := $(foreach m,$(all_models),$(addprefix $(m).,$(T)))
+$(T): MODELS = $(models)
+
+# some tests can be run with all models
+t0000-simple-http.sh: MODELS = $(all_models)
+
+# this test is not compatible with non-Thread models yet
+t9000-rack-app-pool.sh: MODELS = ThreadPool ThreadSpawn
+
+# recursively run per-model tests
+# haven't figured out a good way to make make non-recursive here, yet...
+$(T):
+        $(MAKE) $(foreach m,$(MODELS),$(addprefix $(m).,$@))
+
 all:: $(T)
 
 # can't rely on "set -o pipefail" since we don't require bash or ksh93 :<
@@ -25,7 +42,6 @@ t_pfx = trash/$@-$(RUBY_VERSION)
 TEST_OPTS =
 # TRACER = strace -f -o $(t_pfx).strace -s 100000
 # TRACER = /usr/bin/time -o $(t_pfx).time
-run_test = $(TRACER) $(SHELL) $(SH_TEST_OPTS) $@ $(TEST_OPTS)
 
 ifdef V
   ifeq ($(V),2)
@@ -42,18 +58,19 @@ test-bin-$(RUBY_VERSION)/rainbows: ../bin/rainbows
         $(RUBY) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $@+
         mv $@+ $@
 
-req_random_blob := $(wildcard t?1??-*.sh)
 random_blob:
         dd if=/dev/urandom bs=1M count=10 of=$@+
         mv $@+ $@
 
-$(req_random_blob): random_blob
+$(T): random_blob
 
-$(T): trash/.gitignore
-$(T): export RUBY := $(RUBY)
-$(T): export PATH := $(CURDIR)/test-bin-$(RUBY_VERSION):$(PATH)
-$(T): test-bin-$(RUBY_VERSION)/rainbows
-        @$(run_test)
+$(MODEL_T): export model = $(firstword $(subst ., ,$@))
+$(MODEL_T): script = $(subst $(model).,,$@)
+$(MODEL_T): trash/.gitignore
+$(MODEL_T): export RUBY := $(RUBY)
+$(MODEL_T): export PATH := $(CURDIR)/test-bin-$(RUBY_VERSION):$(PATH)
+$(MODEL_T): test-bin-$(RUBY_VERSION)/rainbows
+        $(TRACER) $(SHELL) $(SH_TEST_OPTS) $(script) $(TEST_OPTS)
 
 trash/.gitignore:
         mkdir -p $(@D)