summaryrefslogtreecommitdiff
path: root/tests/SConscript
blob: ffcb666e764ca838635f8407429eda32fc9b576a (plain)
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
Import('env')

tests = Split('prepare.sh \
	run-tests.pl \
	cleanup.sh')

extra_dist = Split(' \
	condition.conf \
	core-condition.t \
	fastcgi-responder.conf \
	LightyTest.pm \
	lighttpd.conf \
	lighttpd.htpasswd \
	lighttpd.user \
	mod-fastcgi.t \
	mod-scgi.t \
	proxy.conf \
	request.t \
	scgi-responder.conf \
	var-include-sub.conf \
	wrapper.sh \
	')

fcgi_responder = env.Program("fcgi-responder", "fcgi-responder.c")
scgi_responder = env.Program("scgi-responder", "scgi-responder.c")

def CopyTestBinary(env, binary):
	return env.Command(target = env['ENV']['top_builddir'] + '/tests/' + binary, source = binary, action = Copy("$TARGET", "$SOURCE"))

def BuildTestEnv(env, build_type):
	builddir = build_type
	dependencies = [build_type]
	if build_type == 'dynamic':
		builddir = '.'
		dependencies += ['modules']

	testenv = env.Clone()
	testenv['ENV']['srcdir']='tests'
	testenv['ENV']['top_builddir']='sconsbuild/' + builddir
	prepare = testenv.AlwaysBuild(testenv.Command(build_type + '/prepare', 'prepare.sh', 'tests/prepare.sh'))
	runtests = testenv.AlwaysBuild(testenv.Command(build_type + '/run-tests', 'run-tests.pl', 'tests/run-tests.pl'))
	cleanup = testenv.AlwaysBuild(testenv.Command(build_type + '/cleanup', 'cleanup.sh', 'tests/cleanup.sh'))
	testenv.Depends(runtests, prepare)
	testenv.Depends(cleanup, runtests)
	SideEffect('dummy-file-prevent-running-tests-in-parallel', runtests)

	testenv.Depends(runtests, dependencies)

	fcgis = [CopyTestBinary(testenv, 'fcgi-responder'), CopyTestBinary(testenv, 'scgi-responder')]
	testenv.Depends(runtests, fcgis)

	return [prepare, runtests, cleanup]

check_dynamic = env.Alias('check_dynamic', BuildTestEnv(env, 'dynamic'))
env.Depends(check_dynamic, 'modules')
check_static = env.Alias('check_static', BuildTestEnv(env, 'static'))
check_fullstatic = env.Alias('check_fullstatic', BuildTestEnv(env, 'fullstatic'))

checks = []

if env['build_dynamic']:
	checks += check_dynamic

if env['build_static']:
	checks += check_static

if env['build_fullstatic']:
	checks += check_fullstatic

env.Alias('check', checks)