From fcc18638d01f50ba02621a6eaa2cf11be47d4d26 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 26 Oct 2009 19:13:41 -0700 Subject: tests: generate all dependencies atomically Using a "+" suffix alone was not enough protection since we use evil recursive makes and can't share dependency info with parent makes. While this could be done more efficiently (even with recursive make), but it'd be harder to maintain. So we generate the dependencies later to and sacrifice efficiency on the initial run (but rarely/never again). --- t/GNUmakefile | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/t/GNUmakefile b/t/GNUmakefile index d1b09cf..5129944 100644 --- a/t/GNUmakefile +++ b/t/GNUmakefile @@ -2,6 +2,8 @@ all:: +pid := $(shell echo $$PPID) + RUBY = $(ruby) rainbows_lib := $(shell cd ../lib && pwd) -include ../local.mk @@ -63,13 +65,13 @@ endif test-bin-$(RUBY_VERSION)/rainbows: ruby_bin = $(shell which $(RUBY)) test-bin-$(RUBY_VERSION)/rainbows: ../bin/rainbows mkdir -p $(@D) - install -m 755 $^ $@+ - $(RUBY) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $@+ - mv $@+ $@ + install -m 755 $^ $@.$(pid) + $(RUBY) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $@.$(pid) + mv $@.$(pid) $@ random_blob: - dd if=/dev/urandom bs=1M count=30 of=$@+ - mv $@+ $@ + dd if=/dev/urandom bs=1M count=30 of=$@.$(pid) + mv $@.$(pid) $@ $(T): random_blob @@ -77,10 +79,10 @@ dependencies := socat curl deps := $(addprefix .dep+,$(dependencies)) $(deps): dep_bin = $(lastword $(subst +, ,$@)) $(deps): - @which $(dep_bin) > $@+ 2>/dev/null || : - @test -s $@+ || \ + @which $(dep_bin) > $@.$(pid) 2>/dev/null || : + @test -s $@.$(pid) || \ { echo >&2 "E `$(dep_bin)' not found in PATH=$(PATH)"; exit 1; } - @mv $@+ $@ + @mv $@.$(pid) $@ dep: $(deps) $(MODEL_T): export model = $(firstword $(subst ., ,$@)) -- cgit v1.2.3-24-ge0c7