Rainbows! Rack HTTP server user/dev discussion
 help / color / Atom feed
5979371fa47e2a976763546ea804b6203670a5e1 blob 3606 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
 
# we can run tests in parallel with GNU make

all::

pid := $(shell echo $$PPID)

MRI = ruby
RUBY = ruby
rainbows_lib := $(shell cd ../lib && pwd)
-include ../local.mk
ifeq ($(RUBY_VERSION),)
  RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
endif

ifeq ($(RUBY_VERSION),)
  $(error unable to detect RUBY_VERSION)
endif

RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
export RUBY_VERSION RUBY_ENGINE

ifeq (Linux,$(shell uname -s))
  models += XEpoll
  models += XEpollThreadSpawn
  models += XEpollThreadPool
  models += Epoll
endif
models += WriterThreadPool
models += WriterThreadSpawn
models += ThreadPool
models += ThreadSpawn
models += Coolio

models += StreamResponseEpoll

ifeq ($(RUBY_ENGINE),ruby)
  rp := )
  ONENINE := $(shell case $(RUBY_VERSION) in 1.9.*|2.0.*$(rp) echo true;;esac)
  ifeq ($(ONENINE),true)
    ifeq ($(RUBY_VERSION),1.9.2)
      models += Revactor
    endif
    models += FiberSpawn
    models += FiberPool
    models += CoolioThreadPool
    models += CoolioThreadSpawn
    models += CoolioFiberSpawn
    models += EventMachine
    models += EventMachineThreadDefer
    models += EventMachineThreadPool
    models += EventMachineThreadSpawn
    models += NeverBlock
  endif
endif

ifeq ($(RUBY_ENGINE),rbx)
  models += ActorSpawn
endif
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)
t0001-unix-http.sh: MODELS = $(all_models)
t0002-graceful.sh: MODELS = $(all_models)
t0002-parser-error.sh: MODELS = $(all_models)
t0003-reopen-logs.sh: MODELS = $(all_models)

# 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_models):
	$(MAKE) $(filter $@.%,$(MODEL_T))

all:: $(T)

# can't rely on "set -o pipefail" since we don't require bash or ksh93 :<
t_pfx = trash/$@-$(RUBY_ENGINE)-$(RUBY_VERSION)
TEST_OPTS =
# TRACER = strace -f -o $(t_pfx).strace -s 100000
# TRACER = /usr/bin/time -o $(t_pfx).time

ifdef V
  ifeq ($(V),2)
    TEST_OPTS += --trace
  else
    TEST_OPTS += --verbose
  endif
endif

bindir := $(CURDIR)/bin-$(RUBY_ENGINE)-$(RUBY_VERSION)
bin_rainbows := $(bindir)/rainbows
$(bin_rainbows): ruby_bin = $(shell which $(RUBY))
$(bin_rainbows): ../bin/rainbows
	mkdir -p $(@D)
	install -m 755 $^ $@.$(pid)
	$(MRI) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $@.$(pid)
	mv $@.$(pid) $@

random_blob:
	dd if=/dev/urandom bs=1M count=30 of=$@.$(pid)
	mv $@.$(pid) $@

dependencies := socat curl
deps := $(addprefix .dep+,$(dependencies))
$(deps): dep_bin = $(lastword $(subst +, ,$@))
$(deps):
	@which $(dep_bin) > $@.$(pid) 2>/dev/null || :
	@test -s $@.$(pid) || \
	  { echo >&2 "E '$(dep_bin)' not found in PATH=$(PATH)"; exit 1; }
	@mv $@.$(pid) $@

libs := tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION)/.libs
$(libs): test_isolate.rb
	mkdir -p $(@D)
	$(RUBY) $< > $@+
	mv $@+ $@
t_deps := random_blob $(libs) $(deps) $(bin_rainbows) trash/.gitignore
$(T): $(t_deps)

$(MODEL_T): export model = $(firstword $(subst ., ,$@))
$(MODEL_T): script = $(subst $(model).,,$@)
$(MODEL_T): export RUBY := $(RUBY)
$(MODEL_T): export PATH := $(bindir):$(PATH)
$(MODEL_T): $(t_deps)
	RUBYLIB=$(rainbows_lib):$$(cat $(libs)):$(RUBYLIB) \
	   $(TRACER) $(SHELL) $(SH_TEST_OPTS) $(script) $(TEST_OPTS)

trash/.gitignore:
	mkdir -p $(@D)
	echo '*' > $@

clean:
	$(RM) -r trash/*.log trash/*.code $(bindir)

.PHONY: $(T) clean
debug log:

solving 5979371 ...
found 5979371 in http://bogomips.org/rainbows-public/1379421104-75563-1-git-send-email-godfat@godfat.org/
found 19aacbe in http://bogomips.org/rainbows.git
preparing index
index prepared:
100644 19aacbe3a490b1381442ed2551906a2a68a44245	t/GNUmakefile

applying [1/1] http://bogomips.org/rainbows-public/1379421104-75563-1-git-send-email-godfat@godfat.org/
diff --git a/t/GNUmakefile b/t/GNUmakefile
index 19aacbe..5979371 100644

Checking patch t/GNUmakefile...
Applied patch t/GNUmakefile cleanly.

index at:
100644 5979371fa47e2a976763546ea804b6203670a5e1	t/GNUmakefile

Rainbows! Rack HTTP server user/dev discussion

Archives are clonable:
	git clone --mirror http://bogomips.org/rainbows-public
	git clone --mirror http://ou63pmih66umazou.onion/rainbows-public

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.rainbows
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.rainbows

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git