xref: /lighttpd1.4/tests/SConscript (revision f03e5e23)
1Import('env')
2
3tests = Split('prepare.sh \
4	run-tests.pl \
5	cleanup.sh')
6
7extra_dist = Split('fastcgi-10.conf \
8	fastcgi-auth.conf \
9	fastcgi-responder.conf \
10	fastcgi-13.conf \
11	bug-06.conf \
12	bug-12.conf \
13	core-var-include.t \
14	var-include.conf \
15	var-include-sub.conf \
16	condition.conf \
17	core-condition.t \
18	core-request.t \
19	core-response.t \
20	core-keepalive.t \
21	mod-auth.t \
22	mod-cgi.t \
23	mod-compress.t \
24	mod-compress.conf \
25	mod-fastcgi.t \
26	mod-userdir.t \
27	request.t \
28	mod-ssi.t \
29	LightyTest.pm \
30	mod-setenv.t')
31
32fcgi_auth = None
33fcgi_responder = None
34scgi_responder = env.Program("scgi-responder", "scgi-responder.c")
35
36if env['LIBFCGI']:
37	fcgi_auth = env.Program("fcgi-auth", "fcgi-auth.c", LIBS=[env['LIBFCGI'], env['APPEND_LIBS']])
38	fcgi_responder = env.Program("fcgi-responder", "fcgi-responder.c", LIBS=[env['LIBFCGI'], env['APPEND_LIBS']])
39
40def CopyTestBinary(env, binary):
41	return env.Command(target = env['ENV']['top_builddir'] + '/tests/' + binary, source = binary, action = Copy("$TARGET", "$SOURCE"))
42
43def BuildTestEnv(env, build_type):
44	builddir = build_type
45	dependencies = [build_type]
46	if build_type == 'dynamic':
47		builddir = '.'
48		dependencies += ['modules']
49
50	testenv = env.Clone()
51	testenv['ENV']['srcdir']='tests'
52	testenv['ENV']['top_builddir']='sconsbuild/' + builddir
53	prepare = testenv.AlwaysBuild(testenv.Command(build_type + '/prepare', 'prepare.sh', 'tests/prepare.sh'))
54	runtests = testenv.AlwaysBuild(testenv.Command(build_type + '/run-tests', 'run-tests.pl', 'tests/run-tests.pl'))
55	cleanup = testenv.AlwaysBuild(testenv.Command(build_type + '/cleanup', 'cleanup.sh', 'tests/cleanup.sh'))
56	testenv.Depends(runtests, prepare)
57	testenv.Depends(cleanup, runtests)
58	SideEffect('dummy-file-prevent-running-tests-in-parallel', runtests)
59
60	testenv.Depends(runtests, dependencies)
61
62	if env['LIBFCGI']:
63		fcgis = [CopyTestBinary(testenv, 'fcgi-auth'), CopyTestBinary(testenv, 'fcgi-responder')]
64		testenv.Depends(runtests, fcgis)
65
66	return [prepare, runtests, cleanup]
67
68check_dynamic = env.Alias('check_dynamic', BuildTestEnv(env, 'dynamic'))
69env.Depends(check_dynamic, 'modules')
70check_static = env.Alias('check_static', BuildTestEnv(env, 'static'))
71check_fullstatic = env.Alias('check_fullstatic', BuildTestEnv(env, 'fullstatic'))
72
73checks = []
74
75if env['build_dynamic']:
76	checks += check_dynamic
77
78if env['build_static']:
79	checks += check_static
80
81if env['build_fullstatic']:
82	checks += check_fullstatic
83
84env.Alias('check', checks)
85