File: Makefile.in

package info (click to toggle)
fsvs 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,964 kB
  • ctags: 1,464
  • sloc: ansic: 16,650; sh: 5,885; perl: 783; makefile: 338; python: 90
file content (214 lines) | stat: -rw-r--r-- 6,198 bytes parent folder | download | duplicates (3)
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
###   MUST BE EDITED AS UTF-8!   ####
#
# BINARY needs to be set to the program to test.
#
# CHECKER can eg. be strace or valgrind
# if VERBOSE is set, debug and verbose level is turned on.
# TEST_LIST can be a list of test scripts to run.
# TL_FROM can be a pattern from which to (re-)start the scripts.
# 
ifndef BINARY
$(error Which program should I test?)
endif


TEST_PROG_DIR	:= $(shell pwd)


VALGRIND	:= valgrind --trace-children=no -v --error-exitcode=1 --log-file=/tmp/valgrind.out --suppressions=$(TEST_PROG_DIR)/valgrind-suppressions.supp
CALLGRIND	:= valgrind -q --tool=callgrind --collect-systime=yes --collect-jumps=yes --dump-instr=yes --callgrind-out-file=/tmp/valgrind.%p.out 
MEMCHECK	:= valgrind --leak-check=full --show-reachable=yes --num-callers=15 --log-file=/tmp/valgrind-%p.out --time-stamp=yes 
MEMCHECK_G:= valgrind --trace-children=no -v --error-exitcode=1 --log-file=/tmp/valgrind.%p.out --suppressions=$(TEST_PROG_DIR)/valgrind-suppressions.supp --gen-suppressions=all

export VALGRIND CALLGRIND MEMCHECK
ifeq ($(CHECKER),valgrind)
override CHECKER	:= $(VALGRIND)
endif
ifeq ($(CHECKER),callgrind)
override CHECKER	:= $(CALLGRIND)
endif
ifeq ($(CHECKER),memcheck)
override CHECKER	:= $(MEMCHECK)
endif
ifeq ($(CHECKER),memcheck_g)
override CHECKER	:= $(MEMCHECK_G)
endif


# if $BINARY starts with /, it's an absolute path; take it.
# else prepend the current path.
BIN_FULLPATH	:= $(if $(BINARY:/%=),$(shell pwd)/$(BINARY),$(BINARY))

# Binary with no special parameters
BINdflt	:= $(CHECKER) $(BIN_FULLPATH)

# Binary quiet
BINq	:= $(BINdflt) -q
# Binary, with optional verbosity (VERBOSE=1) or quiet
BIN	:= $(BINdflt)
ifdef VERBOSE
BIN	+= -d -v
BASH_VERBOSE := -x
else
BIN	+= -q
BASH_VERBOSE := 
endif

# options from configure
opt_DEBUG	= @ENABLE_DEBUG@
export opt_DEBUG BASH_VERBOSE TEST_LIST


ifdef TEST_LIST
# only run the specified tests ...
else
# A common problem (at least for me) is that I write
#   TL_FROM=018*
# analogous to
#   TEST_LIST=018*
# But the one thing is a grep, the other a shell pattern ...
# So a * at the end gets removed.
TEST_LIST := $(shell cd $(TEST_PROG_DIR) && ls ???_* | sort | grep -A 2000 "$(TL_FROM:%*=%)" )
endif

ifeq ($(PROTOCOL), svn+ssh)
override PROTOCOL=svn+ssh://localhost
endif

ifeq ($(RANDOM_ORDER), 1)
TEST_LIST	:= $(shell perl -e 'srand();  while (@ARGV) { print splice(@ARGV, rand(@ARGV), 1),"\n"; } ' $(TEST_LIST))
endif

# For use by the locale-dependent tests.
STG_UTF8:=xxµxWörstCäseTäßt
# This gives eg. for de_AT "Jän", but in the locale encoding (eg. 8859-1)
STG_LOC:=$(shell date +%b -d2001-01-27)
# We don't use the 1st - depending on the timezone settings this might give  
# us December.
export STG_UTF8 STG_LOC


UID	:= $(shell id -u)
TESTBASEx ?= /tmp
TESTBASE	:= $(TESTBASEx)/fsvs-test-$(UID)

REP	:= $(TESTBASE)/repos
LOGDIR	:= $(TESTBASE)/log
PROTOCOL ?= file://
REPURLBASE:= $(PROTOCOL)$(REP)
REPSUBDIR	:= trunk
REPURL	:= $(REPURLBASE)/$(REPSUBDIR)

WCBASE	:= $(TESTBASE)/wc-
# Please note that if your test script uses more than the normal 
# two working copies only WC1 (=WC) and WC2 are defined
WC_COUNT	?= 2
WC	:= $(WCBASE)1
WC2	:= $(WCBASE)2
WC1	:= $(WC)

DFLT_REPO	:= $(TESTBASE)/default-repos.dump

export REP REPURL REPSUBDIR REPURLBASE WC WC1 WC2 DFLT_REPO WC_COUNT WCBASE
export BIN BINdflt BINq TEST_PROG_DIR LOGDIR BIN_FULLPATH

PREPARE_REPOS	:= $(MAKE) -s -C $(TEST_PROG_DIR) prepare_repos 
PREPARE_WC1	:= $(MAKE) -s -C $(TEST_PROG_DIR) prepare_wc1 
PREPARE_WC2	:= $(MAKE) -s -C $(TEST_PROG_DIR) prepare_wc2 
PREPARE_DEFAULT	:= $(MAKE) -s -C $(TEST_PROG_DIR) prepare_repos
PREPARE_CLEAN	:= $(MAKE) -s -C $(TEST_PROG_DIR) prepare_clean
INCLUDE_FUNCS	:= . $(TEST_PROG_DIR)/test_functions

export PREPARE_REPOS PREPARE_WC1 PREPARE_WC2 PREPARE_CLEAN PREPARE_DEFAULT 
export INCLUDE_FUNCS TESTBASE

WC2_UP_ST_COMPARE	:= $(TEST_PROG_DIR)/up_st_cmp
export WC2_UP_ST_COMPARE
COMPONENT_SCRIPT	:= $(TEST_PROG_DIR)/component-test.pl
export COMPONENT_SCRIPT


FSVS_WAA	:= $(TESTBASE)/waa
FSVS_CONF	:= $(TESTBASE)/conf

export FSVS_WAA FSVS_CONF

all: $(TESTBASE) $(FSVS_WAA) $(FSVS_CONF) $(DFLT_REPO) run_tests 

$(TESTBASE):
	test -d $(TESTBASE) || mkdir -p $(TESTBASE)
$(FSVS_WAA):
	test -d $(FSVS_WAA) || mkdir -p $(FSVS_WAA)
$(FSVS_CONF):
	test -d $(FSVS_CONF) || mkdir -p $(FSVS_CONF)


SANITIZE := perl -pe 's/([^\x20-\x7e\r\n]+)/sprintf("\\(%s)", unpack("H*", $$1))/eg;'
diag:
	@echo "testbase: $(TESTBASE)"
	@echo "tests   : $(TEST_LIST)"
	@echo "binary  : $(BIN)"
	@echo "checker : $(CHECKER)"
	@echo "verbose : $(VERBOSE)"
	@echo "def.repo: $(DFLT_REPO)"
	@echo "waa     : $(FSVS_WAA)"
	@echo "conf    : $(FSVS_CONF)"
	@echo "stg_utf8: $(STG_UTF8)" | $(SANITIZE)
	@echo "stg_loc : $(STG_LOC)" | $(SANITIZE)

locale_strings:
	@echo $(STG_UTF8)
	@echo $(STG_LOC)

.PHONY: locale_strings diag

$(DFLT_REPO): $(TEST_PROG_DIR)/001_init_dir
	@echo Preparing default repository.
	@$<
	@svnadmin dump -q $(REP) > $@

prepare_empty:
	@echo Preparing clean repository ...
	test -d $(REP) && rm -rf $(REP) || true
	rm -rf $(FSVS_CONF) $(FSVS_WAA) || true
	$(MAKE) $(FSVS_CONF) $(FSVS_WAA) || true
	test -d $(LOGDIR) || mkdir $(LOGDIR)
	svnadmin create $(REP)
	echo '' > $(FSVS_CONF)/config

prepare_clean:
	$(MAKE) -s prepare_empty 
	svn mkdir -m "mkdir trunk" $(REPURL)
	$(MAKE) -s CMD="ci -m x" prepare_wcs WC_COUNT=$(WC_COUNT)
	$(BIN_FULLPATH) delay $(WC1)

prepare_repos:
	@echo Loading repository ...
	$(MAKE) -s prepare_empty
	svnadmin load -q $(REP) < $(DFLT_REPO)
	$(MAKE) -s CMD="up" prepare_wcs WC_COUNT=$(WC_COUNT)
	$(BIN_FULLPATH) delay $(WC1)

prepare_wcs:
	for i in `seq 1 $(WC_COUNT)` ; do $(MAKE) prepare_wc "CMD=$(CMD)" _WC=$(WCBASE)$$i ; done

.PHONY: prepare_repos prepare_clean prepare_empty

ifdef _WC
prepare_wc:
	@echo Preparing $(_WC) ...
	test -d $(_WC) && rm -rf $(_WC) || true
	mkdir $(_WC)
	rm $(shell $(TEST_PROG_DIR)/path2spool $(_WC)  "")/* 2> /dev/null || true
	rm $(shell $(TEST_PROG_DIR)/path2spool $(_WC) "^")/* 2> /dev/null || true 
	cd $(_WC) && echo N:url,$(REPURL) | $(BINq) urls load
ifdef CMD
	cd $(_WC) && $(BINq) $(CMD)
endif
endif

run_tests:
	@echo Running tests $(TEST_LIST) ... 
	@echo '' > $(FSVS_CONF)/config
	@$(TEST_PROG_DIR)/run-tests